Results 1 to 5 of 5

Thread: Smooth shading not working correctly

  1. #1
    Guest

    Smooth shading not working correctly

    Hi there seems to be a problem with the smoothshading when you are using lots of vertices on a polygon. I have a circle and all the vertices on the left are one color and the ones on the right are another because I want a smoothing across the circle. It looks like openGl interoplates a line from that starting point to every other vertex, because all lines going to the starting vertex interpolate correctly. However it makes solid lines to the top and bottom where the colors change so it looks like a pack man, the pack man part is solid with some smooth shading going on in it;s mouth. How can I fix this?

  2. #2
    Member Newbie
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    48

    Re: Smooth shading not working correctly

    I'm a beginner as well, but why would you draw a circle as a polygon? I would recommend you to draw it as a single textured square and calculate the shading yourself, then use it as an RGBA (partially transparent) texture. This would greatly improve performance and is much easier to do.
    Knowledge is Power

  3. #3
    Guest

    Re: Smooth shading not working correctly

    is a shape textured on a plane faster, then just drawing that shape with vertices? I didn't know that. It still wouldn't be easier for me as I don't know how to load a targa.

    However this is for a school project. It is implementing very simple 2d shadowing. I have a light that looks at all the vertices in the scene, and colors them "lit" based on if the light ray reached that vertex. That's all working correctly, but when I render the sphere say with 1/3 lit and 2/3 unlit, it doesn't smooth shade properly. I can't use a texture because there is animation going on and the way the objects are "lit" is changing at any given time.

  4. #4
    Guest

    Re: Smooth shading not working correctly

    sorry I read you wrong, I thought you were talking about loading a texture. Your idea sounds good but I don't know how to do all that. I can see how to interpolate from one vertex to the rest or scanline by scanline, but how do you make it so every possible line from any two points on the polygon is interpolated correctly? Is it a n squared algorithm where every pixel is based on an intensity from every line that runs through that point? That seems like a lot of work.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    east norwalk, ct, usa
    Posts
    184

    Re: Smooth shading not working correctly

    Stumped, for now, try using triangles rather than multi-vertex polygons. For a circle, try GL_TRIANGLE_FAN.

    When using GL_POLYGON, note that the poly you specify must not intersect itself and also must be convex. If you break either of these rules, the results are unpredictable.

    ---j

Similar Threads

  1. Smooth shading failure - help
    By ArtVanHouten in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-15-2009, 04:17 PM
  2. Smooth Shading
    By Connection in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-19-2008, 11:58 AM
  3. Smooth shading
    By TomPandolfi in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-22-2002, 05:18 PM
  4. How to do smooth shading using my own color set
    By chongchong in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 01-14-2001, 03:04 AM
  5. no fog in smooth shading
    By Zerosignull in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-20-2000, 07:48 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