I’m doing some experiments with “Broomstick“, the new born (alpha) version of Away3D which leverages the brand new Stage3D (molehill) of flash player 11 (incubator).

Here’s the coded formula to obtain pixel perfect sprites by moving the camera in the Z axis just before rendering:

// camera is the current Camera3D object with a PerspectiveLens

// h has to be the height of your current viewport

var h:Number = /*current viewport*/stage3DProxy.viewPort.height;

var fovy:Number = (camera.lens as PerspectiveLens).fieldOfView*Math.PI/180;

camera.z = -(h/2) / Math.tan(fovy/2);

…just a snippet, hope you find it useful ðŸ˜‰

More on this topic:

– http://knol.google.com/k/perspective-transformation

– http://en.wikipedia.org/wiki/3D_projection

Advertisements