Home > programming > PaperVision3D one to one pixel representation

PaperVision3D one to one pixel representation

February 24th, 2009 admin Leave a comment Go to comments

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 Tags:
  1. February 24th, 2009 at 21:43 | #1

    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!

  2. admin
    February 25th, 2009 at 11:47 | #2

    Nice, thanks Dave! :)

  3. joris
    May 27th, 2009 at 15:51 | #3

    If you have a cube, set it’s Z to half it’s depth instead of 0…

  1. No trackbacks yet.