It seems as though I’m trying to work out the odds of all the dice throws. I’ve been going through all the variations in making a normal map to suit my dice in the away3d scene. I’ve eventually succeeded in getting a version that works out of 3dsMax. Harder than I thought it would be, but maybe I should have thought through the maths rather than just guess at the right checkboxes.
This is my resulting test, with a correct version of the dice and the old version for comparison. It shows the effect of getting it slightly out. The die on the right has the wrong shading at certain angles. Use the arrow keys to rotate them.
[Edit: Feb 2011 – link not working here, I’ll have a look at it]
The problem with my attempt at getting a normal map for the dice was that I asumed that I just needed to create the object space version of the map. Sounded simple, but then I found that the render in away3d didn’t quite work with any of the variations. The effect was that a face of the cube, when rotated around its perpendicular, would change the lighting that it had. It should stay constant. Because of the normal map being wrong, the rendering system thinks that the face is pointing in a different direction and so should change lighting as the object rotates around. I needed to investigate further.
Being a dice, the easiest way was to use Photoshop to cut and paste the different sides until we got the correct result. Then all (?) I had to do was to get the same rendering out of 3dsMax. It took a route through all the variations of LocalXYZ which should give an object space normals map. None of those variations fitted. World space is just the same, because my object is sat around the origin; X, Y and Z axes are the same for both. So I then tried Screen modes. After several combinations I discovered that turning the front view around by 180 degress gave the result that I was looking for. I finally had a normals map that worked with away3d. The following pics show the colours required by faces whose normals point along the 3 axes. Faces at other angles would be on a graduaton between them. The first image is the LocalXYZ normal map that I first tried; the second image is the correct version.
So a few points to note,
If it’s of any use to anyone, the last picture is an image of the cube within 3dsMax as I created the normals map. It’s front facing but rotated around 180 degrees. Is that because of the Z-up in Max, compared to the Y-up in away3d or Papervision. I don’t want to take the time to think about the maths too much at this time of night.
[Edit – If you’re into normal maps in away3d, do look at Fabrice’s blog. He’s the one doing the clever stuff underneath.]