Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!mips!sgi!reuel@khaki.asd.sgi.com From: reuel@khaki.asd.sgi.com (Reuel Nash) Newsgroups: comp.sys.sgi Subject: Re: Interpolating Colors in Lighting Mode? Summary: yes, you've almost got it. Message-ID: <74135@sgi.sgi.com> Date: 5 Nov 90 17:47:10 GMT References: <3801@idunno.Princeton.EDU> Sender: guest@sgi.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 57 In article <3801@idunno.Princeton.EDU>, markv@gauss.Princeton.EDU (Mark VandeWettering) writes: > Is there any way to make the SGI interpolate colors AND perform shading > calculations at the same time? For instance, if I am drawing triangles > and wish to interpolate the colors, I do something like: > > lmcolor(LMC_DIFFUSE) ; > > .... > > bgnpolygon() ; > n3f(normal) ; /* some normal for the poly */ > c3f(c1) ; /* a color + vertex */ > v3f(v1) ; > c3f(c2) ; /* a color + vertex */ > v3f(v2) ; > c3f(c3) ; /* a color + vertex */ > v3f(v3) ; > endpolygon() ; > > But the resulting triangle, while shaded, only has a single flat color. > > Any ideas? > > mark (markv@acm.princeton.edu) > Mark VandeWettering > markv@acm.princeton.edu The command that triggers lighting calculations depends a lot on what lighting modes you're in. The above code will do what you want in a local lighting or local viewer mode, since lighting calculations are done by the v3f() call. You must not be using any local lights or viewer, however. In the infinite model, lighting calculations are done by the n3f() command, using the current "state" including the current color as set by the most recent c3f(). This code should work for you: lmcolor(LMC_DIFFUSE) ; .... bgnpolygon() ; c3f(c1) ; /* a color + vertex */ n3f(normal) ; /* some normal for the poly */ v3f(v1) ; c3f(c2) ; /* a color + vertex */ n3f(normal) ; /* some normal for the poly */ v3f(v2) ; c3f(c3) ; /* a color + vertex */ n3f(normal) ; /* some normal for the poly */ v3f(v3) ; endpolygon() ; Reuel Nash Email: reuel@sgi.sgi.com "Rendering? You mean like hogs?" Voicemail: (415)962-3254 Mail stop:SR-254 Work Phone:(713)266-1333 Home Phone:(713)589-6258 USMail: Silicon Graphics, 5858 Westheimer Suite 100, Houston, TX 77057