Search Issue Tracker
By Design
Votes
2
Found in
2021.3.44f1
2022.3.48f1
6000.0.21f1
6000.1.0a7
6000.2.0a1
Issue ID
UUM-82660
Regression
No
Surface Shader lighting displayed incorrectly when Point Light is intersecting a Particle System inside Camera Frustum
How to reproduce:
1. Open the attached "IN-84355" project
2. Open the "Default" Scene and enter Play mode
3. Observe the grass lighting on the “Terrain” GameObject in Game view
Expected result: Grass prefabs have consistent shading regardless of the position of the camera and the particle system in the project
Actual result: Grass prefabs have their surface shader lighting computed incorrectly when a point light is visible and intersecting with a particle system inside the Camera Frustum
Reproducible in: 2021.3.44f1, 2022.3.48f1, 6000.0.21f1
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Notes:
- Behavior only occurs when using deferred rendering and per-pixel lighting with a point light or spot light
- When the point light is moved so that it does not intersect with the particle system, the grass elements render as expected
- When downgrading the Project to 2021.3.x the grass Prefabs might need to be placed in the Project manually, but the issue still reproduces.
- Reproducible using Direct3D 11/12, Vulkan and OpenGL Graphics APIs
- In Unity Editor versions 6000.0.x, issue only reproduces when using Direct3D11 and OpenGLES3
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
The issue appears to be related to how the grass shader reacts to the main light.
The point light in the scene has a high intensity (25), but a low range (10). While anything affected by the point light is visible to the camera, it becomes the main light as it is the brightest light in the scene (the directional light has an intensity of 1.5).
The grass shader picks up the `_LightColor0` color from the main light, but at no point calculates the attenuation due to distance. This results in the shader reacting to the point light when it should be too far away to be affected by it.
As the camera dips down, and the last bit of particle affected by the point light slips out of view, the main light changes, because the point light can no longer affect anything on screen, so the dimmer directional light is used as the main light, which is what results in the sudden change.
This is an issue with the shader used on the grass - Unity is behaving as expected.
The suggested solution would be to take the attenuation of the main light in to account, and perhaps also combine it with the light from first of the 'non-important' lights so that no change between the point light going on and off screen is visible.