Don't write translucent objects to the depth buffer#586
Don't write translucent objects to the depth buffer#586ThePuzzlemaker wants to merge 1 commit intoorbitersim:mainfrom
Conversation
This fixes some issues with sun glare noticed by NASSP users, where the sun glare was hidden by the COAS (a translucent mesh). This also fixes the sun glare being hidden by the DG hud, for example. I implemented a simple heuristic for simple translucent objects (diffuse color alpha != 1.0), but others must be manually marked with the mesh group flag 0x40. Otherwise, checking translucency incurs checking every pixel of an image after considering textures, which is expensive and error-prone. These excluded objects do not write to the depth-buffer or the SSAO/glare calculation g-buffers, which I believe is probably an invalid behaviour with respect to the intended functionality. Please let me know if you find anything this breaks! I don't believe this should break anything, and it may actually fix other issues within Orbiter related to transparency.
|
Transparent objects are also used to clip/cut holes into a meshes (Z-clip technique). Therefore, "alpha != 1.0" would cause some problems. Also should be noted that Main scene rendering Z-buffer and Sun light blocking mask are two separate things in D3D9 but would be combined in Vulkan. It would be logical to have separate rendering passes for solid and translucent mesh groups. It's not been implemented due to tricky use of transparencies in Orbiter. Would make sense to mark those z-clipper groups with a special flag to cause them to render among the solids. All mesh group flags should be listed in a mesh file documentation. All of my orbiter installations are missing documentation, so, can't check it right now. |
|
Flag 0x40 seems to be first unused flag 0x00000001 & Do not use this group to render ground shadows |
This fixes some issues with sun glare noticed by NASSP users, where the sun glare was hidden by the COAS (a translucent mesh). This also fixes the sun glare being hidden by the DG hud, for example.
I implemented a simple heuristic for simple translucent objects (diffuse color alpha != 1.0), but others must be manually marked with the mesh group flag 0x401. Otherwise, checking translucency incurs checking every pixel of an image after considering textures, which is expensive and error-prone.
These excluded objects do not write to the depth-buffer or the SSAO/glare calculation g-buffers, which I believe is probably an invalid behaviour with respect to the intended functionality.
Please let me know if you find anything this breaks! I don't believe this should break anything, and it may actually fix other issues within Orbiter related to transparency.
Footnotes
I couldn't find a centralized place for mesh group flags, so please let me know if there is one or if this flag conflicts with anything. My cursory checking shows it does not, but I may have missed something. ↩