This post shows a simple script & shader that I wrote to workaround an issue and better visualize the results an artist would see with their asset further down the pipeline in game.  This was by no means an ideal solution and was only a bandaid.

You need to install or upgrade Flash Player to view this content, install or upgrade by clicking here.

NOTE: The intended audience of the video was a group of outsourced artists.

The issue:

Our game materials are authored in a proprietary editor that generates multiple shaders for different targets, such as different hardware consoles or optimizations.  One such target is a DX9 shader that is viewable in 3ds Max.  Unfortunately, Max handles normal maps inversely from how our game renderer handles it and the tool did not account for this in the hlsl that it generated.  This meant that it was difficult for the artist to identify and correct normal map seams early in the process (prior to exporting and viewing in game, which many outsourcers did not have the ability to do).

This was a known, long standing problem and existed on the work backlog for one of our employees to address.  Unfortunately it was lower priority than other work yet was still deemed to be something that would get resolved properly and ‘soon’ by the individual. Rather than step on his toes and avoid jumping into, admittedly unfamiliar, c++ territory for the proprietary editor I implemented a quick solution…

The solution:

  • I authored a simple dx9 shader that would properly display our game’s normal map format in the 3ds Max viewport.  This shader was very stripped down to the basics…diffuse map, normal map, and ambient color.
  • I authored a simple maxscript gui to …
    • control toggling between the game shader and this simple diagnostic shader (non destructively using scene states)
    • toggle map and parameters on\off quickly