-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dithering blend option between visibility range LODs (as a faster alternative to alpha fade) #5240
Comments
cc @JFonS This requires adding a transparency mode for dithered alpha to BaseMaterial3D, which doesn't exist yet. Once this is done, Visibility Range > Fade Mode should have 2 new fade modes added (for a total of 5):
See also godotengine/godot#61880.
This can already be implemented in 4.0.alpha1 using two different materials (with two sets of different distance fade properties), which is both a good thing and bad thing. Configure the visibility ranges to fully hide the materials after the fade transition distance to avoid visible pop-in. It's a good thing because it allows you to use simpler materials for distant LODs. For instance, you can disable height mapping or even normal mapping to further improve performance (especially on mobile). It's also a bad thing because it requires more manual setup, and has a performance impact as a result of having more materials (instead of reusing the same material). The visibility range approach will require less setup and won't require duplicating the material, so it'll be a bit faster in scenarios where you don't need a simpler material. If you do need a simpler material, you'll need to use the manual approach as I mentioned. Footnotes |
I think it would be beneficial to have this documented, I just tried it now and it does mitigate the issue. |
Isn't this just hashed alpha? What makes it different? |
Alpha hashing is intended to be used for different use cases, such as hair rendering with TAA enabled. See discussion in godotengine/godot#40364 and godotengine/godot#61880 (comment). |
It looks like visibility range fade (as well as the GeometryInstance3D Transparency property) already obeys the material's existing transparency mode. If you set it to Alpha Hash, then the fadeout will use alpha hashing (same with alpha scissor). However, this means you need to select the appropriate transparency mode on the material, which has a performance cost even if the material isn't currently being faded out (i.e. in its fully opaque state). As a result, there would still be a benefit of having a setting to configure how visibility range fade (and the Transparency property) should work. @clayjohn For LOD fading, do you think we should go with Alpha Hash or interleaved gradient noise as an alternative to alpha blending? To clarify, this isn't meant to replace the current behavior, but provide an additional option. |
Relates to godotengine/godot#88854 - Visibility Range Fade does not work correctly with Alpha Clip and Alpha Hash Materials |
I did a test of a crossfade dither and it works well. Here the two spheres are low and high density meshes, but as you can see the fade is very smooth due to the dither crossfade. Test project: |
Describe the project you are working on
A semi-open world making use of LODs
Describe the problem or limitation you are having in your project
Currently when switching between LODs there is a sharp and jarring transition between different levels of detail.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
As of godotengine/godot#50297 dithered alpha has been reimplemented and is now more performant - this, used in combination with LODs can reduce the artifacts of LOD switching. It does come at a performance cost, as two consecutive LODs have to be rendered at once, but used sparingly, the impact is outweighed by the improved visuals.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
In the StandardMaterial3D a new boolen parameter can be added (to ShaderMaterial too) which enables this. It should result in visuals like this:
https://couchlearn.com/fading-between-lods-in-unreal-engine-4/
If this enhancement will not be used often, can it be worked around with a few lines of script?
It is not possible to load two levels of detail at once which is required for this; if it is possible, it is likely very cumbersome.
Is there a reason why this should be core and not an add-on in the asset library?
It leverages and interacts with the built-in LOD system.
The text was updated successfully, but these errors were encountered: