http://blog.wolfire.com/2009/06/decals-editor-part-three/
June 18th, 2009 by David
Why are decals important?
The decal is one of my favorite 3D graphics tools. It serves so many purposes: covering seams, spicing up tiling textures, adding unique details, and allowing dynamic cosmetic environmental changes.
Adding a rock decal and a moss decal can make the surface more interesting and detailed, and the transition between the ground and the ‘land chunk’ is looks less abrupt and unrealistic.
How do decals work?
We’ve already discussed the user interface for adding decals in parts one and two, so now I will talk about how the shading works. We start by placing a couple decals using the decal editor.
As each decal is placed, it creates a small ‘base normal’ map (the ‘normal’ of a surface is a vector perpendicular to it) and blurs it slightly to remove any seams.
The decals use the alpha channel of their color map to control their transparency.
The base normal map is then combined with the decal normal map to get the final surface normals. This is used to make the lighting respond to the surface details of the decals, such as the roughness of the moss and the smooth roundness of the rocks.
This is easy to calculate because we are using world-space normals — we just have to calculate the dot product of the light vector and the normal vector in the fragment shader. We don’t have to worry at all about tangents and bitangents.
Finally, we modulate the decals by their color channels, and add ambient lighting. The decals blend into the scene very well because they are using the same lighting model as everything else.
In Lugaru I used decals for all sorts of effects, including footprints, wall cracks, blood puddles, and shadows.
Can you think of anything special we can use decals for in Overgrowth?
(be sure to click the link (http://blog.wolfire.com/2009/06/decals-editor-part-three/
), it makes more sence with the pictures)