Terrain + water

ok, thanks to all your advises now i have a large terrain with lakes and rivers. Both terrain and water is build with gl_triangle_strip, and since triangles are quite large, borders between land and water dont look very nice …
so i think i should use tessellation to subdivide land and water bordering triangles and then texturing properly in order to have a better looking “bordering area” ? perhaps with a new texture which contains a piece of land smoothly turning to sea ?

if this is not clear i can make a html page to explain me better .


perhaps i dont understand
but normally in 3d you’ld draw the water over the land

I believe a screen shot is the only way we’re going to understand what’s wrong with your current approach. That, and maybe you letting us know what you would want it to look like when you’re done :slight_smile:

ok , in the simple terrain engine i’m building, i use one unique texture for both land and water: when the terrain height goes to zero, i simply glcolor to blue: of course this look quite bad, so now i should build another separate triangle strip for the water (still have to find the algorithm). But even in that case, when land finish and water start, i’d go suddenly (and not gradually) from a texture to another (lets say from a brown texture to a blu one). If what is up is not understandable, pls check this page:


If you’re currently using one colour per face, you sould change that to one colour per vertex. That way you should get a smooth transition. It’s hard to tell from your screenshots which approach you are using.


In your second approach, where the water is a separate set of polys, you could blend the water into the land. Your water would look a little transparent so the land texture would show through and you wouldn’t get such a sudden change from one texture to the next.

Do you mean that at the edge of the water (especialy in the second shot where there isn’t a smooth transition) that the edge is very “grainy” or “blocky” and looks like low resolution poly count? If so then to get rid of this I think the only way is to use some form of tesselation, but I don’t know how. You didn’t ask a specific question so I can’t really answer your post, I don’t think I need to say this but look on the web and you will find some tesselation tutorials.

I added a simple LOD system to my terrain engine becuase it previously ran at 10FPS!!! framerates are about 40 fps without any optermisations but the trouble is it looks crap at the transition zones with blank parts that arn’t drawn and bad popping. I alo don’t want to use ROAM becuase of the overhead which would slow down fast TNL pcs which could easily render a large amount of terrain with a very simple LOD system. I guess you can’t have your cake and eat it!!!

Stetcher, pls tell me an example (few lines of code) on how to blend water into land …

If you look around I’m sure there are some good tutorials on blending. The opengl programming guide has a good section on it.

Here are the basic steps you’ll have to do when you draw your water (you’ll have to draw your terrain first):

glBlendFunc(GL_SRC_ALPHA, GL_ONE);

specify the color of the water vertices with RGBA components:
glColor4d(r, g, b, 0.5); // 0.5 is just an example, the water will be 50% transparent

draw your water

if you texture map the water you might have to use
so the texture alpha value doesn’t replace the alpha values you specify, with glColor4d.

disable blend and set depth mask back to true.

I think that’s the basics. You should search around and find some sample code.