top of page

ROAD SHADER

image.png
image.png

This road shader is a bit more complex than the other shaders, but it is still based on a simple fundamental blend and lerp. The textures we using are:

  • 2 Grayscale Grunge Mask

  • 2 Set of Textures

  • 1 Tar Line  ​Texture

  • 1 Skid Mask Texture

The texture set A is the road textures and the texture set B is another type of textures. Grass/moss texture is used for this demo.

Rest of the textures are used to create variation and visual breakups. Most of the blending layer occurs in BaseColor pass and Roughness pass. We kept Normal pass as simple as possible and made sure it is mostly using float parameters to create the variation.

The two grunge masks are used to create large shape variation. Artists can control  the mask min/max, adding/subtracting roughness, and Normal Flatness. The two color controls are using the mad() operation.

Painted road is a layer on top of texture set A. It is driven by vertex color red, and the controls are similar to the grunge mask set up.

This layer has a blend edge control and the artist can choose to make the edge darker or brighter. When the edge min is smaller than edge max, it will fade from inside to outside. It is revered when the edge min is greater than the max.

The texture set B is blended after the painted road layer. The control in here is very similar with the other layers. A new thing in this layer is using the AO of texture A or texture B to subtract the blend mask. It helps to create the moss that is stuck in the cracks.

Skid control is built on top of all of the previous controls. AO Darken is the only unique control for skid. Some type of skid will make the road occlude a bit more light. 

Tar line layer is driven by vertex alpha and it has two different usages. When UseForBaseColor is off, it will go through the normal map operation and affect normal. When  UseForBaseColor is on, it will skip all of the normal operation and directly affect BaseColor. It provides an option for artists to use this for branding and sign.

This is the artist's view when they are painting the painted road layer. The edge feels natural with different values in the mask.

image.png

Old

image.png

New

From the perf report, the new shader is 0.28 ms faster on average for GPU render timer.

CONCLUSION

The requirement for this shader is making it run faster and giving artists more options to create the visual variation. The constant communication with artists and addressing feedback is the key for this shader.

© 2025 - ZHENGYU YE

bottom of page