[Closed] CustomStencil usage in PP material?
Hi there. I'm trying to create a post process material that creates an outline around certain objects. What i need is to have different colors depending on what a mesh is. I've read this in the forums:
Original post can be found here
I wold like to know how this masking is done in the material editor, as i've not been able to find documentation about this. Thanks!
asked Sep 06 '15 at 04:53 PM in Rendering
The question has been closed Jun 26 '19 at 03:51 PM by Bariudol for the following reason:
The question is answered, right answer was accepted
On a static mesh, you can set "Render Custom Depth" as well as a byte value for the "Custom Depth Stencil Value".
In the post process material, drop a scene texture sample and select "CustomStencil".
You can get a mask for each desired value using the material function "BitMask" by plugging the SceneTexture:CustomStencil to the BitMask input and a constant for each bit you wish you mask for.
You could perform a sobel type post process for each main color. The easiest example to copy is from the "Stylized rendering" example project.
You also need to go into the editor project settings under rendering ->post processing and set the "custom depth stencil pass" setting to Enabled with Stencil. You probably have to restart the editor for it to take effect.
You can use an if node to check if custom depth is greater or less than scene depth. If it is greater, plug a 0, if it is less than or equal plug in a 1 and then use that as your mask.
answered Oct 03 '15 at 03:55 PM
I found Its doesnt work in UE4.2,doesnet it?
answered Dec 15 '18 at 05:25 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here