Shader Forge – Modular Environment Art

The inspiration for this personal project came from reading an article on trim texturing and being a Unity enthusiast, I decided to create something similar using Unity 5 and Shader Forge. Unity 5 is an easily accessible, intuitive game engine which is going from strength to strength.. but it still lacks the power and overall quality of what game engines like Unreal give. In particular, there is no material editor, only a few properties spat out by the limited range of Unity’s in-built shaders, which don’t allow for much customisation or optimisation.

Fortunately Unity has a great fan base and a wide variety of plugins available on the asset store, where nice people like Joachim Holmér make fantastic tools like Shader Forge for us artist’s to use. This opens up a load of opportunities in the world of shaders, and works very much like Unreal’s node based material editor.


The most important feature I decided upon was the ability to hold 3 different textures in one RGB texture, using the Red, Green, and Blue channel to individually hold a separate greyscale texture. This can then be multiplied over a custom colour of the users choice, giving not only less texture memory, but also fewer materials in the scene and a greater static batching draw call saving. As the modular design of the individual meshes would lead to lots of separate meshes, I needed a shared material wherever possible.

RGB Texture Split

By using vertex coloursshow_VertexColours
I could have 3 colour variations within a single material, for example the concrete material is shared throughout the scene above.. with lighter colours on the building supports and darker colours on the pavement edges.

Users can also simply check metal/non-metal and edit the roughness of an object.

I also wanted to implement world space grunge. When relying heavily on tiling textures, environments need grunge to break up the patterns the eye picks out, in this shader the grunge map works in the same way as a texture map except it is triplanar mapped in world space. There are three different greyscale grunge textures in the Red, Green, and Blue channels that give different looks, these are then multiplied with the other vertex colours and masked over the original texture.

As I considered grunge to be so important to blending tiling textures, there are several settings I made to fully control it. There is a second layer of grunge which can be scaled independently of the first layer, the levels of the texture map can be edited, and also the strength of each grunge layer.

RGB Texture MaskA technique I implemented to handle systems show_TextureMasklike roads was to use the channels in the texture to mask out the colours, rather than the mesh vertex colours determining the masking. The Red channel contains a tileable base texture (asphault) and the Green and Blue channel can contain masks for the road markings. This is useful for any situation where you don’t want to use lots of polygons breaking up geometry so it can have different vertex colours, ideal for the roads.

As the grunge is world-space I made an option to lock the texture in object space, to handle dynamic moving meshes such as vehicles and characters.

Thanks for reading! Here is a link to the Unity Package 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s