Spring 2004 NPR Research

3.5) Curvature Equation

While messing around with the simulator, I found out something very interesting.

Elliptical objects will cast a shadow on themselves. The size of this shadow is directly related to the curvature of the object, and the angle the light source is at with respect to the camera.

If you assume the object is a ellipse, you can find the ratio of the depth of the object (away from the camera) to it's width (width in the image).

Specifically, if you know these values:

D: The Distance to the object from the camera (assuming the center of the object is in the center of the camera's view, and the camera is orthographic)

B: The Distance to the light from the camera (assuming they are both in the same plane)

R: The radius of the object as it appears in the camera.

L: The radius of the lit section of the object. (the part of the object not in the shadow cast by the light)

The ratio is:

R :
R/acos(sin(L/R)) - (D - (B*atan(sin(L/R))))


The Derivation

Say we have a rig with a camera, a light source that is in the same plane as the camera, and some object we are observing.
The object is lined up so that it's closest point is in the center of the camera.
We also know the distance from the camera to the closest point on the object, and the distance
from the camera to the light source.

Take a picture of the object with the light on, and with the light off, and we'd end up with something like this:


The light shines from the right hand side, illuminating all but a small section on the left, which remains in shadow.

The lit area left of the blue line is 36 pixels (we'll call this L), and the object's radius is 50 pixels (we'll call this R). We will also call the distance form the camera to the object D, and the distance from the camera to the light source B.

Since we know that the light rays are tangent to the object at the point the shadow starts, we know that the two angles with green circles in them should be equal.

Since the yellow line is L, and the hypotenuse is R, the angle at the lower green dot is sin(L/R).

The angle at the upper green dot should be the same, which means the orange line in the middle will be equal to (D - (B*atan(A))).

Substituting we get:
Orange = (D - (B*atan(sin(L/R))))

If the object is really a circle, then there's another right triangle here:


Since the lower left side is R, and the right side is R + Orange, R + Orange = R/acos(A)

If the object is not a circle, then that equation will not hold true, because the right side will be R + Orange + Some Offset, which yields the equation:

R + Offset = R/acos(A) - Orange

This can be said another way, which is a lot more clear:

The ratio of the object's width to it's height is R:(R+offset)
Substituting, the ratio becomes:

R :
R/acos(sin(L/R)) - (D - (B*atan(sin(L/R))))