Search Issue Tracker
Third Party Issue
Votes
22
Found in
2022.3.38f1
6000.0.11f1
7000.0.0a1
Issue ID
UUM-76514
Regression
No
Shadows.SRPBatcher has incorrect cull mode values when rendering shadow casters
Reproduction steps:
1. Open the “ReproProject“ project
2. Open the “Assets/Scenes/SampleScene“ scene
3. Observe the green plane in the Game View
Expected result: The green plane is not casting a shadow
Actual result: The green plane is casting a shadow
Reproducible with: 2022.3.38f1, 6000.0.11f1
Couldn’t test with: 2021.3.41f1 (due to compilation errors)
Reproducible on: Windows 11 Pro (22H2)
Not reproducible on: No other environment tested
Note:
The green plane has cull mode set to ‘Front’. The beige plane has cull mode set to ‘Back’. During the shadow caster pass both planes have cull mode set to ‘Back’. That causes the green plane to cast shadow. But it should be culled away during the shadow caster pass because the light source sees only the back face of the green plane.
Comments (5)
-
darrin5698
Aug 07, 2024 09:15
It looks like you're encountering an issue with shadows in Unity where the green plane is casting a shadow despite its cull mode settings. Here are some steps and suggestions to help you troubleshoot and resolve this issue:
Steps to Verify and Troubleshoot
Check Shadow Casting Settings:Select the green plane in the hierarchy.
In the Inspector window, verify that the Mesh Renderer component has Cast Shadows set to Off or On depending on your intended behavior. If it is set to On, try setting it to Off to see if that resolves the issue.
Verify Material Settings:Ensure that the material assigned to the green plane has the correct culling mode. In your shader or material settings, make sure the Cull mode is set correctly (e.g., Front for the green plane).
Double-check if the shader is correctly handling the culling mode during the shadow caster pass.
Shadow Casting in Shaders:If you're using custom shaders, ensure that the shadow caster pass is implemented correctly. Here’s an example snippet for handling culling in the shadow caster pass:
hlsl
Copy code
Pass {
Name "ShadowCaster"
Tags {"LightMode" = "ShadowCaster"}
Cull Back
// Other shadow caster settings
}
Make sure the shader does not override the cull mode during the shadow casting phase unexpectedly.
Test with Default Shader:Temporarily assign a default Unity shader (e.g., Standard Shader) to the green plane to see if the issue persists. This will help determine if the issue is with your custom shader or with the Unity settings.
Update Graphics Settings:Open Edit > Project Settings > Graphics.
Ensure that your rendering pipeline settings are correctly configured, and there are no overrides affecting the shadow casting.
Check Light Source Settings:Select the light source (e.g., Directional Light) in your scene.
In the Inspector window, verify the shadow settings and ensure they are configured correctly.
Test with Different Unity Versions:Since you mentioned that you couldn't test with 2021.3.41f1 due to compilation errors, try testing with other stable versions of Unity, if possible. This might help identify if the issue is specific to the Unity version you are using.
Additional Note
Given your explanation about the cull modes during the shadow caster pass, it might be worthwhile to examine how Unity handles the Cull settings internally during the shadow pass. If the green plane's front faces are being culled correctly during normal rendering but not during the shadow pass, it suggests a potential issue with how the shadow caster pass is being configured or overridden.If after following these steps the issue still persists, you might want to report this as a bug to Unity, including the steps to reproduce, your findings, and any relevant project files or minimal reproduction projects.
Bug Reporting
To report a bug to Unity:Open Unity and go to Help > Report a Bug.
Fill in the details, including the reproduction steps, expected and actual results, and attach the minimal project if necessary.
Submit the bug report.
By doing this, Unity's support team can investigate the issue further and provide a fix in future releases.
www-myloyola.com
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
- Errors are logged when importing an asset at a path with Firebase
- Entering too big of a number in 2D Renderer Lightmode Tags freezes the Editor
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
Resolution Note:
custom SRP should use a matching pipeline tag in all shaders