Skip to content
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

Make DirectionalLight3D's PSSM 2 Splits shadow mode use the split_2 property for the cutoff instead of split_1 #3464

Open
Calinou opened this issue Oct 23, 2021 · 0 comments

Comments

@Calinou
Copy link
Member

Calinou commented Oct 23, 2021

Related to #3353 and #2729.

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Godot offers 3 shadow modes for DirectionalLight3D. However, since only PSSM 4 Splits gives visually appealing results out of the box, people tend to forget about PSSM 2 Splits and Orthogonal shadow modes. These modes can improve performance a lot on low-end/mobile devices, so it's important to make them look as good as possible out of the box.

Orthogonal has been improved a lot in master, but PSSM 2 Splits still doesn't look good out of the box due to the heavy resolution discrepancy between the two splits.

We can make it less noticeable by using a larger distance for the first split. This will make its shadow less detailed, but it will span a longer range. On top of that, the resolution discrepancy between the first split and second split will be decreased.

This is already something you can do by adjusting the property when changing the shadow mode, but most people don't know how to tweak shadow split distances effectively. (Also, if you offer graphics settings selection, you need to remember to adjust the split distances for every DirectionalLight3D node.)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

By using the distance configured in Split 2 automatically instead of Split 1, we can choose a more suitable distance for the PSSM 2 Splits mode. This means the first split's ratio would now be 0.2 instead of 0.1 by default. This looks better in most scenes in practice, while not having any noticeable performance difference.

Split properties that don't have any impact on the current shadow mode would then be hidden from the inspector. This is what godotengine/godot#54147 implements, but it'll need to be changed to hide split_1_distance instead of split_2_distance when the shadow mode is PSSM 2 Splits.

This proposal does not affect the Orthogonal and PSSM 4 Splits shadow modes.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Default shadow settings

This is the current appearance with PSSM 4 Splits (it won't change with this proposal):

2021-10-23_16 13 55

PSSM 2 Splits with default shadow settings

This is the current appearance when you switch from PSSM 4 Splits to PSSM 2 Splits:

2021-10-23_16 14 00

PSSM 2 Splits with tweaked second split distance

This is what would happen automatically if this proposal is implemented:

2021-10-23_16 14 09

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes, as the shadow split distance can already be tweaked by the user. However, the goal here is to improve the default appearance so people don't shy from the lower-quality shadow modes as much when targeting mobile/web platforms 🙂

Once #3353 is implemented, we can also default to PSSM 2 Splits on mobile with more confidence.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

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

No branches or pull requests

2 participants