AZDean

08-23-2008, 10:29 AM

I'm working with a terrain height map. It's a 2D grid that I subdivide into powers of two based on slopes. High slope areas have finer subdivisions. Low slope areas have coarser subdivisions. I convert these subdivisions into quad lists.

Of course, when I have edges of a larger quad next to two (or more) smaller quads, I have to adjust the smaller quad vertexes to avoid cracking. This works great, except that occasionally I get single pixel holes right where I have fixed cracks.

You would think my math is off when I compute what the Z value for a smaller quad should be to fix the crack, but I've looked closely and it seems very precise. I thought it was floating point precision issues, so I tried using double precision, but no change at all. I still get the same number of little holes.

The holes are always only a single pixel and only on the edges that I have fixed, though not necessarily at the vertex that I fixed. It's as if my edge equation doesn't match what OpenGL is doing (I'm running on a NVidia card). But I would think the edge equation is really simple. I just do a simple linear interpolation of height values.

What could I be missing? Does OpenGL do something where a simple linear interpolation would cause my edges (for the smaller quads) to not line up with the edges it creates (for the adjoining larger quad)?

Is there a way to get around this, using overlap of adjoining quads, or something?

Thanks.

Of course, when I have edges of a larger quad next to two (or more) smaller quads, I have to adjust the smaller quad vertexes to avoid cracking. This works great, except that occasionally I get single pixel holes right where I have fixed cracks.

You would think my math is off when I compute what the Z value for a smaller quad should be to fix the crack, but I've looked closely and it seems very precise. I thought it was floating point precision issues, so I tried using double precision, but no change at all. I still get the same number of little holes.

The holes are always only a single pixel and only on the edges that I have fixed, though not necessarily at the vertex that I fixed. It's as if my edge equation doesn't match what OpenGL is doing (I'm running on a NVidia card). But I would think the edge equation is really simple. I just do a simple linear interpolation of height values.

What could I be missing? Does OpenGL do something where a simple linear interpolation would cause my edges (for the smaller quads) to not line up with the edges it creates (for the adjoining larger quad)?

Is there a way to get around this, using overlap of adjoining quads, or something?

Thanks.