views:

106

answers:

1

I have a papervision3d sphere primitive that I am adding to a scene. The sphere is being sized with a radius of 285. However, because of my camera properties (zoom, focus and z) the sphere is rendering at 206px instead of 570px which is what I want (2 * radius).

A while back I found a blog post concerning this very issue and it was explained that you can set the z of any object in the scene to appear in 3D space the same size it would appear in 2D space by using the following:

mySphere.z = (this.camera.zoom * this.camera.focus) - Math.abs(this.camera.z) + radius;

The above worked when I was using several blocks, where radius was replaced with width/2. For some reason this does not work for the sphere.

Any ideas, pointers on how to get a sphere with a 570px diameter to show up on screen?

Thanks.

A: 

This cannot be achieved, at least not precisely. The perspective projection does not map a sphere to a circle. See how the spheres at the edges of this image are getting deformed? grid of spheres

Roman Zenka
I see exactly what you are talking about. But in my situation I have a single sphere, like the one in the middle of your lattice (the red one). That seems to map to a circle like I want to do - I just need it to be a fixed size.
sberry2A