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
-
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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
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".