Sign in to follow this  
sabhat

simple landscape & water (screenshot & newbie question)

Recommended Posts

Hi I've been messing around making a landscape using tiles made out of triangles and it works quite ok. Latly I've been thinking of adding some simple water and the first thing I thought of was making a quad under the terrain, so when I lower the terrain below it the water would appear. The problem is this looks really ugly where the water is crossing the landscape. -> http://img292.imageshack.us/img292/1004/3dterrain6lv.jpg I need some pointers on how to do this. Do I have to make a polygon out of the water aligning vertices from the water polygon to vertices on the landsape? And if I have to do this, is using GL_POLYGON shitty? Really hope there is some other easy way :p thanks for any help.

Share this post


Link to post
Share on other sites
you have to set your near and far plane to less extreme values.

try .1 for near plane and 1000 for far plane.

If that doesn't help, increase your z buffer bit depth

Share this post


Link to post
Share on other sites
I would use clipping planes at sea level instead...

check out clip planes in opengl... then draw this:

clipping on:
draw sea bottom

clipping off:
draw sea

clipping on:
draw terrain...



because if you simply increase the zbuffer depth, what happens to larger scale terrains or if the users graphics card doesn't support 24/32 buffer sizes? :)

Share this post


Link to post
Share on other sites
Yeah I see your point. Thing is that I dont know which parts of the terrain is under the water + I'm fairly new into opengl. Gonna look into clipping planes later on, but right now I'm gonna leave it with the "easy, but bad way" :p
Thanks for the suggestion though.

Share this post


Link to post
Share on other sites
thats the fine part with opengl, lots of it is done for you! :)

if you define a clipping plane at, say 0,0,0... then depending on the direction you "aim" it, it clips all polygons that are drawn while that clipping plane is active - Automaticly! (sp?) :)

so that would mean you simply define the clipping planes, draw the terrain using your normal draw functions and it will be clipped by itself. :)

Share this post


Link to post
Share on other sites
the problem with using the glClipplanes() method is that before the GF6 (and possible the GGFX) Nvidia's card dont support clip properly in hardware, instead its done via alpha testing and uses a texture unit per clipplane. While this kinda works, when compared to ATI's proper implimentation of clipplanes you can see how broken it is....

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
the problem with using the glClipplanes() method is that before the GF6 (and possible the GGFX) Nvidia's card dont support clip properly in hardware, instead its done via alpha testing and uses a texture unit per clipplane. While this kinda works, when compared to ATI's proper implimentation of clipplanes you can see how broken it is....


He is right. I have run my terrain engine on a 9600XT and a 6800GT and can tell you the ATI looks right and looks better due to the terrain rendering correctly, where as the 6800GT is wrong my water is all black due to the clip plane is not working would be my guess cause I don't change anything in my code and the ATI card looks great.

Share this post


Link to post
Share on other sites
Well that kinda blows :(

I've just made a larger terrain and the uglyness is back when you are looking on the water from a great distance. Guess i'll have to go with those clipping planes if there is no other (easy) way :p. Thanks all for the great input.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
haven't tried it yet,
but you could try to scale down your scene to reduce
z-fighting. that should work for 24/32bit z-buffers
(16bit buffers are fixed point ones ?!?)
due to the nature of floating point values, you should
get more precision for distant polygons that way...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Push your near plane away a bit from the camera, in your projection matrix.
Set it to the highest value you can get away with without having the landscape breaking up near the camera.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Push your near plane away a bit from the camera, in your projection matrix.
Set it to the highest value you can get away with without having the landscape breaking up near the camera.


That's your best bet if you can't work with clip planes. The Z-Buffer values do not work on a linear scale, so the farther you push the near clip plane away from the camera eye point, the higher resolution you'll get further away.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Push your near plane away a bit from the camera, in your projection matrix.
Set it to the highest value you can get away with without having the landscape breaking up near the camera.


Quote:
Original post by sordid
That's your best bet if you can't work with clip planes. The Z-Buffer values do not work on a linear scale, so the farther you push the near clip plane away from the camera eye point, the higher resolution you'll get further away.


That did indeed improve it all amazingly. Right now the water is disappearing in the fog before it gets buggy. I will however have problems if I'm going to improve the view distance, but right now I'm happy with this. I'll experiment some with scaling/clipping planes later on, but as far as I am concerned this issue is solved. Thanks for helping me out.

Share this post


Link to post
Share on other sites
When adjusting the near and far clip plane, you might want to take into consideration that it is the actual ratio between the two that matters. Suppose you set your near clip plane to 0.01 units, and your far clip plane to 100'000 units. In this case it would give you the same increase in accuracy to adjust your near clip plane to 0.1, as it would to adjust your far clip plane to 10'000.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this