Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2018.3.0a1
2018.3.1f1
2019.1.0a1
2019.2.0a1
Issue ID
1117801
Regression
No
Shader that uses "AutoLight.cginc" draws shadow on fully illuminated GameObjects when using No Shadow Cascades option
How to reproduce:
1. Open the minirepro project attached by QA in comment
2. Open the scene "ShadowBug"
3. Make sure that Project settings > Quality > Shadow Cascades are set to "No Cascades"
4. Double click on the "Main Camera" GameObject
5. Try to zoom in and out to the Plane direction in the Scene View
Expected Behavior: No shadows on the Plane appear, because the light illuminates it fully
Actual Behavior: The shadow appears and moves along with the Camera
Reproducible with: 2017.4.18f1, 2018.3.2f1, 2019.1.0a14, 2019.2.0a1
Note: The issue is reproduced only at a specific distance from the object. Setting Shadow Cascades to two or four eliminates the shadow.
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
- Assigned font's bold/font-weight styles render using Default Font's assets when Default Font has corresponding style assets defined in TMP Settings
- "Modifying the parent of a VisualElement while it’s already being modified is not allowed" error is thrown when entering text and pressing tab in the Search window
- Mesh colliders are not updating their positions of bounds correctly
- Images are missing from the "Open the sprite editor" documentation for 6.0, 6.1 and 6.2
- The previous element in the array is modified when assigning an Asset to a new element of AssetReferenceT
Resolution Note:
User's shader needs to take Shadow Distance value into account so that the shadow will not render when the pixel is outside of Shadow Distance (distance from camera). To do this, do these in fragment shader instead of just doing SHADOW_ATTENUATION:
float zDist = dot(_WorldSpaceCameraPos - i.worldPos, UNITY_MATRIX_V[2].xyz);
float fadeDist = UnityComputeShadowFadeDistance(i.worldPos, zDist);
half shadowFade = UnityComputeShadowFade(fadeDist);
float shadow = saturate (lerp (SHADOW_ATTENUATION(i), 1.0, shadowFade ) );
You can also find the code in AutoLight.cginc.