Skip to main content
GameDev.net gamedev.net
🔒 Locked

Clipping problems...

Started by MrKnister Oct 2, 2001 at 7:20 AM 13 replies 400+ views
Original Post
MrKnister
MrKnister
Hello... I have a problem with my OGL prog... I programmed water and an isle but there are these f***ing clipping errors. I searched the message board for some ideas, but found nothing that would/could (???) help me. So... Any ideas ??? Bye MrK. Picture:
NewDeal
NewDeal
Heh, Half-Life does the very same thing from time to time. I have no clue why though.

Good luck
Vaporisator
Vaporisator
AFAIK this is caused by the z-buffer!
Because of the way how floating-point numbers are, their precision decreases if you get farer away from zero, and as this island seems pretty far away, the precision might be to low to actually determin, which pixel is the topmost.
But how you could solve this problem?

Well, try determining which part of the island is actually covered by the water and simply don''t draw it!?

Ok, this solution isn''t very good, but maybe it works. But I''m afraid, it''s the only solution, I can think of now!



Yesterday we still stood at the verge of the abyss,
today we''re a step onward!
Yesterday we still stood at the verge of the abyss,today we're a step onward! Don't klick me!!!
wolfman8k
wolfman8k
What goes on underneath the water?

Is more terrain underneath? or does the terrain start from the water plain?
MrKnister
MrKnister
The terrain should start from the water plain.
But it''s no problem to prog it another way.
Currently the terrain starts 5 units under the water plain.

MrK...
MrKnister
MrKnister
Ok. I have updated the source. Now the terrain starts 5 units under the water plain, and everything under the water plain doesn''t get drawn. But that didn''t help very much. There are some artefacts on the part between water and terrain.
Also if I move through the scene the water looks like it moves
up and down...

MrK...

(sorry for this bad english)

Wavarian
Wavarian
Try setting your depth bits from 16 to 32 in the gl window creation section of your code.
Megahertz
Megahertz
Whats your near clip plane set at?

-=[ Megahertz ]=-
-=[Megahertz]=-
MrKnister
MrKnister
Near: 0.5
Far: 1000000

MrK...

The depth buffer at 32 Bit doesn't help.

Edited by - MrKnister on October 4, 2001 3:49:08 AM
TheMummy
TheMummy
When you play Terrain games like Tribes2 you will also find these artifacts. With Z-buffers you will always have these artifacts when you have two polys that penetrate each other. You could avoid this by adding the water to your terrain graphics. This means that the water polys will end where they hit the terrain.... But then your water will be restricted to the vertices of your terrain heightfield. When you have artifacts again setting glPolygonOffset will help..

Edited by - TheMummy on October 6, 2001 8:32:14 AM
MrKnister
MrKnister
I have no idea how glPolygonOffset works.
Could you give me an example ???

MrK...
TheMummy
TheMummy
I have no experiences in modifing the poly offsets. As far as I understand you increase/decrease the zbuffer values of a poly.

You could also try reduce your zbuffer range... :- )
leblebi
leblebi
Try to adjust your near plane and far plane values. It seems
0.5->1000000
is far more then needed. I am using 10->5000.

Remember that we are not trying to make a perfect world here. Use some tricks to fake the player. For example you can add fog which cuts the far plane without player noticing anything so that you can use closer far plane.

Also increase the near plane. 0.5 is waaaayy less than needed. You will not have the player get that close to an object right? make it like what corresponds to 20cm in your game engine.

If you still have problems:
- Increase depth bit to 32
- For z-fighting you dont have to have overlapped polys. They may be separated. But when you look from far away, the polygons may look like z-fighting due to finite precision of float numbers. Try to avoid putting two polygons back to back very closely(and I dont see how you can have achieve this in a terrain engine)
- Use clipping if possible

Final note: glPolygonOffset will not work since this is not a decal(a la halflife) problem.
HTH
dadio
dadio
I have the same problem in my terrain app too...
To improve it, I just scaled everything down.
My polys were 100''s of units in size. I scaled them to 10''s, and the water clipping was fixed.
Just try to scale everything down as much as possible.

good luck

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.