Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Weird scerrated triangle effect on my meshes

  1. #1
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Weird scerrated triangle effect on my meshes

    I am working on a space trading simulation, and am reading mesh data in, which has precalculated normals.

    I have recently added light sourcing, and
    am experiencing a weird effect within my meshes now.

    Check out the space station in this screenshot:
    http://www.dodgyposse.com/images/scerrated.jpg

    Look at the gold globe in the centre, and you will see some of the edges have a triangular chunk taken out of them.

    At first I thought, 'depth buffer' but GL_DEPTH_TEST is enabled, and I have called glEnable( GL_DEPTH ) also.

    GL_CULLING is also enabled...

    As you move forward in the scene, the position of the missing chunks moves, and sometimes, when the camera stops moving, everything looks fine.

    I also noticed,that some of the triangles on the surface of the ships flicker between light and shadow as the camera moves, i.e you can see the triangles which make up the mesh....

    I am assured that my meshes all have level surfaces....

    Any ideas anyone?

    dd

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,594

    Re: Weird scerrated triangle effect on my meshes

    i think this is a zbuffer problem.. how are your settings?

    how much zbufferbits? ( if you have a geforce, real zbufferbits = colorbits - stencilbits, had this one time 16bit color mode and 8bit stencil, result whas 8bit depthbuffer, not very nice indeed )

    near/far clipplane settings? try to move the near more far away, and the far more near..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  3. #3
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Re: Weird scerrated triangle effect on my meshes

    Hi,
    So you can modify the number of bits which the z buffer uses? Kind of explains what is going on....

    How do I modify this parameter?

    dd

  4. #4
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Re: Weird scerrated triangle effect on my meshes

    After a bit more thought:

    The near clip plane is set to 0.1, the far clip plane is set at 10000.0.

    I did this to ensure my planets did not suddenly appear out of nowhere, as I approached them...i.e they start very small
    and grew as I got nearer.

  5. #5
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Re: Weird scerrated triangle effect on my meshes

    After a bit more thought:

    The near clip plane is set to 0.1, the far clip plane is set at 10000.0.

    I did this to ensure my planets did not suddenly appear out of nowhere, as I approached them...i.e they start very small
    and grew as I got nearer.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,594

    Re: Weird scerrated triangle effect on my meshes

    ok, the depthbufferdepth is choosen with the PIXELFORMATDESCRIPTOR struct, but, as i explained, depending on driver(-settings) it can be choosen automatically..

    first, u create a spacetrading simulation.. so i think your meshes dont need to come too near to the cam, so set near to 1.f .. try if it is a problem to do so.. second, perhaps you should use 2 depthbuffers_passes, means first you set your clipplanes to for example 100 -> 1000000 and render all things behind 100 ( planets mostly.. ), then clear the depthbuffer and after you set it to .1f -> 100 to render the rest..

    but the rest is just setting the depthbufferdepth to a higher res and try to set the near as far as possible ( and perhaps you can take the far a little nearer.. )
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  7. #7
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Re: Weird scerrated triangle effect on my meshes

    Thanks guys, it was the near and far clipping planes, and after bringing them closer together, my polygons are no longer competing!!!

    5 stars to dave!!!

  8. #8
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Batavia, NY, 14020
    Posts
    234

    Re: Weird scerrated triangle effect on my meshes

    >> At first I thought, 'depth buffer' but GL_DEPTH_TEST is enabled, and I have called glEnable( GL_DEPTH ) also.

    Err... there is no enable enum by the name of GL_DEPTH.

    glEnable(GL_DEPTH_TEST) is what you're looking for there. Unless you just typed it wrong.

    Siwko
    - I am not opensource! -

  9. #9
    Member Contributor
    Join Date
    Sep 2000
    Posts
    91

    Re: Weird scerrated triangle effect on my meshes

    I meant

    glEnable ( GL_DEPTH_TEST )
    glDepthMask( GL_TRUE );

    sorry about the typing mistake!

    dd

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,594

    Re: Weird scerrated triangle effect on my meshes

    btw, do you have culling enabled? glEnable( GL_CULL_FACE );.. perhaps CW or CCW, like that there can be much stress taken away with z-buffer problems, too..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 10-28-2016, 07:09 PM
  2. Weird overlap effect
    By Fezziwig in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-09-2012, 03:20 PM
  3. How to remove lines inside triangle meshes
    By evilfer in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-14-2011, 09:04 AM
  4. Optimising triangle meshes
    By Thomas Harte in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 08-30-2002, 08:07 AM
  5. surfaces....using triangle strips or meshes
    By atiface in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-12-2002, 10:33 PM

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