Today I devoted my day to bringing the Interior Mapping technique to Unreal Engine 4! For those that are not in the know, Interior Mapping is a technique to simulate virtual geometry with only a pixel shader. It’s been most recently used in Watch Dogs:
I’ve migrated the material function + sample textures and materials over into a new project, which you can download here: InteriorMapping.rar
I’ve tried my absolute best to make it as lightweight as possible, but if you have any comments/additions/suggestions, you’re more than welcome! Enjoy!
One quick note: Due to the Unreal distance units, the tiling and room frequency parameter settings usually have very low values (0.015 is the default). I originally multiplied the parameters by a very small number, but because these floating point operations add more complexity to the shader, I’ve decided to leave them out altogether.
Actually, I wasn’t really planning to release it because the graph is kind of a mess (the technique is quite complicated, as you might have found out), so the wires go pretty much everywhere… But if you happen to know if there’s an easy way to share a material function, let me know and I’ll upload it!
I wasn’t aware this technique was done in Unreal before, cheers JBaldwin!
I’ve seen the technique before (Joost van Dongen is a personal friend of mine), but I’ve kept some of the features out of my version on purpose, because a full-fledged version would increase the overhead dramatically. I’ve experimented with quite a lot of input and output features, such as normal output and normal map inputs, but they add way too many instructions for my taste. Plus, now it all fits into one single material function, which you can use to enhance your existing materials!
Anyway, I haven’t found an easy way to share it yet, but my current material function graph looks like this:
I’ve taken the time to clean up the graphs and migrated the content over into a blank project so I can share it with all of you. It’s about as clean as I’ll be able to make it without breaking stuff.
I’ve kept the pass as clean as possible to minimize the overhead, all you have to do is use MF_InteriorMappingSimple (which is exposed) and plug in some textures and values! The download link is right here (unzip it into your Unreal Projects folder): InteriorMapping.rar
It shouldn’t be! I’ve done my best to keep the function as lightweight as possible. Normally, if you use the material function and turn on Shader Complexity, it should still be totally invisible!
If you have any troubles through, try assigning the same texture to multiple inputs (doing this will decrease the amount of samplers required by your shader, quite handy on mobile). Cheers for the reply, appreciate it!
Sorry to resurrect an old thread, I just discovered this and was playing around with it. It’s fantastic, but I was wondering if there’s a way to account for object/building rotation in the shader (at least Z-axis rotation)? I tried picking it apart but realized that the math at play is a bit beyond me.
Did some poking around and figured out how to get rotations working. It’s actually a simple matter of adding World>Local transforms to the World, Object, and Camera position vectors. I’ve attached a screenshot in case someone stumbles on this thread in the future and wants to do the same thing.
@Stefander Great work! Is there a way to control the windows in a way that we can map them to building modules with pre existing geometry? Seems like it has some World Aligned Texture stuff that make it difficult to adjust UVs to match.