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
- InspectorElement and AnimationMode memory leak when selecting different GameObjects in the Hierarchy with the Inspector tab open
- Previous model to world matrix is not correctly set for ASW
- More calls are made to GC.Alloc in an HDRP Sample Template when compared to the 2022.3 stream
- Generating Light Probe lighting returns inconsistent results on a specific mesh
- Two Warnings appear for every Soft Delete Operation when Deleting Sub Assets in the Project Browser
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".