Lighting (Rob Laddish)
A typical pool hall might have one or 2 lights above the pool table. We have modeled
2 spotlights over the pool table. This keeps the table well lit, and allows multiple
shadows to enhance depth cues.
Problems Encountered
There are many parameters associated with lighting, and tuning is very difficult.
For example, we have edges on the pool table that drop down to the floor. We would
like the lighting effect to cause the upper parts of the side of the table to be
brighter than the lower sections. This may cause us to introduce additional lighting
sources, so the edges are light with ambient light.
Likewise, how high should the spotlights be, how wide should the cone of light be,
how much should the light drop off to the outside of the cone, and how will this
affect lighting conditions on the table? I've put all the lighting parameters in
a text config file, so changing these values is easy and doesn't require a recompile.
However, I've found that this is not easy enough. Run time modification is required
when changing multiple dependant parameters. If we have enough time, we plan on
displaying multiple sliders that allow adjustment in real time. I've spent a lot of
time "tuning", and on-line modifications would reduce the tuning time dramatically.
It would also make it easier to understand how the parameters interact.
Related config file parameters: (the config file explains them better)
- lmodel num ar,ag,ab at1,at2,at3 local twoside This defines the lighting
model used for the entire scene. The lmodel defined last is the only one used.
A future modification would be to associate different light models with each
light source or object or to allow the user to select the light model at
run time. num is the number of the model (ignored). ar,ag,ab are the rgb values
for ambient light; at1,at2,at3 are the constant, linear, and square light
attenuation values; local should be set to 1.0 for local lights like our
spotlights, and twoside allows us to light both sides of polygons.
- light num exp spread dx,dy,dz x,y,z,w ar,ag,ab r,g,b This is used to
define individual lights for the entire scene. exp defines how the light drops
off when we reach the edge of the spotlight cone, spread defines the angle of
the cone, dx,dy,dz gives the direction of the light; x,y,z,w gives the location
of the light; ar,ag,ab specifies the ambient rgb values; and r,g,b specifies
the lights rgb values.
- material num alpha shiny ar,ag,ab dr,dg,db er,eg,eb sr,sg,sb. This
parameter defines a material to be used for each of the objects. Alpha
specifies the alpha transparency, and shiny the materials shininess. ar,ag,ab
are the ambient rgb values; dr,dg,db are the diffuse rgb values; er,eg,eb
are the emmisive rgb value; and sr,sg,sb are the specular rgb values. The
material is bound to the number, and objects such as felt, bumpers, etc.
have an entry in their configuration lines that require this number. They can
use the number 0 to disable the material for that object.
- material2 num alpha shiny r,g,b amb% dif% emm% spec% This gives an
alternate and easier way to define simple materials. rgb specifies the rgb
parameters of the light, and amb%, dif%, emm%, spec% are percantage values
that are multiplied by rgb to define their rgb values.
- use_light num This defines the lighting mode. Set num=0 to turn it off,
or set num>0 or do not specify num to turn lighting on. Lighting is on by
default.
See Also: