- Home /
Render UI to RenderToTexture with alpha
The scenario is:
I want to render retro style 2D pixel art graphics
- I have 3 cameras
gameCamera - renders to a RenderToTexture (will apply postprocessing effects)
menuCamera - renders to another RenderToTexture (no post processing effects)
finalCamera - renders two rawImages (with the results from each other camera)
The RenderToTexture have rather low resolution to achive a pixel perfect retro effect.
Now the problem is that when rendering the raw images to the final camera nothing is rendered because the alpha channels in the RTTs are all blank. I can fix this by setting the color of the RTTs to use alpha=1.0, but then the menu RTT will hide the game RTT as it gets totally opaque. What I want is the RTTs to have alpha 1 where something is rendered. I can solve this for the game graphics using my custom materials. But not for UI stuff such as text etc in the menu.
Any suggestions?
I actually solved this.
Ins$$anonymous$$d of raw images I manually blit the RTs to the final camera in OnPostRender with a custom unlit shader that applies correct blending.