Alpha in custom render pass

Unreal Engine 5.4, Alpha channel is enabled in project setting as below

So alpha channel is included in final output, I can get the rendered result with alpha channel from back buffer.

I am trying to remove(cut) pixels basing on stencil buffer. For those pixels they should be rendered as transparent on the RenderTarget.

First I tried PostProcessingMaterial, it does not work because it just does not support. This is also clarified in its document.

So I am trying to implement custom render pass. Full code example is here

I tried to change the above shader code to return specific alpha value. I do see color change when it swap x and z. but the alpha component does not take effect no matter I supply 0 or 1

 float4 OutputColor = float4(OriginalColor.z, OriginalColor.y, OriginalColor.x,  0.0 /* 1.0*/ );

From the source code, the output alpha channel is copied into SceneColor.

I don’t quite understand. There are transparent pixels. But why I cannot change the alpha in SceneColor.
The alphas are stored seperated than SceneColor ? cant believe that.

Can anyone provide some hint?

You can use the Movie Render Graph for this.

Can MRG be used in real time render? it seems that feature is only used for rendering a sequence or shot in advance

SceneColor is the base colour for the rendered scene, I can’t see why it would have an alpha channel.

For your effect though, it sounds like you want an individual object to turn transparent so you could see what’s behind it. That wouldn’t be a post-process effect but a material effect on the object itself.

Post-process would be used with the stencil here if you wanted to change the colour using the stencil, blur it or completely replace that section with some other colour. In this case if you wanted to replace it with a different colour you would just literally just change the scene colour if the stencil value is the one you want.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.