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
- Crash on UnityEngine.UI.RawImage:OnPopulateMesh when playing Raw Image Texture animation with Sprite keyframes
- 32bit floating point RenderTexture blending feature is not available for WebGPU
- "CommandBuffer: temporary render texture not found while executing" warning is shown when Compatibility Mode is enabled and Camera stacking is used
- NotImplementedException is thrown when using System.String.Replace(String, String, Boolean, CultureInfo)
- “Label” name in Sprite Library Editor window lacks character limit causing long names go under the Object Field
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".