Away3D: Pixel Precision / Pixel Perfect display?

I’ve taken a look at Away3D again, because I had a problem in PV3D, which was so stupid I couldn’t believe that it could actually be a problem. However, as expected, Away3D isn’t exactly free of problems either: If you place 3D objects on a website it might be necessary to display them precisely 1:1, without distortion. That’s especially important if I want to place text or small bitmaps on the objects, as e.g seen on the temporary TCM splash page. In Papervision3D the setting is:

Object.z = Math.round((camera.zoom * camera.focus) -Math.abs(camera.z))
           + Object.depth/2; // take or add 0.5 if it's still blurred

In Away3D the major solution is to place the surface 900 pixels away from the camera, when using default camera. Why 900? I have no clue, but who cares, it won’t persist through changes of the camera anyway. Even worse, it’s not even giving proper results… I’ve spent quite a while testing it and there’s always artifacts and distortions:

I know the image isn’t friendly to the eyes, but it shows the problem quite clearly. The top right one is the original that I used as a material. Weirdly, the bottom left pixel corner is cut and one pixel line in the middle of the plane is duplicated horizontally and vertically as soon as you place it on an object (a cube, in this case). Adding segments or turning on precision doesn’t change anything. Adding / subtracting 0.5 from the coordinates shows parts of the cut corners, but the opposite sides get blurry. Adding smoothing to the material, as some suggested, isn’t a solution either. I suppose this isn’t a mere problem of not having tried enough, because there were others who had this problem before, with no solution. Maybe it only works for planes and not cubes? Well, at least up there’s the setting to get it almost correct.

I’ve quickly checked Hidden Heroes, which was made with Away3D, to see if those ingenious guys fromGGH have found a solution… but it seems that they’re also just switching between blurred and distorted 3D-Planes and normal 2D MovieClips.

Meh. I’ll keep looking.

3 Thoughts.

  1. I know it’s probably not what you want to hear and it certainly doesn’t address the problem, however, I use away3D/papervision for general animation in 3D, and if I need a pixel perfect image… I load an image.

    You can say, zoom in on a cube, and replace it at the last moment with an image. This also saves you rendering on what is ultimately a static image.

    I dont’ think it was coded with this in mind, but going by your domain name (and stereotypes) I kinda figure you might be into perfection ;)

  2. The 900 pixels only work on a plane or a 3d primitive object with a depth of 1.

    I’ve got a 3d cube (as a rectangle) at 200x400x50. You need to divide the depth by 2 and add it to the 900 pixels. So given the depth of my cube is 50px, then z should be set as 900 + 25 e.g.

    cube.z = 925;

    Or more usefully:

    cube.z = 900 + (cube.depth / 2)

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>