PDA

View Full Version : How the size of the object in the simulation is determined?



sealzh
04-21-2004, 02:04 PM
I am using a driving simulator which is programmed by OpenGL. Can someone tell me how the size of the objects in the simulation is changed with the simulated ditance. I know in perspective projection, we specify a frunstum. Is the image projected on the Near Clipping Plane or on a fixed Projection Plane. My programmer gave me a test program by which I can play with the parameters of Near Clipping Plane and Far Clipping Plane. I found that while I increased the value of the Near Clipping Plane (i.e. move it away from the COP), first nothing happened, then while passing certain value, the objects start to be cutted off from front until the whole thing disppeared. During this, the size of the objects didn't change. This seems to me the image is projected on a fixed projection plane. Can someone tell me if I am right, and if yes, where and how I can adjust the distance between the COP and the fixed Projection Plane.

Thanks a lot

zeckensack
04-21-2004, 02:56 PM
Size attenuation is controlled via field of view (I think glFrustum and gluPerspective documentation give "fov" as parameter name). This is the parameter you're looking for.

If you take a look at the actual matrices, you'll note that transformation yields a 4d homogenuous result. The fourth component of this result vector, "w", divides the other three components. In perspective projection matrices, there's always a correlation between some "forward vector" and w. This is how objects get smaller in the distance.

Near and far clipping planes not only act to cut off geometry, but also greatly influence your effective depth buffer precision. As a general, though somewhat unrelated advice, keep the ratio between the two low, and push the near plane as far away as you can manage.