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
Comments (1)
-
SergeyLaz
Mar 02, 2020 20:16
fix this, please
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
- Selecting a Material for HDRP Decal Projector in the Inspector window spams errors in the Console
- Expanded Asset Preview Box moves/hides when creating new Asset in Project window
- Player crashes on Meta Quest with "/apex/com.android/runtime/lib64/bionic/libc.so" when using OpenXR Plugin in a specific project
- The Editor's Help menu still lists an old/retired website - "Unity Forum"
- Baked GI loaded by LoadScene call with Additive mode is not cleaned up when unloading the Scene
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.