Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: GL_SMOOTH interpolation causes highlights on edges of triangles

  1. #1
    Newbie Newbie
    Join Date
    Nov 2013
    Posts
    2

    GL_SMOOTH interpolation causes highlights on edges of triangles

    hi,

    I have what I think may be a very simple question but cannot find a solution anywhere online.

    I am using GL_SMOOTH - I would like to render triangles just using colors (no normals) but I'm not sure if the interpolation I see from GL_SMOOTH is correct.

    As a test example, I tried rendering a miniature terrain (3x3 vertices).
    I set all the colors to white except the center (1,1) as red.
    I render the terrain with 2 strips (GL_TRIANGLE_STRIP) with GL_SMOOTH.

    What I observe is a bright red spot in the center as expected, but I can see sharp red highlights extending outward along the edges of the triangles - so everything is 'smooth' but the effect is a 6-point red star.

    This is problematic because I use this setup for terrains and I can see diamond hatching all over the place whenever the colors change quickly over the terrain.

    So to sum up my question: In my test case the GL_SMOOTH interpolation seems to favor the edges of the triangles making them more visible (more red) than I would like, but I'm not sure if this an artifact of the correct GL_SMOOTH implementation, or if I have somehow made a mistake.

    I have found some old inactive forums that appeared to ask the same question but never had a resolution. For example (since I don't think I can post a link directly), you can google search this term:
    'I'm having a problem with saw tooth lighting on a 3D gluSphere()'

    The first link on java-gaming shows a rendering error with lighting - I am not using normals and lighting, but I think GL_SMOOTH handles vertices with lighting the same as if I just use colors. The image in that link is exactly the same kind of artifacts on my terrain. I just can't say for sure if that is wrong. You can see at the edge between light and dark there are visible dark or light lines marking the edges of the triangles pointing away or towards the dark side of the earth.

    If I can resolve this I think it will improve my terrain significantly.

    I am using OpenGL ES for iPhone development.

    I hope this explanation is clear - I may need to find a way to post my images.

    thank you.

  2. #2
    Newbie Newbie
    Join Date
    Nov 2013
    Posts
    2
    I am adding links to images (on picasa) for the test case I described.

    The first shows the test case - I am trying to determine if the red radiating lines emanating from the center are the correct behavior for GL_SMOOTH.
    https://lh6.googleusercontent.com/-g...6-no/Solid.png

    This is with GL_LINE_STRIP instead of GL_TRIANGLE_STRIP - not sure if that helps.
    https://lh5.googleusercontent.com/-b...09-no/Wire.png

Posting Permissions

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