Duncan Champney

10-04-2008, 05:03 PM

Folks,

I'm writing code to create 2 color anaglyph images of my 3D fractal images.

To create the anaglyph I need to select a zero parallax distance - a distance from the camera where the left and right eye views coincide. Vertexes at the zero parallax distance appear to be on the surface of the computer screen. Objects at less than the zero parallax distance appear to float in front of the screen, and objects at greater than the zero parallax distance appear to be behind the surface of the screen.

I'd like to have a slider in my app that lets the user shift the 3D object anywhere from in front of the screen, to centered on the screen, to just behind the screen

To place my 3D object accurately, I would like to know my 3D object's closest and furthest point from the camera, after applying the model view transformation (the user interface in my program allows the user to move the camera around the image, which applies translations and rotations to the model view matrix.)

I need to know the closest and furthest points before I draw my object, so I can calculate the zero parallax distance.

Here's what I'm thinking as a crude way to calculate my closest and furthest points. First, I'd run through ALL the vertexes in my object (sometimes millions of vertexes) and record the maximum and minimum values for x, y, and z. I would only need to do this once unless my 3D object changes. This would let me create a bounding cube. I would then get the value of my model view matrix and multiply all the vertexes of my bounding cube by that matrix. I'd then find the largest and smallest z values in my transformed bounding cube.

Would that be too crude to be useful? My 3D object is a rectangular height map of a fractal plot, where the height of each vertex is near zero for some plots, and other plots the whole plot can be as tall as it is wide, and the height value of each vertex can vary chaotically.

Is there another method that would give me a more accurate maximum and minimum distance value fairly efficiently? I'd like to avoid doing the full model view transformation on every point in my plot.

I seem to remember reading about a way of finding a front clipping plane and rear clipping plane for a transformed object, but can't find it.

I'm writing code to create 2 color anaglyph images of my 3D fractal images.

To create the anaglyph I need to select a zero parallax distance - a distance from the camera where the left and right eye views coincide. Vertexes at the zero parallax distance appear to be on the surface of the computer screen. Objects at less than the zero parallax distance appear to float in front of the screen, and objects at greater than the zero parallax distance appear to be behind the surface of the screen.

I'd like to have a slider in my app that lets the user shift the 3D object anywhere from in front of the screen, to centered on the screen, to just behind the screen

To place my 3D object accurately, I would like to know my 3D object's closest and furthest point from the camera, after applying the model view transformation (the user interface in my program allows the user to move the camera around the image, which applies translations and rotations to the model view matrix.)

I need to know the closest and furthest points before I draw my object, so I can calculate the zero parallax distance.

Here's what I'm thinking as a crude way to calculate my closest and furthest points. First, I'd run through ALL the vertexes in my object (sometimes millions of vertexes) and record the maximum and minimum values for x, y, and z. I would only need to do this once unless my 3D object changes. This would let me create a bounding cube. I would then get the value of my model view matrix and multiply all the vertexes of my bounding cube by that matrix. I'd then find the largest and smallest z values in my transformed bounding cube.

Would that be too crude to be useful? My 3D object is a rectangular height map of a fractal plot, where the height of each vertex is near zero for some plots, and other plots the whole plot can be as tall as it is wide, and the height value of each vertex can vary chaotically.

Is there another method that would give me a more accurate maximum and minimum distance value fairly efficiently? I'd like to avoid doing the full model view transformation on every point in my plot.

I seem to remember reading about a way of finding a front clipping plane and rear clipping plane for a transformed object, but can't find it.