Retroreflective Shading Model for UE4 & 5

Hello everyone! For a while now I’ve been working on a retroreflection shader model for Unreal Engine 4, and with the recent release of Unreal Engine 5, I decided to port it.

UPDATE - Example project

I have put together an example project that shows the material setup used for retroreflections.
It can be found here: GitHub - RDTG/UE5RetroreflectionContentExample: Content example project for Unreal Engine 5 retroreflection shaders

UPDATE - 0.4 Released
Pushed a version for Unreal Engine 5.0 Preview 2. The retroreflective shading model is now deprecated. Retroreflection capability has been merged into the ‘Default Lit’ shading model.
Only a patch version available for 5.0 Preview 2 unfortunately, no drop-in version yet.

I recently uploaded my work to github here: GitHub - RDTG/UnrealEngineRetroreflections: Retroreflection Shaders for Unreal Engine 4 and 5

There are two variations of this shader for 4.26 and 5.0.0, the first one is a drop in replacement of ShadingModels.ush that works on any binary/source build of the engine. This version comes with a caveat however, as it replaces the clear coat shading model, so if you use this, no more clear coat.

The second, and extremely WIP version is the custom shading model version, this one you can apply the git patch file to Unreal Engine 4.26 source or Unreal Engine 5.0.0 Early Access 1 source, it adds a new “Retro-reflective” shading model you can set in your materials.

The shading model version also adds 2 other shading models I used for testing purposes, these can be repurposed to whatever or ignored for the time being. Do note I probably won’t be updating the shading model version for very long as I’m trying to get this working in plugin form, but I will maintain the drop in shader replacement version.

The shader relies on the 2 custom inputs that you can use to mask your retroreflections or control their return color intensity.

If you are using the drop in version, the material output nodes Clear Coat & Clear Coat Roughness are used here. Clear Coat is used for the mask, and Clear Coat Roughness is the return color control.

If you are using the custom shading model version, the nodes are named Retroreflective Mask & Retroreflection Depth doing the same thing as noted above.

Please report and crashes or issues you have here and I will get to fixing them as soon as possible.

4 Likes

Thank you very much. I appreciate you and your amazing work.

For me as an artist this is probably the closest I can get to have realistic looking traffic signs for my client.
I would love to see this becoming an out-of-the-box part of the engine. There are so many cases for this?!

Please Epic!

Cheers

1 Like

awesome! looks very promissing! I.m trying the drop-in in 4.26.2, but the unreal editor gets stuck on 45% loading any ideas?

Sorry for the… very late reply, it just gets stuck? It might be compiling shaders. Replacing the shading models file will cause the engine to invalidate the DDC, recompiling all of the engines shaders which can take a very long time.

Thank you for the update for Preview 2, surprised this isn’t a stock shading model due to how common this type of material is with cars and traffic signs. :+1:

yeah… it was the old PC. Just got a fesh PC with 3070Ti. Works nicely, but I have to find the material output nodes …

Dropbox Capture

working on getting retroreflection working on scanned AxF materials. What are you plans on updating material to 5.0 ?

If its the drop in shader you are using, you use the clear coat outputs. (Clear Coat & Clear Coat Roughness) for the mask & intensity. :slight_smile:
Though, I highly recommend grabbing the git patch version and compiling from source for better support and implementation. I updated it to support Unreal Engine 5.0

1 Like

I ran the patch in UE5, but can’t figure out yet where I can find the settings. End result I want to achieve is to add retroflection to a AXF scanned material woth left to right (0, 1, 3, 5 10 and 20 % retro reflectivty )

Any tips or demo project you can share?

Not sure where to find those… Sorry… comming in from 3dsmax

If you used the git patch version on UE5, then simply set your material to default lit, you should see 2 material outputs for retroreflective mask & depth (intensity). You need to either plug a mask in or a constant (float value). 1 = full on, 0 = off. The depth output controls finer intensity and color return intensity. (Again, a constant or a proper mask).

Can you maybe share a screenshot? Then I can see what I am looking for.

btw. I saw on artstation marketplace you are selling the sign material. Sweet . I’ll purchase that as well. Great work!

I doublechecked after I just updated to 5.01. How can I check if previous patch worked?

Currently I got…

d:\Program Files\Epic Games\UE_5.0>git apply UE5P2_RetroreflectionSM.diff
error: patch failed: Engine/Source/Runtime/Engine/Public/MaterialExpressionIO.h:319
error: Engine/Source/Runtime/Engine/Public/MaterialExpressionIO.h: patch does not apply

If you are using material attributes, the “ClearCoat” pin = “Retroreflection Mask”, and the “ClearCoatRoughness” pin = “Retroreflection Return Intensity”.

You can plug a mask or a constant value into Retroreflection Mask/ClearCoat, and a mask or constant value into Retroreflection Return Intensity/ClearCoatRoughness.

I am currently setting up a basic content example project, once I’ve finished it I will toss it on GitHub and link it here.

Here is an example project: GitHub - RDTG/UE5RetroreflectionContentExample: Content example project for Unreal Engine 5 retroreflection shaders

1 Like

also to double check… I need to git apply the patch on th e\Epic Games\UE_5.0 folder ?

No, you need to get the source version of Unreal Engine 5.0 from Epics git and apply it to that, then compile it. It will not work on the one you download from the Epic launcher unfortunately.

nice. Makes sense. Thanks for the guidance (o:

yay … 4>Done building project “UE5.vcxproj”.
========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Works awesome! Currently hacking into the carpaint material to add retro reflection to the metallic flakes. Currently I have it the other way around… RR color with flakes blocking…

Did you ever tried this?

Nice! Yep, I’ve tried using it on all kinds of different material setups. It’s also extremely useful for the vehicles reflectors.