For this project I was able to create shaded objects and shading using
one bounce implicit labertian lighting. Basically instead of returning
the color of the hit point when a ray from the lens hits an object, we
return the color of the light reflected off that point on the object, and
the color emitted from that object. How do we know what color is
reflected off a point of an object? Well, we assume that light can
come from anywhere, thus we bounce another ray off the hit point in a random
direction, and see if that ray hits an object which emits light.
How do we know if an object emits light? Each object now had a material
associated with it, instead of just an object. Each material has
a specific Reflected and Emitted color. What happens is a little
more complex than all of this, but this is the basic idea.
Below are some examples of images using Implicit Lambertian Lighting.
The first is a Sphereical light source (top) tangent to a white ball (bottom).
The light has an emitted color of (1,1,1) and a reflected color of (0,0,0).
While the ball has a reflected color of (1,1,1), and a emitted color of
(0,0,0). The image is rendered at 1600 samples per pixel. Because
we are bouncing random rays off the lower sphere, and hoping to hit the
top one, a large number of samples are needed to get a smooth looking image.
At the point where the objects meet the color is (1,1,1) since every ray
bouncing off that point will hit the light. The sphere changes to
a darker and darker grey until it turns to black. Because the light
and the ball are the same size, all the pixels on the bottom half of the
ball are black. No rays bouncing from the bottom half of the ball
can hit the light source.
Figure 1 - Two spheres. On the top a light source, and on
the bottom a white ball of the same size.
This image shows how shadows can be created implicitly by objects blocking
the light. A big light out of the picture lights up the red sphere,
and then blue ground, but under the ball a shadow appears because it is
more difficult to find a ray that will bounce off that area and hit the
light source. This image is also rendered at 1600 samples per pixel.
Figure 2 - Red sphere and blue ground. 1600 samples per pixel.
The image above and the image below use light sources with intensities
greater that one because otherwise the images are quite dark. It
is, however important to choose the intensity of your lights carefully,
as it is easy to get them too bright. The following image was shaded
using two lights one to the left and one to the right of the camera.
It is obvious that the light on the lef to the camera was too bright.