Daniel Falci
Sign in Buy the course

How to highlight objects when the player approaches in Unreal Engine 4/5

The highlight uses a Post Process Volume with an outline material and the Render Custom Depth Pass option of each object. In the object's Blueprint a Box Collision fires Begin Overlap, which calls Set Render CustomDepth to true, and End Overlap, which sets it back to false. A Boolean variable Highlight records whether it is active.

See the course Watch a free lesson

From the course

Taken from the hands-on project of the course; the lessons show every step on video.

How do I set up the Post Process?

What does Render Custom Depth Pass do?

On a cube, search Depth in the Details panel and enable Render Custom Depth Pass under Rendering. The outline appears, but it is on all the time. With the view mode Buffer Visualization Custom Depth you see the silhouette stored in a buffer for that object only; the post process material uses it to draw the outline. Turn the option off to continue.

How do I make it appear on approach?

Why a Boolean named Highlight?

After Set Render CustomDepth, create a Boolean variable Highlight and set it to true at the begin and to false at the end. It is not used yet, but it will be useful in the next exercises to know if the highlight is active.

How do I change the outline color?

Open the highlight material, find the color vector and double-click it to pick another color, such as blue. Save and test.

Free PDFs that go with this page

One-page guides made from the lessons, sent by e-mail.

Frequently asked questions

Why is my highlight always on?

Because Render Custom Depth Pass is enabled in the Details panel. Control it from the Blueprint instead.

Which events turn the highlight on and off?

Begin Overlap and End Overlap of the Box Collision.

What does the Post Process Volume do?

It applies the outline material to the whole scene when set to Infinite Extent.

Related guides

See the course