PaperVision3D one to one pixel representation
It was hard for me to find the correct camera settings in papervision to achieve a one to one pixel representation of my objects at z = 0, so here they are:
camera.focus = 10;
camera.zoom = 100;
Voilá! Now move your DisplayObject3D to x, y and z = 0 and you should see it at its actual pixel size.
Categories: programming
Good stuff…
This is great for when you want to move the camera perfectly in front of a certain object, but for pixel-precise placement of your objects in front of your camera you can use the following code:
3dobj.z = (camera.zoom * camera.focus) – Math.abs(camera.z);
The above code is recommended by the PaperVision-team since version 639 of the 2.0 branch. For earlier revision you need to extract 1 from the camera-zoom. i.e.
3dobj.z = ((camera.zoom – 1) * camera.focus) – Math.abs(camera.z);
Hoppa!
Nice, thanks Dave!
If you have a cube, set it’s Z to half it’s depth instead of 0…