Search Issue Tracker
By Design
Votes
2
Found in
5.4.1f1
Issue ID
847371
Regression
No
World space Canvas rendered to a RenderTexture has improper alpha values
When rendering world space canvas to RenderTexture, alpha value of every pixel in rendered texture is affected by the canvas element which is rendered on the top of all other objects rendered by camera.
Reproduction steps:
1. Open attached project (case_847371-CanvasRednerTexture.zip )
2. Open "main" scene
Actual results:
The "RenderedTexture" game object has blue rectangle which is transparent in the middle.
Expected results:
The "RenderedTexture" game object should NOT have transparent part
See attached picture for Actual vs Expected results (blending.png)
In the scene there is "OffscreenRendering" game object which contains all RenderTexture setup. There is red transparent image in front of all other objects. Eventhough all the objects behind red image are not transparent, the rendered texture has transparency where the red image is rendered. (Visible both in Scene and Game views)
Note that alpha values on rendered texture are not exactly the same as of red image. When red image alpha is <0.5 and we decrease it, the rendered texture alpha is increasing.
Canvas rendered directly to Game/Scene view is rendered correctly. (WorldSpaceCanvas game object)
Tested and reproduced on: Unity 5.0.4f1, 5.3.3f1, 5.4.1f1, 5.4.2p3, 5.5.0b10, 5.6.0a1
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
- Only the left screen is rendering when using Render Graph Fullscreen Blit in Meta Quest 2
- Context menu with the "Revert" option doesn't appear when pressing the right mouse button on a "Vector2" or "Vector3" property in the Inspector of a custom shader
- Missing Render Feature "Full Screen Pass Render Feature" in any “Universal Renderer Data” asset when upgrading from 2022.3
- Inconsistent ParticleSystemVertexStream.PercentageAlongTrail data range in Trail Texture Modes except "Stretch"
- The Graph Debug Window can be right clicked through and the Node Workspace is manipulated instead
Resolution Note:
The Blend operation in the
UI-Defaults.shader is "traditional" SrcAlpha OneMinusSrcAlpha.
Sprite-Defaults.shader works because it uses premultiplied alpha blending One OneMinusSrcAlpha and then rgb *= a in the fragment shader function.