- Home /
Render Texture causing sprite transparency errors
The game I am currently working on requires the GUI to be rendered within a safe frame of the screen. We're being constrained to using Unity 4.3 so are unable to make use of the new Unity GUI features, so instead we are using Render Textures to display the GUI and then scale the textures depending on percentage of safe frame required.
Any object/sprite/texture we want rendered as the GUI are assigned a specific "render texture" layer which is then used on one camera which renders its output to a texture. This camera is set to "Solid Colour" with the colour being (0, 0, 0, 0). The generated render texture is then assigned a material where the shader is set to "Transparent/Diffuse" and applied to a cube object. Finally, this cube is rendered on another specific "display render texture" layer and is used by a camera which is set to "Depth only".
But we're having issues where sprites which have transparency on them are burning holes through to what should be an opaque background behind them (see attached images). All the sprites use the "Sprites-Default" shader and their colours are (generally) (255, 255, 255, 255). Is there a different shader we should be using to prevent the sprite transparency from affecting the sprite behind it?
Answer by Douvantzis · May 16, 2016 at 01:47 PM
This appears as a blending problem on the alpha channel.
You need to adjust the blending mode applied to the alpha channel when you render your sprites on the renderTexture or when you render the renderTexture on screen.
You can read more about this problem in my question.
Your answer
Follow this Question
Related Questions
Unlit Speed tree Bilboard shader 0 Answers
Making a color transparent in shaders 1 Answer
3D Custom Render Texture 0 Answers
About shader! 0 Answers
Unity Fog Shader with Alpha Change 0 Answers