Don't write translucent objects to the depth buffer #586
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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. ↩