Ok, I create my terrain width HeightMaps and now I want to add a lake, I created a grid for the lake surface, but the lake's borders don't look very well...
Is there an algorithm or method to do thise?
Can you give me any advice?
terrain & water
Started by Macerlask, Apr 21 2006 03:01 AM
11 replies to this topic
#1
Posted 21 April 2006 - 03:01 AM
#2
Posted 21 April 2006 - 04:34 AM
A screenshot would help - saying the borders "don't look very well" doesn't tell us much
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 21 April 2006 - 07:32 AM
Jagged/torn edges? How about blending the water texture and/or increasing its polycount a bit (if you plan to add ripple fx and such)?
#4
Posted 21 April 2006 - 02:27 PM
Ok, there are my screenshots, and the problem that I'm having is the ugly borders from the lake, when I'm close to them or when I take the camera up to have a aerial view of the map...




#5
Posted 21 April 2006 - 03:21 PM
I see. That problem is known as z-fighting and it happens because the z-buffer has limited precision, so when you try to draw intersecting polygons (e.g. the edge of the water intersecting the land) then you get those artifacts. To solve the problem, try clipping the water polygon to precisely the boundaries of the pond (to do this, the heightmap needs to have a ring of points that are precisely the height of the water, so you can exactly match the vertices). You can also try increasing the precision of the z-buffer; it looks like you're only using 16 bits there, try going to 24 or 32.
reedbeta.com - developer blog, OpenGL demos, and other projects
#6
Posted 21 April 2006 - 07:54 PM
Ok, I have solved the problem when I'm to close to the border, using a big quad instead of a grid, however I still having the problem width the aerial view, but how can i switch from 16 bits z-buffer to a 24 bits z-buffer, I don't find how to do this with GLUT... :unsure:.
#7
Posted 22 April 2006 - 09:32 AM
glutInitDisplayString("rgb double depth>=24"), maybe :glare: ?
#8
Posted 22 April 2006 - 03:08 PM
ha ha, what else? :no:
#9
Posted 22 April 2006 - 05:26 PM
Oh, and you can also try increasing the near plane distance; if it's too close it'll also cause precision problems.
reedbeta.com - developer blog, OpenGL demos, and other projects
#10
Posted 29 April 2006 - 09:58 PM
Ok, I solved the problem... you can not chose the buffer size with glut, glut just takes the best one that your graphic card has, so I checked the configuration of my card (an Intel integrated video card) and the option of 24 z-buffer was disable... and I just changed that to enable and it worked :happy:
Anyway thanks a lot for the help...
Anyway thanks a lot for the help...
#11
Posted 05 May 2006 - 01:32 PM
Suggest you use a stencil buffer (assuming your hardware supports it). Render the lake without rendering any pixels to the display surface BUT updating the stencil buffer accordingly, and then render the lake directly to the display using the stencil buffer as a mask. This will produce nice edges.
#12
Posted 05 May 2006 - 05:41 PM
Spudman, how would that solve the z-buffer problem? It doesn't matter whether you draw the pixels to the stencil or directly to the display; they have to be z-tested if you want correct occlusion.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












