top of page
Search
Writer's pictureARCANE_ARTS

UE5 Pass Through Post Process Shader

Results:

Tutorial:

First of you want to create a new material. Once you have created the new material, change the Material Domain to Post Process. This will allow us to assign our newly created material to our Post Process Volume later on. Note: You can change the Shading Model to Unlit mode, most of the material nodes will be greyed out already, this is just a personal preference, as we will just be using the Emission Channel.

Next you want to add two SceneTexture nodes:

  1. Set the first node to CustomDepth

  2. Set the second node to PostProcessInput0

This will allow the material access to the Custom Depth pass that is rendered from your character to the camera. Next connect the Color outputs into a ComponentMask node, this will allow us to select specific color channels we want use. For the CustomDepth select the Red channel in the details panel. For the PostProcessInput0 make sure you have all the channels enabled, Red, Green and Blue. Otherwise it will cause an error once we assign a color parameter.


Go ahead and create a Color parameter node. You can do this by holding down 3 and left clicking in the graph. This will add a standard RGB Color node, to convert this to a parameter simply right click the node and select Convent to Parameter.


Once complete connect the nodes to a If node. CustomDepth into slot A; a single float value of 1000000 to slot B; PostProcessInput0 to slot A>B and finally your Color Parameter into slot A<B.

Once you have completed the above steps and assigned your material to the Post Process Volume, you will notice that your character color will change to the Color Parameter value, whether or not it is behind an object. In order to work out when your character is behind an object we will have to create another If node.


You want to create three new SceneTexture nodes:

  1. One set to SceneDepth that will calculate the depth of the camera to the rendered object.

  2. The Second one set to CustomDepth that will measure the distance from the camera to your character.

  3. A PostProcessInput0 to allow access to the calculated data.

Each one of these nodes we want to connect to a ComponentMask, they should all be set to access the Red channel once more, except for the PostProcessInput0, this should access all three color channels, Red, Green and Blue, otherwise your character will only render the Red channel of its material.


Next connect these nodes to another If node;

SceneDepth into slot A, CustomDepth into slot B, PostProcessInput0 into slot A>B and then finally for slot A<B connect the previous If node. Once done you can connect the If node into your Emission Color and save the material.

This is what your final Material Graph should look like:

All that is left now is to enable Render Custom Depth Pass on you character mesh in the details panel, and to assign an Instanced Version of your material to the Post Process Volume, under the Post Process Material section.


Good Luck and keep Developing!


07/07/2022

Arcane Arts

17 views0 comments

Comentários


Post: Blog2_Post
bottom of page