Detail Bump Mapping with TriPlanar Shader (Unity3D)
I've been beating myself up recently trying to learn more about shaders. If you're interested in getting better too, be warned, they are pretty unintuitive, but once you're prepared for a few consoles worth of meaningless, soul-wrenching errors, you'll be fine.
I was recently inspired by this video by Wolfire Games, who are ridiculously smart and talented. Go watch all their videos. Every one. You'll thank me.
The concept is to have a texture that is applied on top of existing textures, but rather than being mapped to the object's UVs, it is static in world space. This is great for having objects that you can scale and rotate to build a scene, but their surface will still give the impression of a consistent material. The finished effect can be seen above.
It's a super useful effect. In this example with these rocks, the right set shows just its underlying material, which already has some nice normal maps to define its blocky structure. The left set then has the additional normal maps multiplied over the existing ones, giving much more detail and masking the distortion caused by scaling.
Here, these rocks are all the same model, but scaled at various amounts. Normally, this would look pretty obvious, as the UVs of the object would be stretched, and building a scene would be tricky. But by using a TriPlanar shader, the detail map bypasses the UVs and projects its textures smoothly from three separate angles. As you can see, their surfaces then show the same level of detail, as opposed to the picture below with only their initial normal maps.
This is one of those little things that will hopefully go a long way in my current game project. It's super easy to slap the shader onto every object in the scene that needs it, and that'll help to reduce the time we need to spend modeling different assets.
Feel free to contact me if you're interested in the project or the code! I'd be happy to share!
EDIT: I figure I'll post a package in case anyone stumbles across this and is curious. Material is already set up, simply add another material layer to an objects MeshRenderer and select "StoneDetail". Works in Forward and Deferred Lighting modes (i think). Click here to download!