I have a camera that is looking at an object with render texture output and I use that render texture on raw image in UI.

Object itself has 2 parts:

  1. the ball
  2. kind of a semi transparent mask.

enter image description here

And this is an output: enter image description here

The star is there just for the reference. Problem is that part behind the second object is also transparent on render texture like it is see-through. I need that object transparent in relation to the ball (object one) but I don't want my texture to be see-through.

This is the result I expect:

enter image description here

  • 1
    \$\begingroup\$ What material/shader are you using to draw the mask? Is it potentially writing its alpha value into the render target? \$\endgroup\$
    – DMGregory
    Nov 28, 2022 at 13:36
  • \$\begingroup\$ URP/lit shader blend mode set to alpha. But the mesh already has transparent texture. \$\endgroup\$
    – Ivan
    Nov 28, 2022 at 13:44

2 Answers 2


I did manage to fix this kind of by changing my Material blend mode to additive and playing with emission color to get the mask part right. Here is my material:

enter image description here


The reason for this is line 89 (at the time of writing) in the package [email protected]/Shaders/Lit.shader:


This says to use the same blending rules for the Alpha channel as are used for the RGB channels. So if you render low-opacity white over purple and get a blend of white and purple, you're also rendering low-opacity alpha over opaque alpha and getting a blend of low and full opacity: somewhere in the medium opacity range.

For most purposes that doesn't matter, since you're just rendering to screen and don't care what alpha values end up there. But when composing a transparent image in a render target, you do care.

A quick fix is to move the URP package from the YourProject/Library/PackageCache/ folder to YourProject/Packages/ - this gives you an editable version you can modify without your changes getting reverted to the package defaults.

Then go edit line 89 to:

Blend[_SrcBlend][_DstBlend], One One

This gives a separate blending rule for the alpha channel, which is to strictly add up alpha values rather than blending them. So if you had an opaque background, it stays opaque when you layer transparency on top of it.

Strictly speaking, to pre-compose content in a transparent render target to stamp elsewhere, you'll want to be using pre-multiplied alpha blending (see "Super-Power #2" at that link), but that's a deeper rabbit hole than I'll go into for this answer.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .