Search Issue Tracker
By Design
Votes
4
Found in
2021.3.40f1
2022.3.38f1
6000.0.11f1
6000.1.0a7
6000.2.0a1
Issue ID
UUM-75771
Regression
No
Shader error in 'Shader Graphs/Shadows': redefinition of '_ShadowMapTexture' occurs when building the project for the first time with a custom shadows Shader Graph using the Built-In Active Target
How to reproduce:
1. Open the “BIRPShadowsBuildError“ project
2. Open the “Sample Scene”
3. Build And Run the project
4. Observe the Console
Expected result: Build is successful
Actual result: Build fails and “Shader error in 'Shader Graphs/Shadows': redefinition of '_ShadowMapTexture' at Assets/Shadows.hlsl(5) (on d3d11)“ error is thrown
Reproducible in: 2021.3.40f1, 2022.3.38f1, 6000.0.11f1
Reproducible on: Windows 10, macOS 14.5 (user’s)
Not reproducible on: No other environments tested
Notes: After the first Build fails, Build and Run again - the subsequent attempt compiles successfully
Comments (1)
-
MetallCore999
Aug 12, 2024 09:47
Same problem in current version 6000.0.14f. I use Built-In rendering with custom lighting shader. It's sad that about half of all my particles shaders are used _ShadowMapTexture, and I can't build the project
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
- Shader Graph Node information is briefly displayed in Graph Inspector when clicking on Category in the Blackboard
- Module installation fails with "Download failed: Validation Failed" errors when using beta.2 Hub version
- JsonConvert conversion fails trying to call GetCallbackMethodsForType when [OnDeserialized] is used in a class
- Shader Graph Category dropdown cannot be expanded/collapsed when clicking on the text
- Different text alignment in the column header in Entities "System" window
Resolution Note:
The Custom Function feature targets users who are highly knowledgeable about Unity’s shader code. While the internal shader code is available for reference, there is no official guide for using it.
There are multiple declarations of _ShadowMapTexture in different areas, and which declaration is used depends on the defines that are set when the shader is compiled. You’ll need to verify which symbols are defined and use #if directives accordingly.
You can see which defines are passed by reviewing the console output shown during the build, or by clicking “Compile and show code.”
In particular, if SHADOWS_CUBE is defined, _ShadowMapTexture will be declared differently than if SHADOWS_SCREEN is defined. If SHADOWS_SCREEN is defined, then whether UNITY_NO_SCREENSPACE_SHADOWS is active or not will further change how _ShadowMapTexture is declared.
Resolution Note:
The Custom Function feature targets users who are highly knowledgeable about Unity’s shader code. While the internal shader code is available for reference, there is no official guide for using it.
There are multiple declarations of _ShadowMapTexture in different areas, and which declaration is used depends on the defines that are set when the shader is compiled. You’ll need to verify which symbols are defined and use #if directives accordingly.
You can see which defines are passed by reviewing the console output shown during the build, or by clicking “Compile and show code.”
In particular, if SHADOWS_CUBE is defined, _ShadowMapTexture will be declared differently than if SHADOWS_SCREEN is defined. If SHADOWS_SCREEN is defined, then whether UNITY_NO_SCREENSPACE_SHADOWS is active or not will further change how _ShadowMapTexture is declared.