How do I calculate what percentage of a sphere is lit?

Hey guys,

My basic idea was to have a sphere in the middle of the scene and some spotlights spinning around it, looking at the center of the sphere from different distances.

Is there any way to calculate how much of the sphere is lit by at least one of the spot lights?

I guess there would be an easier way to do this in a shader, but I have no knowledge of shaders with regards to lighting.

One way is to calculate how lighting affects each triangle yourself. Simply loop through all the normals in your mesh. This is the direction in which the surface is facing.

Then, foreach normal, calculate whether the normal is facing the light or not (within a threshold). If it is facing the light, it is lit, else, it isn’t lit. Sum up how many normals are lit, and that’s your percentage.

(Check out dot product of vectors)