The aim of this sample is to show how CySlice generated displacement and normal maps can be combined in a shader for use with the Maya software renderer. Shaders to use with the Maya Mental Ray renderer can be found here.
The scene file consists of the Killeroo SUBD surface, mapped with both displacement and normal maps, and a six frame animation that swaps the various shaders in and out.
![]() 1: 2k Normal Map Only |
![]() 2: 512 Displacement Map Only |
![]() 3: Simple Disp+Norm Combination |
|||||||
1: | The Killeroo SUBD surface, mapped with a 2k by 2k texture space normal map. Notice how the surface silhouette is smooth, particularly along the left eye ridge. This is because normal mapping, like bump mapping, doesn't change the surface geometry; only the normals are modified for lighting calculations. |
2: | Mapped with a 512 by 512 displacement map; the eye ridge is much more like the original 3D scan. This is because displacement mapping, unlike normal or bump mapping, changes the surface geometry. However, the surface texture is now a lot less detailed. |
To get more detailed texturing the tessellation levels of the SUBD surface would need to be increased, but this begins to impact significantly on rendering memory usage and times. Other renderers, such as Mental Ray, Renderman or AIR, do a much better job of this "micro-polygon" rendering. Maya tries to solve this dilemma by re-using the displacement file as a bump map in the shading network. | |
Unfortunately, bump mapping is an inaccurate way of representing surface texture as normals are only estimated from the grey levels in the displacements map. Normal maps are 100% accurate as they encode surface normals extracted directly from the original dense polymesh. | |
What we want to do is combine the texture accuracy of the normal map from frame 1: with the silhouette accuracy of the displacement map from frame 2:. | |
3: | Normal and displacement maps combined; notice how the surface texture has an exaggerated bumpiness. Getting technical, this is because the samplerInfo node in the shading network returns the post-displaced surface normals and tangents. To work properly, normal mapping requires the pre-displaced surface normals and tangents, something that Maya currently doesn't provide. |
![]() 4: Silhouette Calculation |
![]() 5: Silhouette Displacement Only |
![]() 6: Silhouette Disp+Norm |
|||||||
4: | Our solution is to multiply the displacement by a silhouette factor which is the inverted dot product of the surface normal and surface to camera/eye vector (i.e. the inverted facingRatio). Parts of the surface on or near a silhouette will be displaced close to 100% of what's in the displacement map while other areas will be displaced much less. |
5: | The displacement map multiplied by the silhouette factor. |
6: | The final result, combining the normal map texture with the displacement map silhouette. This hybrid displacement+normal map shader renders in significantly less time than a plain displacement shader would for the same final image, and is much more accurate than the default displacement+bump map shader. |
File | Description | md5sum.txt What's this? | |||||||
7,132,807 | 758039645d0c05116f475fd2df21b36d
| |
Note: To grab a binary file, first move the mouse pointer over the link, click the right mouse button, then select "Save Link As..." or "Save Target As...". |
![]() |