X Tutup
Skip to content

Apply sun scatter from lights with shadows in compatibility#107740

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Kaleb-Reid:compat-directional-shadow-scatter
Oct 6, 2025
Merged

Apply sun scatter from lights with shadows in compatibility#107740
Repiteo merged 1 commit intogodotengine:masterfrom
Kaleb-Reid:compat-directional-shadow-scatter

Conversation

@Kaleb-Reid
Copy link
Contributor

@Kaleb-Reid Kaleb-Reid commented Jun 19, 2025

Currently sun scatter does not affect scene objects for lights that have shadows in Compatibility because directional_light_count in scene.glsl does not include lights with shadows so that they can each be applied in separate passes from each other. This pr passes in the number of lights with shadows so that they can be factored into the sun scatter.

Before:
image

After:
image

In both images the cube is fully outside the depth end of the fog and should be fully obscured as is the case both without shadows enabled for the light in Compatibility and always in Forward+.

@Kaleb-Reid Kaleb-Reid requested a review from a team as a code owner June 19, 2025 22:08
@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch 2 times, most recently from 79a49e2 to 301ba18 Compare June 20, 2025 06:22
@AThousandShips AThousandShips added this to the 4.x milestone Jun 20, 2025
@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch from 301ba18 to c7ded01 Compare June 26, 2025 23:42
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected in all rendering methods (including with multiple DirectionalLights).

Code looks good to me.

Testing project: test-sun-scatter.zip

Forward+ Mobile Compatibility
image image image

@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch from c7ded01 to 18a8bf8 Compare October 3, 2025 18:54
@Kaleb-Reid
Copy link
Contributor Author

Rebased onto master

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@clayjohn clayjohn modified the milestones: 4.x, 4.6 Oct 4, 2025
@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch from 18a8bf8 to c20ab94 Compare October 4, 2025 07:38
@Kaleb-Reid
Copy link
Contributor Author

@clayjohn Had to fix this pr as well due to scene_data being renamed / moved and I messed up during the rebase.

@Repiteo Repiteo merged commit 12aa435 into godotengine:master Oct 6, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 6, 2025

Thanks!

@Kaleb-Reid Kaleb-Reid deleted the compat-directional-shadow-scatter branch October 6, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup