Page 1 of 4 1234 LastLast
Results 1 to 10 of 33

Thread: z-fighting

  1. #1
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    237

    z-fighting

    Hi

    I'm rendering an underwater landscape in two passes.
    The first pass is the simple landscape, while the second is the caustic textures over the landscape.
    The problem is that in 16 bit mode everything is fine, in 32 bit mode, there is a mess of z-fighting.


    How can i fix it ?

    thanks,
    Bruno

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: z-fighting

    Push the near clip plane further away from the viewpoint.

  3. #3
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: z-fighting

    Or use the stencil buffer to determine where the second layer should be rendered, rather than the depth buffer.
    Knackered

  4. #4
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    237

    Re: z-fighting

    Thanks fellows, but, that won't help.
    Why would i need to move the znear clip plane if it works in 16 bit mode ?
    And what is interesting is that in my geforce3 it works great in both modes, on the geforce2 only works in 16 bit mode, in 32 bit mode it fails.....,
    ???
    any ideias ?

    thanks,
    Bruno

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: z-fighting

    Hmm, think I read your question a bit wrong. Do you render the terrain in the first pass, and a second texture ontop of the terrain in a second pass? I thought the second pass was some kind of water plane, and you got Z-fighting in the intersection between this plane and the terrain.

    Anyways. It sounds like you indeed have Z-fighting, but in 16 bit mode it's so much that it looks good (but isn't). Sounds strange, but I can imagine such a situation.

    Does the two passes have identical geometry? That is, do you do anything that can possibly affect the coordinates? For example, doing a translation, and then translation back with negative values does not guarantee identical coordinates.

    A screenshot of the problem would be great. If you can't upload it somewhere, send be a shot by mail (address in profile).

    A tip can be to use polygon offset.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    237

    Re: z-fighting

    I have uploaded 2 screenshots.
    The shot were you can see the z-fighting is this one : http://brunomtc.no.sapo.pt/messedZ.JPG
    It was taken on a gf2 while in window mode.
    The correct one, is here: http://brunomtc.no.sapo.pt/FixZ.jpg
    It was taken on the gf3 in window mode too.
    I couldn't take the good shot on the gf2, because it's having z-figthing on window mode too.., so, on the gf2 the only mode that works is fullscreen 16 bit.

    Bruno

  7. #7
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    237

    Re: z-fighting

    I forgot
    Yes, the landscape is in the same place, i just render it again without anything that could affect the vertices.

    Bruno

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: z-fighting

    Are you rendering the landscape polys in the same order during second pass? And are you using a depth test of GL_EQUAL on the second pass?

  9. #9
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: z-fighting

    use glPolygonOffset(..)

  10. #10

    Re: z-fighting

    Any difference with 24-bit z-buffer depth?

Page 1 of 4 1234 LastLast

Similar Threads

  1. Z-fighting or something else? (pic)
    By GamerYZ in forum OpenGL: Advanced Coding
    Replies: 14
    Last Post: 01-05-2007, 03:52 PM
  2. sorry ... once again z-fighting
    By dawn in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-02-2002, 05:15 AM
  3. z-fighting (again?)
    By JacekPoplawski in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 08-11-2002, 11:44 AM
  4. Z-fighting
    By LordKronos in forum OpenGL: Advanced Coding
    Replies: 11
    Last Post: 04-18-2001, 03:54 PM
  5. Fighting
    By FatalError in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-01-2001, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean