Above is Azusa in Pv3d. She is made up of a very thin cube with her front render on the front face of the cube, and her back render on the back face of the cube.
Since I first had each plane made of two triangles, when I rotated the plane in Flash, the texture would distort and get bunched up. I could see the texture warping as I rotated her.
It turns out that this was because Papervision3D uses affine texture mapping. This means it distorts materials in 2D to add a perspective illusion. When there are only two triangles, it’s very easy to spot the skewing. So the solution was to subdivide the plane so it has more triangles.
I still didn’t like the bottom cube getting distorted. When I traced the camera properties, the zoom = 40, focus = 8.66, and fov = 60.
I wanted a less deep, more compressed view. So I set the values to zoom = 60, focus = 55 to make it look better. (The lower the focus, the more distorted and deep the view.)
As a side note, Flash supports GIF, JPG and PNG. The maximum texture size capable for Flash Player 9 is 2880x2880px. So use 2048x2048px max so that “mip” mapping (which smoothes the texture when zoomed) is supported.
Now, I hate it how Papervision3D has issues with deciding which triangle to render in front of another. In this case, the base cube somtimes gets rendered in front of the geisha’s pedestal, and other times the pedestral renders in front of the geisha plane.
The quick fix is to import org.papervision3d.render.QuadrantRenderEngine and add renderer = new QuadrantRenderEngine(); to the init() method.
The problem is that its performance is horrible. But the whole scene doesn’t need to be rendered with the quadrant renderer. The problem is just on the pedestal.
By setting testQuad property of the other meshes to false, Pv3D uses the default basic renderer. So the following code was added in the load complete hander.
_model.getChildByName(“base”,true).testQuad = false;
_model.getChildByName(“azusa”,true).testQuad = false;
Now z-sorting was going well without affecting performance much.