Watch Dogs style Interior Mapping material

Hey guys, happy Ascension day!

Today I devoted my day to bringing the Interior Mapping technique to Unreal Engine 4! :slight_smile: 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:

30/5 UPDATE
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.

And, combined with a few very basic textures it looks like this:

2 Likes

I was literally about to start trying to work something like this out today, looks like you’ve already made great progress with it. Any ideas if/when we’ll be able to try it out?

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!

@Crow87 - There is a breakdown of how to create a shader just like this that is available on the old UDK website.
Here is the link with all images, files, etc, if you would like to build one.

http://udn.epicgames.com/Three/DevelopmentKitGemsInteriorMapping.html

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! :slight_smile:
Anyway, I haven’t found an easy way to share it yet, but my current material function graph looks like this:
3493b52d678127d4c6b2932d5d1eea417269adac.jpeg

That’s brilliant, thanks for the heads up dude.

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. :slight_smile:
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

Nice :slight_smile: I was totally looking for something like that.

Is this hard on the GPU? I mean is it worth the additional consumed resources?

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!

Awesome, the effect is really convincing in Watch_Dogs. Great way of adding cheap details.

Awesome, thanks for Stefander!

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.

I love all the little details that really make a game, similar to this. People barely notice them but they take so much work and really pay off

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.

how can i make this as only 1 room? Or how can offset the rooms walls and floors so that it lines up with my window geometry…

That works only if the transforms are 0,0,0… if u move the object what u did here destroys the effect…

@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.

Did you ever figure this one out ?

I would be interested as well to have it only with/for one room. Not every project has space for multiple appartments.
Thanks in advance.

nice i like it very much keep posting