Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

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

Thread: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

  1. #1
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    164

    White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    Hello.
    I am messing around with stencil shadows.
    For now I run z-fail only.
    I am noticing white artifacts the size of a pixel appear in my shadowed area.
    Where there is no shadow I sometimes get black jaggs or barbs (don't know how to describe).
    Is this a known issue (what can I do about it)
    Or is it me again being unable to do anything right?
    Thanks for any help.
    I may not be good looking but I sure am dumb.

  2. #2
    Intern Contributor
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    97

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    What size depth buffer are you using?

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    Any chance of a screen shot?

    If the problem looks like z-fighting then there's a few things that may cause the problem. Ones that spring to mind are...

    1. depth buffer precision
    2. floating point precision for rotations etc.
    3. You are doing something wrong with your shadow volume rendering.

    Item 2 put a number of jaggies into my display because I was converting from Quaternions to Axis Angle. The jaggies appeared because between the first pass (Ambient only) and the second pass (z-fail fully lit) the resulting rotation was not the same due to fpp.

    This meant that the lit geomtery was actually placed slightly different to the ambient geometry & jaggies resulted.

    One way to identify the problem to turn off the drawing of your shadow volumes to the stencil buffer (just comment or #if out the code). If you still the jaggies then your ambient and lit geometry are not position invariant (and you can discount 3 above).

    You can then "eliminate" depth precision by ensuring you have the maximum depth precision available (24bit on nVidia [?] on ATI). If you are using an infinite far plane for your shadows, try turning it off and using NV_depth_clamp (on Vidia hardware) or just use the infinite frustum for your shadow volumes.

  4. #4
    Intern Newbie
    Join Date
    Nov 2002
    Location
    paris, france
    Posts
    38

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    are you extruding all triangles in shadow or using the object silhouette to create your shadow volume?
    cb
    Sébastien Kuntz
    SNCF VR Lab

  5. #5
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    164

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    Hello.
    1. 16 or 24 Bit depht-buffer seem to make no difference.

    2. Hmmm. I have a lot of passes. Where is a potential fpp-critical moment. As far as I can see I set me camera before any rendering and it stays the same for every pass. (I will try something out though)
    (I totaly disabled the shadows and all cracks disappeared although I still need several passes for lighting. Is that what you mean?)

    3. I extrude every triangle that is facing the light. (no silhouette)

    4. I use an infinite view frustum. I don't think it is wrong as I see nothing if I use a normal frustum.

    Thanks for the help!
    I may not be good looking but I sure am dumb.

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    652

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    What gfx card do you have? I noticed strange artifacts on my GF2 after I enabled the scissor test for stencil shadows. I didn´t have those pixel errors on other gfx cards.
    The artifacts do not look like zfighting (long streaks) but like regular patterns of mis-shadowed pixels. And they completely go away with disabled scissor test.

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    8

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    I reccommend only rendering the silhouette of the shadowed object. The fewer polys rendered the lower the chance of artifacts, you could also get a speed increase.

    Another problem could be percision when you are creating your extruded polygons. Try using a double instead of a float.

  8. #8
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    164

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    I have a GF2. I don't do the scissor test, though. BTW, do I gain much from that test?

    I'm going to try it with doubles.
    I would only render the silhouette if I knew what it looks like

    Thanks!

    [EDIT]
    I believe the dots on the shadow appear where the volumes of different triangles join. So only extruding the silhouette would probably give better results but they shouldn't appear in the first place

    [This message has been edited by B_old (edited 04-09-2003).]
    I may not be good looking but I sure am dumb.

  9. #9
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    It's kind of hard to say but it sound like you might be rendering geomtry which is not closed and you are seeing the cracks between the adjacent triangles? (ie. you see it in areas where the adjacent triangles do not actually share vertices - the vertices are duplicated)?

    Another cause I can think of is if you have GL_POLYGON_SMOOTH enabled? (I think that's right - I seem to remember Polygon Smoothing can cause artifacts between the triangles under certain conditions).

  10. #10
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    164

    Re: White/black mini-artifacts in shadowed/lit area (stencil; z-fail)?

    What do you mean by 'geometry that is not closed'?
    Suppose I have a closed cube. I would only render the faces that face the light. Then it is not closed any more. Is that what you mean?

    Never enabled smooth polygons.

    Thanks for the help!
    I may not be good looking but I sure am dumb.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •