Hi,
I need some help figuring out Render Target Masking options!
Here is my scenario:
- I have Object A & B in Player view
- I want to show Object B in my HUD via Render Target with ALL of its post processing and lighting applied. (I don’t mind using Custom render depth passes and stencils, if needed)
- I want to mask out everything else except for Object B in the HUD
Is this possible? If so, what is the material setup and Render Target options to make this happen?
Any help is appreciated!
Thanks!
I have found a few alternate ways of dealing with this for someone coming across this in future.
Method #1 - If you are going to be using these Render Targets for objects like particles then projecting them on screen space (for UI or other reasons), here is the setup:
- Make your Render Textures, and Materials.
- Make a Blueprint object of your particle(s) with a Scene Capture Component
- Set the Render Mode to > Final Color
- Disable “Atmosphere” (and whatever other irrelevant flags) under “General Show Flags”
- I specified my particle component as “Show Only Component” via the Scene Render Target Blueprint node in Begin Play
- This should all provide you with your particles/objects with a solid black background.
- Then I marked my Material to be “Additive” which removed the black background! (See the Material setup Image below)
Reference Scene Capture Component Settings:
Reference Material:
Alternate way to remove black background with “Desaturation” node:
I did find this alternate method to remove the black background, but I wasn’t a big fan of it since it does change the colors and is less flexible!
Method #2 - If you want post processing, and other world effects to impact the object, then here is a proposed, but relatively expensive setup:
- Make two RTs, one for scene Color/Alpha and another one for your final scene output
- Make your UI Material
3.Make a Blueprint with TWO Scene Capture Component setup. (I again added my SK/SMs to be the “Show Only Components” inside the Begin Play function)
- Setup the first Scene Capture with “Final Color”
- Setup the second Scene Capture with “Scene Color and inverse Opacity in A”
- Then Setup your material as follows:
This will provide you with a proper mask that can be used in UI materials (or other places) incase you can’t use Custom stencil and whatnot.
Note that you can also just do “Scene Color and Inverse Opacity A” only on on Render target if that look is sufficient for you!
In my cases I needed a bit more control over the look.
There might be more ways, would love to know if there are different approaches others have come across!
1 Like