Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Feb 10, 2024

Fixes #27290.
Closes #27345.

Description

The distance property is currently coupled to the far value of shadow cameras in context of spot and point lights. That's because the engine provides an automatism that configures a proper far values based on the light's distance. However, the current implementation is inconsistent and produces a buggy behavior like reported in #27290 or #27523.

Since there is no clean way to fix this I suggest to completely remove the coupling. That means distance does not affect shadows anymore.

Devs who rely on a physically correct workflow won't notice this change since they do not change the default distance value 0. Devs with a custom distance value might have to update their light.shadow.camera.far to an appropriate value after this change. So this change needs to be noted in the migration guide.

With this PR devs always have to configure the shadow camera's frustum like with directional lights or when distance is zero which should produce a more predictable engine behavior.

@Mugen87 Mugen87 added this to the r162 milestone Feb 10, 2024
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
676.1 kB (168.2 kB) 676 kB (168.1 kB) -107 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
457.2 kB (111 kB) 457.2 kB (111 kB) +0 B

@Mugen87 Mugen87 removed this from the r162 milestone Feb 20, 2024
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Feb 20, 2024

After some more thinking I prefer #27345. It's in general a good thing when the engine tries to provide optimized shadow frustums based on light settings. This PR seems to be a step backward and makes the engine harder to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SpotLight map affected by distance updates

1 participant