Search Issue Tracker
By Design
Votes
0
Found in
2020.3
2021.1
2021.1.19f1
2021.2
2022.1
Issue ID
1365395
Regression
Yes
Webgl Player renders transparent images when using Graphics.blit with a material
How to repro:
1. Open users' attached “SubmitBug.zip” project
2. Open “SampleScene” Scene
3. Switch Build Platform to WebGL and then “Build And Run”
Expected result: 3 squares appear on the screen
Actual result: Only 1 square appears other are invisible
Reproducible with: 2020.3.0f1, 2020.3.23f1, 2021.1.28f1, 2021.2.3f1, 2022.1.0a16
Not reproducible with: 2019.4.31f1
Notes:
- Not reproducible on Mac WebGL Player, all 3 squares show up
- The expected result can be seen in the Editor in Play Mode
Comments (1)
-
Smitzo
Jul 30, 2023 01:01
Why don't you add this information to the documentation here: https://docs.unity3d.com/ScriptReference/Graphics.Blit.html
That would have saved me 2 days digging into this.
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
- WebGL Player with WebGPU Graphics API fails to render Scene when custom Render Feature is used
- “EndLayoutGroup” error thrown when changing Shader Precision Model settings in Build Profiles window > Player Settings Overrides
- Button hover state uses default theme color when a custom .uss is applied
- Samples Showcase script warning does not clear after enabling required settings until GameObject is reselected
- VFX Particles receive shadow artifacts when using ShaderGraph with enabled shadows and Face Camera Plane Orient mode
Resolution Note:
Graphics.Blit draws a quad using the provided shader. Because the depth buffer of the render texture can contain arbitrary values (uninitialized in this case), shaders used for Graphics.Blit should disable depth testing by adding "ZTest Always" to the shader. This is true for any shader used as a post process effect.
In the given example, Unlit/Texture does not pass the ZTest. You can use the default Graphics.Blit shader by not including the Material in your call to Graphics.Blit(StartTexture, rt). Or use a custom shader which includes "ZTest Always".