Tutorial 5 - lighting
Lighting provides a key element to rendering more realistic 3D images. Without lighting all of our 3D Geos fall into the category of 'flat shading', meaning that the solid objects are filled with one color there is nothing to help describe the shape of the object. Lights help give more information about an object and how it fits into 3D space

The first type of light is the 'world_light', this light source produces non-localized light that travels an infinite distance and in parallel lines. That might sound confusing but think of it as a sun that never moves or sets. Turn the lighting on in the world_light subpatch by toggling on the 'lighting $1' message. This turns on lighting for the entire 3D world, and you should see the effects of the world_light when the light is switched on. The world_light only has one adjustment for color so change the color to see the effects of the world_light in out 3D scene. Notice how changing the color of the light differs from changing the color of the object itself.
The sphere patcher contains a sphere Geo that has two arguments and inlets, the middle inlet is the size of the sphere and the right one is how many 'slices' along the z axis are used to make the sphere (basically the higher the number the more triangles used). The rotate and translate controls help illustrate the effects of lighting on 3D surfaces. The order of the two controls is important here, and by placing the rotate before the translate we can alter the location relative to origin and thus affect the rotation. Try this: rotate the sphere with the translate set to 0 0 0, and the sphere rotates in place. Now change the translate to 1 1 0 and rotate the sphere, it rotates around the origin at the distance specified by the translate. Keep this in mind when designing patches of your own.
The third subpatch has a render chain for a local light source, which, unlike the world light, can actually move around the 3D space. Open that patcher and turn on the gemhead and light object. Also, turn off the world_light in it's subpatch so the effects of the local light are clearer. The local light can move and rotate just like a Geo so translate the light to 1 1 1 and rotate it. This local light moves across the surface of the sphere just like taking a lamp or flashlight and moving around a stationary object in real life. Take note of how changing the position of the light relative to the object affects the brightness and amount of light cast on the object. The local light also can change colors just like the world_light. Turn the world light back on and experiment with lighting the object from two different sources using two colors.