Hello, try to play with blending alpha function in GLSL. I got the window glass transparent.
If I render the object ordered by:
- Building, car, window, skybox, I can look through the window and the building and the car, while the skybox clipped.
- Window, building, car, skybox, the building, car, and sky are clipped.
- Skybox, building, car, window, I can look through the window correctly, no models are clipped.
By “clipped”, I presume that you mean “discarded by depth testing”.
If you render the window with depth writes enabled, then it will update the depth buffer, and any farther objects will fail the depth test.
If you render the window with depth writes disabled, then it won’t update the depth buffer, and any objects drawn after the window will overwrite it, regardless of whether they’re nearer or farther than the window.
In order for translucency to work correctly, it’s necessary to render the translucent surface after any opaque surfaces.
If you have multiple translucent surfaces, they have to be rendered in the correct order; if surface A is in front of surface B, A must be rendered after B. This can be done using a topological sort, or a BSP tree. For complex geometry, it’s typical to perform the sorting on a per-pixel basis using depth peeling or by storing a linked-list of fragments for each pixel.
Thanks for the clear explanation, GClements
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.