Lighting effect on unit sphere

Compared the lighting effect (shadow and such) on the sphere created using glutSolidSphere and the sphere created myself, it appears on the former one the transition from bright region to dark region is smooth, the border that separate the two regions is a piece of nice arc, while on the one I made, the border looks jagged. I guess the normal of vertex is the key…

Any ideas? :frowning:

You need to “smooth” your vertex normals.

Usually once first computes all face normals. Then one takes the normals of all faces that use the same vertex, adds them up and normalizes the result again. That gives you the average normal of all faces that use the same vertex.

Have fun,

I guess, for a sphere only, it might be easier to just create a vector from the center of the sphere to the vertex in question, normalize it and then use it as the normal for the vertex.

Hello, Jan: I think that may make a difference, the one I made looks OK, just not as good as glutSolidSphere. I will try the averaging approach when I have got some time.

Hello, GreenAlien, yes, that was way I did it.