[comp.sys.sgi] Lighting and Shading Hints for the 4D...

zyda@NPS-CS.ARPA (michael zyda) (03/17/88)

     Chapter 14 of the IRIS User's Guide on the IRIS 4D describes the
lighting and shading software available on that system. It is a pretty
terse but not bad description of that software and the only thing
missing is a working sample program. I requested over the net if
anyone had a sample they could send me and got no replies. I called
a few friends at SGI and eventually got some sample programs.
There is one subtlety that is easily missed. The lighting software
runs in RGB mode. On the IRIS 4D/70G, one can run this mode
in a double-buffered, z-buffered fashion. If you do this, the
software splits the available bit planes so that you only have
12 bits for color specification. This is important to remember
when you turn on the lighting and shading software.

     If you put in a local viewer or a local light source and use
double-buffered RGB, you get a serious banding effect on the filled
polygons. It looks like you are doing something wrong with the
lighting software. 

     The fix to this came to me upon examination of the IRIS 4D samples
sent me by people at SGI. All of the samples had a menu option to
freeze the picture, i.e. put the system into singlebuffer mode
and then redraw the picture with the lighting routines on.
The pictures generated this way lose their banding.

     Another hint is that you may need to set the normal vector for
every square of your underlying checkerboard and not just once at the
top of your checkerboard generation loop. If you have an infinite
light source and an infinite viewer and only set the normal once,
you get a single colored checkerboard.

     Michael Zyda
     Naval Postgraduate School