TBD. Some notes follow ...

pre-built shaders, rgb, multiple spheres lit various ways. ambient, directional light source, shiny-ness. Point light source, Multiple light sources. uniform variables.


A Skin is how we color the various triangles for a mesh. A skin can be as simple as a solid color, or a complex, layered mix of solid colors, bitmap images and shaders. The mesh incorporates mapping coordinates that specify how to cut and fold the skin onto the mesh, much like using a pattern to cut and sew cloth into a dress.

In a later chapter, we will dive more deeply into this topic. With the earth, we wrapped a bitmap image of an earth map cylindrically around the sphere mesh.


Now, let's talk about light and color.


A specific color is specified using the Color type, specifying its red, green, blue and alpha values. Each of these is a Float number from 0 to 1.

The alpha value indicates the color's transparency. An alpha value of 1 means the color is fully transparent, and you can see right through it. An alpha value of 0.5 would be translucent. One could see the object blended together with whatever is behind it.

The Color type defines a few basic solid colors as constants, as demonstrated by Color::Gray (equivalent to Color[0.5, 0.5, 0.5, 0.]).

Light Sources

As already mentioned, if there is no source of light in a scene, everything looks black. In the sample scene, we lighted the scene with a dim white ambient light.

The Light type can be used to place various light sources within a scene. The light source itself is invisible (unless you attach an object to it), but it illuminates all objects in the direction the light shines, using the light's assigned color and brightness.

There are several types of lights:

shines outwards in all directions from a particular position, similar to a lightbulb or candle.
shines in one particular direction, much like sunlight.
shines a shaded cone in one direction from a point, much like three-point studio spotlights. The intensity of the illumination fades by distance.

Other than ambient light, light sources can be made to cast an object's shadow on other objects.