Alpha after projection - How do i get it to not shine through geometry?

Hey, Guys!
I am new here, so idk if this is a stupid question.

Ok, so basically i painted something over a render and projected it back on.
I now want to export the projected parts as its own pass.
It should look like the image on the left but with transparency instead of black:

If i add the alpha in the shader, it looks like the image on the right.

Now, this might not be that easy to see, but basically, there are parts that would normally be behind geometry and therefore invisible. These are still visible though.
(you can see them the easiest to the left and to the top right of the frame)
I have enabled backface culling and disabled “show backface” in the shader. Still not what i need.

I am nearly out of ideas. Deleting the geometry that is not needed also only deals with half the problem. The camera move is set up in such a way, that some projected parts will be behind geometry after a while.

Any help would be greatly appreceated!
I really am out of ideas rn…

Welcome :tada:…

…hmm IDK if i get this…

…how do you paint “behind” objects ? …or you texture painted in 3D ?? (…and why there is a alpha ??)

You might try something in the shader editor: Input → Light Path → Is Camera Ray to “switch off” texture which is showing not in the camera direction… (this might not completely solve your problem… but i didn’t understood it anyway :sweat_smile: )

Hey, Thanks for the reply!

I will try that.
I have found the Light path node.
How would i go about subtracting this from the shader though? :open_mouth:

EDIT: i tried this, it didnt work.

Some further explanation:

I painted something in 2d and used projection mapping to get it onto the surface. Now, after some camera moves, parts of the projection are behind on parts of the geometry that should be concealed / masked by the geometry itself.
If i enable the alpha of the texture i painted in the shade however, the parts behind geometry obviously shine through.
I need these painted parts seperately in order to keep some reflections etc. in the original render working properly.

I hope this is more understandable now.

Am I understanding it correctly that you are disabling all 3d geometry from the render to get the image on the right. But because of that, you are seeing what is behind the 3d geometry?

If that is the case, it might be possible to use depth maps to remove everything behind the 3d objects.

Sort of.
I basically want to have transparent geometry, but an alpha channel for everything that is not “colored”.

Its kind of hard to explain.
Buti will look into depth maps, thanks!

The idea is to render a depth map with the 3d objects, but also another one without the 3d objects (don’t know if that works if they are transparent or if they need to be disabled).
Now you might use the Blender compositor where you can compare the depths of your painting with the 3d geometry for each pixel. If the 3d geometry is closer to the camera, the pixel needs to be transparent, otherwise, use the pixel you painted.

1 Like

I figured it out. I just had to use a holdout and mix the shader with the painted texture, plugging the alpha in the FAC.

Thank you guys for the help though!