Shadow Effect

I’m getting a shadow effect on the edge of my data. I did not implement any lighting in my code.
Check out: http://ca.geocities.com/gunsboy/image1.jpg
http://ca.geocities.com/gunsboy/image2.jpg

I don’t know how to solve this problem. Any suggestions ?

Your GeoCities account won’t show the images.

However, your problem is most likely (from reading the description) that you’re using GL_CLAMP instead of GL_CLAMP_TO_EDGE for your texture clamping mode, and thus the texture border color (black) gets blended with the texture at the edges.

Well, at least that’s FAQ answer #1 when people say they get shading at the edges of textured stuff :slight_smile:

Your GeoCities account won’t show the images.

Yes it will. You have to copy and paste the link into your address bar.

I think what your problem might be is that some of your vertices’ color is set to black. So the black is interpolating across the polygon and blending with the colors of the other vertices. So make sure none of your vertices’ colors are not black.

-SirKnight

I am not using any textures in my image. It is just a GL_POLYGON list.

I checked on the vertices and none of them is colored black.

I changed the background color to white. This is what I got.

Even the bounding box has changed color on 3 of its vertices.

check this … http://ca.geocities.com/gunsboy/image3.JPG

Originally posted by SirKnight:
[b] Yes it will. You have to copy and paste the link into your address bar.

I think what your problem might be is that some of your vertices’ color is set to black. So the black is interpolating across the polygon and blending with the colors of the other vertices. So make sure none of your vertices’ colors are not black.

-SirKnight[/b]

I have noticed that the shadowing effect goes away when I use glShadeModel(GL_FLAT)instead of glShadeModel(GL_SMOOTH).

But the image looks really bad

It looks like your not keeping track of your states very well. If the color of the bounding box changed after you removed some code then some state is not being set (color, blend, text env, …). Try adding code to set these states before every begin / end to the values you know that they should be. This should work (at least for the box). If this doesn’t help the rest try adding an if((color[r] + color[g] + color[b]) < 0.1) throw an exception. Opengl will only do what you tell it, some how your telling it to display black…

To me, it looks like small (not unit) or incorrect normals at the edge of your data. With GL_FLAT the face uses only one normal, so it’s not black.

Even GL_NORMALIZE won’t help if the normals are zero, NaN or Inf.

I also have this problem.
in my case, edges sometimes appear black, sometimes white.
however, I only recognize this on my laptop’s GF 4 MX 420. never saw it on ANY desktop gfx-card (neither nvidia nor ati or others)
anyone an idea ?