Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!sgi!tarolli@dragon.SGI.COM From: tarolli@dragon.SGI.COM (Gary Tarolli) Newsgroups: comp.sys.sgi Subject: Re: (none) Summary: regarding shading a multi-colored surface using a lighting model Keywords: SGI Message-ID: <26215@sgi.SGI.COM> Date: 6 Feb 89 15:26:40 GMT References: <27497@bu-cs.BU.EDU> Sender: daemon@sgi.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 34 In article <27497@bu-cs.BU.EDU>, tjh@bu-cs.BU.EDU (Tim Hall) writes: > We recently got a (Demo model) Personal Iris 4D that has a 32 bit frame > buffer and a Z-buffer. I would like to create a 3-D surface mesh that > has a different color at each vertex and is shaded by some lighting model > I've defined using lmdef. > > I've been able to get my colored surface using the bgntmesh, v, cpack and > endtmesh commands but it is not shaded by my defined lighting model. If > I bind a material when rendering the surface it renders as that material > (Not multi-colored) but it is shaded by my bound lighting model. > > So is it the case that interpolation of color and shading are mutually > exclusive? > > Thanks > Tim Hall > Please reply to > tjh@dolphin.bu.edu there is currently 2 wasy to do this , performance being the difference. The basic idiea is that you must change the material for every polygon. There are 2 wasy to do this, you can define many materials and then switch materials using lmbind (which is fairly fast for a small set of materials - but it uses a hash table lookup so for many many materials it may be slower) , or 2) you can change the current material using lmdef for each polygon. In a future release a new command will be added to exactly solve this problem. It will allow you to very quickly change one of the color properties of the current material (eg. AMBIENT, DIFFUSE, SPECULAR) without really changing the material, ie it changes only a working copy of the material). The new command is lmcolor and you can expect it in the 3.2 release. So in the meantime, just use one of the other methods. They are slower, but not that slow.