Terrain/skybox fighting for draw

Started by
7 comments, last by kordova 17 years, 9 months ago
When I use a skybox or a far plane that overlaps rendered terrain, I get this: I believe it to be z-fighting, but have a depth size of 24 (which improved some issues from 16 earlier). What is the best method to correct this problem? Thanks in advance.
Advertisement
Easiest way would be to render the skybox first with depth writes disabled.

eg.

glDepthMask(FALSE);  // Sky wont write to the depth bufferRenderSkyBox();glDepthMask(TRUE);   // Terrain will write to the depth bufferRenderTerrain();
Hope that helps
Hmmm, I had tried that after the terrain render but this does not seem to fix it either.

I have also noticed now that the sky pops up in small spots occasionally nearer than the border as well.
Well the only other thing I can suggest would be to push the near plane back and bring the far plane forward.

What are your current z-near and z-far values?

draw the skybox last with
glDepthRange( 1.0, 1.0 ) // if possible if not 0.99999, 1.0
Quote:Original post by nts
Well the only other thing I can suggest would be to push the near plane back and bring the far plane forward.

What are your current z-near and z-far values?

Near: 50.0f
Far: 50000.0f-100000.0f (I want to render as far as possible for a large, open terrain with subtle hills)

This is a farther far plane than the one used in the above picture but I have the same issue along the seams of my terrain patches and with occasional spots randomly especially on the crests and troughs of the hills.

Quote:Original post by zedzeek
draw the skybox last with
glDepthRange( 1.0, 1.0 ) // if possible if not 0.99999, 1.0

Rendering the skybox after the terrain makes it significantly more obvious (as in, hilltops nowhere near the far plane/sky box will pop out), and setting the depth range does not seem to have any dramatic affect.

Cheers.

[Edited by - kordova on July 19, 2006 11:53:06 PM]
Quote:Original post by kordova
Rendering the skybox after the terrain makes it significantly more obvious (as in, hilltops nowhere near the far plane/sky box will pop out), and setting the depth range does not seem to have any dramatic affect.

aye?

1; Disable depthwriting

2; Draw sky (using only rotations, no movements etc.) centered at the camera

3; Enable depthwriting

4; Render world


This way the sky can be small as an apple, but still cover the "entire world".

"Game Maker For Life, probably never professional thou." =)
Ok, this must be an issue with Xcode not actually incorporating my changes when I rebuild. I ran it this morning, changing the far buffer to be even farther away (4x) and it works fine whether depth writing is disabled or not during the skybox render. Either way, I will leave it disabled just in case this pops up later.

Thanks for your help, each of you.

This topic is closed to new replies.

Advertisement