What is causing this jagged shading artifact on my sphere?


Please first see this image:


I would like to understand what is causing the jagged black shaded edge you see on the left side of the sphere.

My program has variance in hundreds of parameters but I only see this effect occasionally - perhaps one in 30 scenes. Most often when the sphere is blue.

The sphere is a textured, lit gluSphere. Increasing slices/stacks doesn’t help. There are always one or more light sources in the scene. The sphere has a little specular and shinyness. However, after playing around with the various material and lighting params I can’t deduce the real cause, or a rule to avoid the problem.

Would appreciate any assistance!



Your eye is very sensitive to changes in blue chroma information (rather counter intuitive considering the calculation of luminance).

This is a vertex lighting shading artifact where vertices fall into and out of illumination at the edge of that lighting result, the stepped pattern corresponds to the meshing of your object. More subdivision or trying to soften up that lighting edge might mitigate the effect.

Thanks, but neither of these comments seems to tally. The artifact is very strong on blue spheres but seldom seen at all on different colors.

As I mentioned there are plenty of poly’s in the sphere - 35 slices and stacks actually, which clearly does not correspond to the black shading stepping shown.

Any other comments welcome!


Are you using stencil shadows? If so try turning them off and seeing if that makes a difference.

nope, no stencilling…

Originally posted by meanfox:

As I mentioned there are plenty of poly’s in the sphere - 35 slices and stacks actually, which clearly does not correspond to the black shading stepping shown.

I assume “clearly” means you haven’t looked at it? :wink:

Can you generate an image where the wireframe of the sphere is drawn over the shaded version, to give us (and yourself) a hint of where the polygons are? The artifact you show typically is due to insufficient tesselation, so having some data to work with would help.


hmmm…I think that something with the normals is wrong.
Do you have called glScalef before rendering the sphere?
If yes, you should renormalize the normals with glEnable(GL_NORMALIZE)

After further experimentation, the problem is most apparent when I set GL_SHININESS low. Setting it to around 10 to 15 seems to ameliorate the problem.

I determined that adjusting the tesselation does make a difference - it increase the number of steps, Scaling with the tesselation but not corresponding 1 to 1. For example, with 300 slices and 300 stacks I see maybe 30 steps or so.



look meanfox, as everybody said, this is caused by vertex lighting. Lighting is only computed at vertices, and just interpoled along triangles (or quads).
Why with 300 slices you only get 30 steps ? Look :

shadow part
lighted part

With diffuse lighting, it is barely noticeable, because the lighting is pretty smooth. With specular though, there are cases (ie. almost back-light) when there is a hard step between full specular and no ligthing. That is the way it works.

To improve that, from easier to harder :

  • don’t use specular at all
  • increase sphere vertical subdivisions
  • use a smooth specular (low exponent, as you noticed)
  • use a faint specular (not too bright)
  • do the lighting yourself (that way you may soften the back-light edge)
  • do per pixel lighting with shaders

I hope it will help.