Quickstart
Before starting, ensure the plugin is installed and enabled.
Add a New Outline
Create a new outline setting by adding a new one to the array.

It should look like the following.

We're going to work with the stencil values so we don't need to change our source, we do however need to set what stencil value we need. To do that, we go into our source settings and I'm going to set the first value to 5 for the sake of example.

The outline settings will default to a full screen distance field. For this example we're going to give it a few optimisations as we don't need it to run on the entire screen.
Set Up Optimisations
We've decided before we started that the effect we want isn't going to need more than 32 pixels. So lets optimise the distance field generation for this.
Go into the Distance Field Settings.
Set the Process Mask Size to 32px.
Set the Max Pixel Distance to 32px.
It should look like this.

We can add further optimisations but this will be fine for now. For more information, check out the optimisations page.
Example Material
For this quick start guide I'm just going to create an instance of an example material. The examples are stored in the plugin's content directory however there's a button in the settings that can open up the folder.

We should now see the content folder.

The example material is inside the Materials folder.

And we're going to use the M_SimpleOutlineBase as the parent for our Material Instance.

Fix Material (If Needed)
To fix the issue, all we need to do is update the Outline Output Material Expression node. These can be found on the far left of the material graph.

More specifically we're going to change the bottom ones. By selected each one and making sure they're set to the outline created earlier. Everything is matched by name so it's easy to tell which outline is which.

Set Up Material Instance
To create the material instance, all you need to do is right click on the M_SimpleOutlineBase material and click Create Material Instance at the top.

With the material instance created, lets move into the project content folder for easier access.
Final Set Up
The last step is pretty simple, we just need to make sure our meshes write to the custom depth/stencil buffer at the correct index and our post-process volume is set up correctly.
To set the depth/stencil value of an object, click on the object. Go to the render properties and scroll down to Rendering > Render, find the CustomDepth Pass value and enable it.

Then set the CustomDepth Stencil Value to be the same as the one we used in the outline settings, which was 5.

If you want to see if it's working, you can go to the asset folder, specified in the General settings and check the UTextureRenderTarget2D asset directly. The default location is in Content > DistanceFieldOutlineResources.

You may notice however that it doesn't look right just yet, that's because the resolution hasn't been updated since it was created. To do that just hit the Refresh Render Target Resolutions button in the main toolbar.



Lastly we just need to set the post-process volume. If you don't have one, add a new one. Otherwise scroll down to Rendering Features, expand Post Process Materials, click to add a new entry, choose the type to be an Asset Reference and then select the outline instance. You may also need to set the extent of the volume to Infinite. And you should have something like this.

Optional
If you notice any jittering, there are 2 things you can do. The first is to change when the outline gets rendered to the post-process pipeline. Go into the base material and with nothing selected go into the properties on the left and scroll down to Post Process Material. Change it from Scene Color Before Bloom to something earlier and save the changes.

Alternatively, if you go to the same location where you changed the render settings, there's an option for Custom Depth with TemporalAA Jitter and if it's checked, you can uncheck that.

Last updated