We’re trying to make a model of the Solar System and we can’t seem to solve the distance. We need to be able to see the sun (as small as it may get), at far away distances(sun is at (0,0,0) and the earth needs to be around (70000,0,0). Right now we can’t see the sun at distances of over 6000, and I would like to know how we can fix that. I know its possible because we had some still code at real distance values(earth (149*10^6,0,0)) and it worked fine. PLEASE HELP!!!
Set your far clipping plane further away. And please refrain from using ALL CAPS in your titles.
I tried using gluPerspecive with the zfar parameter at 10000 and it still crapped out past 5000. Do you have a function suggestion?
Sorry about the caps…I’ll refrain from using them in further posts
There are several ways of solving this problem:
Make a bounding box and project your sun and the rest of the stellar system onto it.
(If you use a real timeframe, making changes in the background almost unnoticeable over time).
Use the box to simulate a static background and draw your moving objects that are closer to camera using prefered depthrange.
Miniaturize the entire system to fit into the available depthrange. Remember to simulate a miniaturized camera and physics aswell. This may be the simplest and best solution for you to use.
Miniaturize only the objects moving farther away from the camera, but never let them leave the defined view frustum. This only works if the detail of the farther objects are kept to a simplistic level (not allowing depthrange errors) and making sure that the objects always are separated by vast enough space to avoid depthtesting between objects farther and nearer to camera.
This would work fine for a stellar system, because of the size of the objects in relation to the vastness of space between them.
Think of your objects in terms of a fraction between 0.0 + Epsilon and 1.0 and use that range in your depthrange. This makes it easier to keep everything visible, yet keep maximum precision at all times.
If your 3d objects cannot be rendered correctly because of the small fraction of the depthrange it uses (rare cases), use bitmaps or points instead, object detail is screwed anyway.
Geesh… do you think you post your question enough times? Twice in the beginners forum and twice here.
You say you set the zfar to 10000, and the sun was lost at 5000, but you don’t say if you are doing any “camera” positioning. For instance, if you use gluLookAt, or glTranslate the “camera” back 5000 units, and then try and move the sun another 5000 units away you will actually be 10000 units away and go behind the clip plane.