Check if sun scatter is enabled when using SKY_MODE_AUTOMATIC#113609
Check if sun scatter is enabled when using SKY_MODE_AUTOMATIC#113609Repiteo merged 1 commit intogodotengine:masterfrom
SKY_MODE_AUTOMATIC#113609Conversation
clayjohn
left a comment
There was a problem hiding this comment.
Why does enabling sun_scatter cause the radiance map to get updated? AFAIK it should only cause the directional light buffer to get updated.
|
godot/servers/rendering/renderer_rd/environment/sky.cpp Lines 1108 to 1118 in 05830df godot/servers/rendering/renderer_rd/environment/sky.cpp Lines 1262 to 1263 in 05830df |
Thanks, that's right. But the radiance buffer should only be updated if the directional light buffer is updated and the sky shader is using directional lights. So I think the proper solution will be to change when the radiance is set to dirty I.e. this: Should look like: |
|
@clayjohn If you go up a bit, this code is already dependent on: If sun scatter is enabled, lights appear in the sky even if the user's shader does not use anyLIGHTX_* built-ins (uses_lights will be false). Is this not the same reason for using SKY_MODE_INCREMENTAL when uses_lights == true?
|
Good point. I was forgetting that sun_scatter is evaluated in the sky shader. In my mind it was only in the scene shader and fog shader. In that case this is the correct fix! |
SKY_MODE_AUTOMATIC
|
Thanks! |
I noticed recently that when transforming a DirectionalLight3D in a particular scene, the performance was terrible. Similar to #107928,
shader_data->uses_lightdoes not include the case where lights are used in fog sun scatter. This pr makesSKY_MODE_AUTOMATICuseSKY_MODE_INCREMENTALinstead ofSKY_MODE_QUALITYif the user's sky shader does not useLIGHTX_*built-ins but lights are still used for fog.