portfolio
Normal Map Shader
I created this in 2008 to test a normal mapping idea I had while writing and editing the Normal Map wiki page.

download (3MB): download Windows Media format download QuickTime format

The tree leaves use a real-time shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light, while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves.

Tree Light-Scattering Maps

The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves.

Tree Light-Scattering Test

This effect could be useful for a single "star" asset, but it probably wouldn't work for a whole forest due to the computational cost of self-shadowing and lighting double normal maps. However you could use LODs to switch to simplified shaders in the distance; then it could work quite well.

I also created some lower-cost foliage shading setups, you can click here to see those.

Tree Shading Examples