Advertisement

Best way to texture map landscapes?

Started by January 28, 2000 07:25 AM
1 comment, last by Novalis 25 years, 1 month ago
OK, first a little background... I''ve got an OpenGL landscape engine that redners a 3D triangle "hex mesh". The elev data is stored in a huge 2D array, and only a small portion of the total landscape is visible at a time. Every time the POV moves, a new 3D mesh is "built" from a portion of the 2D elev data centered around the POV. The mesh is broken up into a grid of smaller meshes so that I don''t have to rebuild the entire mesh every time the POV moves, instead I just shift the existing meshes and rebuild the edge meshes in the direction of movement. Now for the question... Right now each "sub-mesh" has a bitmap built for it that is texture mapped onto it. This works great as I can blit hand drawn tiles into it and then overlay dynamic details like roads. I have encountered two problems though. Because the mesh as a whole is not drawn with a contiguous texture, seams are visible between textures. Also, it is difficult/expensive to draw details that cross between textures. So, would it be ridiculous to attempt to store the texture as one large bitmap? I guess my main concern there is the ability of the average graphics card to store such a large (1024x1024x24 give or take) bitmap. Any thoughts?
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?
You can do that, but especially older hardware won''t run fine with it. It is better to adjust your textures a bit. I suppose you use bilineair interpolation? In that case: the seams come from the wrapping. Thus the last pixel is interpolated between, say, texel 127 and texel 0.

Now that we know where the seams come from, what do we do against it? First, change OpenGL''s GL_REPEAT texturing parameter to GL_CLAMP. Be sure NOT to enable a border color.

Now, be sure that the last pixel of texture 1 and the first one of texture 2 are equal. With a bit of luck you don''t see any seams anymore. Maybe you need to adjust your texture coords a bit.

Hope this helps,

DaBit.

Advertisement
DaBit,
I think you're right about setting GL_CLAMP, that's better then what I'm doing now. I'm actually clamping the values myself so the texture doesn't wrap. The seam is actually kind of difficult to describe though...

Because the map is a hex map, not a square map, the texture edges don't line up with the edge of the bitmap that I'm texturing from. So when I have a polygon on the "edge" of a texture that has a non-orthagonal edge you see each square texel as being half colored correctly and half colored with white space (where it should theoretically be getting color from the neighboring texture).

The best solution I have been able to come up with is to make the textures one tile wider/taller then necessary and to draw in the texture for the first tile from the neighboring texture. This works fine, but it requires me to "render" some tiles twice into the texture bitmaps. I guess I'm just hoping there's a more elegant solution.

What do you think?

PS - I tried using GL_CLAMP, and it was *slow*! I think I'll just keep doing the clamping myself...

Edited by - Novalis on 1/28/00 8:37:35 AM
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?

This topic is closed to new replies.

Advertisement