Hi,
In the beginner’s forum, I discovered that I am having a z-fighting problem, and it was suggested that multipass rendering is one way to solve this. However, no one was able to tell me how to do a multipass render, so I thought I would ask this forum, as this may be considered an advanced topic.
I have a near-field object (less than 5 units from the camera), and a far-field object over 30 million units away. Obviously, a 32-bit depth buffer is not enough to accurately resolve the far field image, resulting in rendering artifacts on the far object due to z fighting. This means that I cannot simply change the near clipping plane to fix this because then my near-field object is not visible.
So, I’m guessing that I have to make a far field viewing frustum, render the object, make a near-field viewing frustrum, render the object, then swap buffers.
Would this be the way the code should look?
gluPerspective(20.0,aspectRatio,1.0E6,1.2E8);
DrawEarth();
glFlush()
gluPerspective(20.0,aspectRatio,1.0,1.2E6);
DrawSatellite();
glFlush();
SwapBuffers(hDC);
Is this correct? Am I missing any major steps? Or am I completely off base? Any help would be appreciated…