Hello everyone! I’ve been working on a project in my spare time, and recently an asset came up that would require proper retroreflectivity to look good/realistic. Unfortunately, Unreal Engine 4 doesn’t really support this by default. There are some hacky methods to fake it in a material, but it doesn’t look good, and if you wish to add it as a shader, you need to modify engine source code & the engines shader files to add it in as a custom shader model. This is how I originally went about the task.
I found a shader written for 4.20 by William Schilthuis, but he never finished it, so it simply adds a second specular term to fake a retroreflective shine. At a distance his shader looked really good, but fell apart as soon as the camera drew in close as you would see 2 separate specular shines, one of which would circle the other depending on camera angle.
So I set out to write my own! I ended up writing as close to a physically accurate retroreflective shader as I could. It’s capable of being masked out, so part of your material can have normal specular reflectivity, while another part could have retroreflectivity. Anisotropy support took a few tries to get right so that if the material was anisotropic, it wouldn’t interfere with the added reflectivity and vice versa causing a very weird conflicting glow, which was a problem I ran into early on. It’s gone through a few iterations now, and I’ve managed to get it to be pretty energy efficient, though it still needs a little work and I need to fix a reflection artifact on rect lights.
Once it’s complete, I wanted to share it with the community. But sharing it as-is will only reach so many people, as it would require them to compile the engine from source. So I began doing some research on adding shader models via plugins, and unfortunately, Epic never saw fit to allow us to do this. That being said, I’m still working on alternate methods to integrate the shader into the material workflow via a plugin and I am posting here to gauge interest.
Here is a video showing it off as is -
I will of course eventually put it up on GitHub on a branch of the engine, but if enough people show interest, I’ll continue the plugin endeavor as well, to reach as many users as possible.
Would you be interested in a retroreflectivity shader in the form of a plugin?