View Full Version : Lighting effect on unit sphere
01-07-2010, 02:04 PM
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? :(
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.
01-08-2010, 05:17 AM
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.
01-08-2010, 03:19 PM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.