Xbox LIVE Indie Games

code sample details

Normal Mapping

Code Sample


This sample builds on the concepts illustrated in the Custom Model Effect sample, and it applies a normal mapping effect to a mesh. The sample also uses a custom content processor to demonstrate two additional concepts: adding and removing per-vertex data from a mesh, and reading opaque data.

Sample Overview

The sample demonstrates how to use a custom effect to render a model with a normal map, creating the appearance of a bumpy surface without needing to render additional geometry.

A custom content pipeline processor applies the normal mapping effect to the model during the content build process. The processor also creates additional per-vertex data channels for the binormal and tangent information, which the normal mapping effect uses. To ensure that the run-time vertex declaration matches the inputs to the vertex shader, the processor removes all vertex channels that the shader doesn't use. Finally, the processor uses opaque data to determine which normal map to use, and then applies it to the material.

To make rendering more efficient at runtime, a second custom processor changes the normal map pixel format from an encoded unsigned format to a signed format.

All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).



GS 4.0


GS 3.1

find education content
var gDomain=''; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/