Unity Issue Tracker - Custom terrain lighting is inverted compared to Unity Terrain when rotating directional light on X axis
Closed
UUM-114994
Custom terrain lighting is inverted compared to Unity Terrain when rotating directional light on X axis
Unity: Materials
As Designed
6.3.X
6.2.X
6.0.X
Hi.
In general, we do not offer support on custom shaders, but taking a quick look, I believe the problem is the math you use to calculate normals in your custom shader being incorrect.
How to reproduce:
1. Open the “IN-110952_HDRP_Terrain“ project
2. Open the “TestScene”
3. In the Inspector expand the “Continent Lighting” GameObject and select “Sun”
4. In the Inspector set the “Sun” Transform Rotation X,Y,Z values to 0
5. Rotate the “Sun” on the X axis until the value is around 25
6. Observe the terrain on the left
Expected result: The terrain appears bright
Actual result: The terrain appears dark
Reproducible with: 2023.3.0b6, 6000.0.56f1, 6000.2.2f1, 6000.3.0a6
Could not test with: 2023.3.0b5 (Compilation errors)
Reproducible on: macOS 15.6 (M1 Max), Windows 11 (by user)
Not reproducible on: no other environments tested
Note: The custom terrain on the left is expected to appear similar to the Unity Terrain on the right
Prioritise and Follow this issue
Have a workaround or additional info about this issue?