Render with transparent background while using a post process material?

Hello!

I am having some trouble rendering a png with transparent background when using a post process material on my post process volume. Whenever I add a post process material to my post process volume what was transparent in the image turns black.

I get why this happens, it’s after all rendering on top. But if I want it to stop that behavior how can I solve that?

Is that possible to do? My thinking is making a mask out of my background and my subject and plugging that into the opacity input, but I am stuck with how to do it. Can anyone provide any help? Maybe someone has done something similar or know how to make masks like this in post process materials?

Can you show how you’re trying to do the mask…?

I didn’t show it because I feel like I’m just fumbling in the dark on this one, but here’s one approach I tried.

I have a background element which I put a stencil value of 4 onto. Then I tried to make a mask where everything that is 4 or higher becomes white, and everything below it becomes black.

I’m guessing that doesn’t work because even though something of different values is obscuring the background the background with a value of 4 will just become white anyway?

This is probably completely the wrong way to go about this, and ideally it would be amazing if I could forgo having to use stencil values for the other meshes entirely as we are talking literally thousands of different meshes all in a data smith actor with tons of nulls, so bulk selecting and enabling stencil values is really time consuming and difficult.

1 Like

Sorry, I though you said you had a mask texture. You could use that to lerp between your effect and the normal texture :slight_smile:

Anyway, lerp is the way, rather than ‘if’.

No problem!

But I don’t really understand what you mean, do you mean a lerp between white and black with the custom stencil as a mask somehow? How would I do that?

Can you show a pic of what’s happening? Is the PNG floating in the air, or on a mesh or…?

It’s getting really late in my time zone and I’m not by my workstation anymore, but I can see if I can recreate something that shows the effect first thing in the morning for you! Unfortunately I can’t show the asset I’m working on so it would need to be something different.

I believe you have misunderstood my setup though. I am not using a PNG in the scene, instead I want to render out a png with transparency from the movie render queue.

So what I want is my main asset in the render, with a transparent background. This works, but as soon as I add a post process material to my post process volume what becomes transparent before in the rendered image is now black. Does that make it clearer? I apologize for any confusion!

As I said I think this is because the post processing acts as a layer that’s added on top of the rendered image and, while it doesn’t affect the image, it does remove any alpha layer from the underlying render.

1 Like

Ah… MRQ, sorry, very different.

So you want to choose what renders in a scene, and make the rest transparent? And - you already have a PP in the scene.

I would get familiar with custom stencil buffer

So you can pick and choose objects. Then you would need to combine your current PP mat with one which lerps between objects of interest and everything else, using custom stencil.

Then, hopefully you can render this out with alpha channel

I see a lot of posts on here about MRQ not being the same as the editor. This might be a bit of a fiddle… :rofl:

1 Like

Don’t I know it! I’ve been battling this problem for two and a half days! xD
It’s also a pain when you have to work within specific limitations of how the scene is set up.

But it feels like it should be possible to make this with a stencil buffer. I already know that I can use a simple texture mask to make parts of my final rendered image transparent again, even with the use of a ppm. So it’s just a question about how to make the mask out of what’s already on screen. A short term, more brute force solution, is to make masks for the different camera angles that I want, but that’s not very neat and absolutely not scalable xD

With the videos you provided I should be able to do a proper solution so thank you very much for the help! I also realize that I need to step away from the complexity of my scene and try this out on a much smaller scene if I am ever going to wrap my head around this! :stuck_out_tongue:

If you want I can update you if and when I manage to solve it?

1 Like

Yes! - keep me posted :rofl:

1 Like