Add specular occlusion from ambient light#106145
Conversation
38294e8 to
7df3ce1
Compare
|
Nice!
Edit: In my initial test above I was using tonemapper exposure to make the resulting image brighter. However per @lander-vr's suggestion I tried to use camera exposure instead. This brought out reflections on open surfaces more, while corners still remain occluded, which gives a better result: |
7df3ce1 to
54e638a
Compare
servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
Outdated
Show resolved
Hide resolved
servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
Outdated
Show resolved
Hide resolved
e405e3a to
a17b656
Compare
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, it works as expected. Code looks good to me.
Co-authored-by: guerro323 <kaltobattle@gmail.com>
a17b656 to
56730d0
Compare
|
This might sound silly, but I've noticed a strange behavior while testing this PR. When you have a metallic material and you gradually reduce its roughness value, it undergoes a transition where the material abruptly changes from a dark color to a lighter one. This doesn't happen when you disable specular occlusion. 2025-05-08-18-56-06.mp4Is this expected behavior? |
|
@LiveTrower Mmmh, I cannot seem to reproduce this/notice any strange behavior. 25_05_09_11_22__godot.windows.editor.x86_64_AoTQQryMkJ.mp4What's happening in your video seems to be expected, I don't think this behavior is unusual. The effect is darkening specular lighting where ambient lighting is darker (In this case on faces with normals facing downwards), I don't think what's shown in your video looks out of the ordinary. Specular occlusion adds a little more depth to reflective surfaces, so it's normal for it to not be an exact match to when it is disabled. @clayjohn What do you think? |
|
@lander-vr As far as I know, default Godot shaders use diffuse Lambert by default, and StandardMaterials use diffuse Burley by default, so that could explain a different behavior. |
It's not an exact match. I will provide a very exaggerated example.
|
|
Thanks! |
See this PR for context as to why some specularity is left by default: #63587 |











Closes godotengine/godot-proposals#8637
Supersedes #86102
This is a rebase and rework of @guerro323's specular occlusion PR.
There's a few fundamental changes:
reflections.I'm not sure whether or not the project setting should still force a restart, since the implementation is cheaper and simpler now.
Forward+
Mobile
Compatibility
Tile-room test-scene is a quick remake of the scene in this Unity forum post