Skip to content

Add Uncharted 4 microshadowing support #12671

@LiveTrower

Description

@LiveTrower

Describe the project you are working on

Godot Editor

Describe the problem or limitation you are having in your project

Real-time rendering often suffers from light leaking issues, resulting in flat illumination due to numerous limitations. One of these limitations lies in materials, where it's true that Godot already offers several options to mitigate this, such as the recent Specular Occlusion, Light Affect, and AO Channel Affect in SSAO, and AO Light Affect Standard Material 3D. However, Light Affect is not physically based, as mentioned in the SSAO and BaseMaterial3D documentation, which causes it to only darken textures.

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

The solution to this could be one of these three microshadows approaches:

  1. Technical Art of Uncharted 4 by Naughty Dog offers a visually impressive and inexpensive solution.
  2. Material Advances in Call of Duty: WWII by Activision Blizzard provides a solution that's superior to Uncharted 4's but is notably more complex and costly.
  3. Google Filament uses a simplification of Call of Duty: WWII, which visually looks worse and might be more expensive than Uncharted 4's approach.

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

In my opinion, the best option we have is to use the Uncharted 4 approach, which utilizes the following calculation:

float ApplyMicroShadow(float ao, float3 N, float3 L, float shadow)
{
	float aperture = 2.0 * ao * ao;
	float microShadow = saturate(abs(dot(L, N)) + aperture - 1.0);
	return shadow * microShadow;
}

Here I leave a comparison so you can see what it looks like.

Microshadows ON Microshadows OFF
Image Image

We could also incorporate an opacity parameter in Material 3D to increase or decrease the intensity of the microshadows effect, similar to how Unity does it.

Can it work on mobile render?
We can probably make this work for mobile rendering even for compatibility because of how simple the calculation is.

Note: This isn't a replacement for AO Light Affect, as it would break compatibility. Also, microshadows have the limitation of only working with a directional light. This is another reason, similar to the first note.

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

Perhaps this could be done with a GDShader, but it would require rebuilding almost all of Godot's PBR.

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

This is a PBR alternative to AO Light Affect, and it would be very complicated to add it as an add-on due to what was mentioned previously.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions