PDA

View Full Version : when the scene doesn't fit the frustum



felpy
12-11-2009, 02:12 PM
I'm trying to render the earth using a quadtree (independent sections) in a planar projection (I can't make use of the earth curvature). That means my desired frustum is from 1 to about 24000000 to be able to see the entire earth plane sitting in one corner very near the ground to the other corner of the earth plane. Obviously I'm having z-fighting issues (as well as jitter due to float precision, but that is another matter).

I tried the method explained in the page 45 of this pdf (http://www.mpi-inf.mpg.de/~mwand/papers/vis02.pdf) :
1. Set zFar to the maximum value needed.
2. Set zNear = zFar / ratio.
3. Clear z-bu er.
4. Render scene and cull to the adjusted frustum.
5. Set zFar = zNear.
6. If zNear isn't close enough yet go back to step 2.

But I'm getting problems in the zone where the two frustums touch, it looks like this (http://img10.imageshack.us/img10/1347/union2frustumsmal.jpg) and I can't figure out what's going wrong. I render the image in two passes, one with a different frustum from 50 to 50000000 and from 1 to 50, as mentioned in the pdf, clearing the zbuffer in between.

Do you have any idea of what I'm doing wrong?

I'd also appreciate suggestions on alternative aproaches.

Dark Photon
12-12-2009, 07:46 AM
Let's first verify that that "step" you're seeing isn't being drawn. Clear your color buffer after each frame.

felpy
12-12-2009, 08:19 AM
I do.

I clear zbuffer+color buffer,
draw the entire scene with the first frustum,
clear the zbuffer,
draw the same entire scene with the second frustum,
and start again.

I make sure the scene is the same (no camera movements) every entire frame.

Dark Photon
12-12-2009, 07:44 PM
Ok, scratch that. You are clearing the color buffer. That vertical "step" is really odd. Are you sure it's not in your data? That is, it moves along with your eyepoint as it moves into the scene?

Aleksandar
12-13-2009, 04:38 AM
I think that you have got exactly what is expected. Think for a while and you'll realize that. You have two different spaces converted to fragments. Z-buffer settings are not the same for both, so cracks or "jumping" vertices is a normal phenomenon. Presented technique is very applicable, but for the space, where planets do not touch. Rendering a terrain is a little bit different.

I'll read the paper and take a look at what they have done, but my advice is to create a stitch area, or extend both areas/blocks so that they overlap.

The drape on the edge is probably the result of the way blocks are drawn.

felpy
12-13-2009, 01:37 PM
Overlapping the near/far planes by a little doesn't work (1-51 and 50-50000000), overlapping them by a lot, curiously enough, seems to work (1-10000 and 50-50000000).