Hi,
I’ve been having issues with opacity and Render Textures in CC 2.4.11 which I don’t know how to solve.
No matter how I configure the cameras I cannot get it to work correctly, there is always something that doesn’t work. I’ve tried so many different combinations.
I have created a very easy to understand demo project showing how it behaves and it’s easy from this demo to swap things around, create new cameras etc.:
2-4-11-RT-Camera.zip (916.6 KB)
Please, if anyone has any ideas on how to get render textures to work correct with opacity please let me know, because I’m completely stuck .
Thank you so much for your time and help, it’s very much appreciated!
Why not open clearFlags Color? After opening, the transparency can be changed normally
Thanks for your response @zzf520.
Did you download the demo, in the demo I show with clearFlags: Color ON and OFF. Both have different issues.
You can see that with ON (example 1 in demo) → You have issues with opacity, it has more opacity than it should.
You can see that with OFF (example 2 in demo) → You have correct opacity but cannot fade something out completely.
Please check the demo, it should explain the situation pretty well and also work as a playground for testing.
Thanks!
So the real reason is that in your Default camera, it renders a background element with opaque blue color, this will affect blending results with every semi-transparent elements in Default group.
In example1 (Turned on color clear in User Interface camera):
The different color of sprite
is due to the blending, caused sprite
in User Interface is lighter because it’s blending with semi-transparent background of the render texture
In example2 (Turned off color clear in User Interface camera):
The wrong fading effect is because the Render Texture of User Interface camera is never cleared, so when the Sprite - Fade
become totally transparent, no pixel is written in that area, but the semi-transparent pixels from previous frame is still there, this caused the fading never go to real zero.
So in both case, the correct setup should be
- Turn on color clear in all RT camera (Default and User Interface) and onscreen camera.
- Remove
background
node in Default group, setup background in the Render group, either with a background node or with clear color