Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!mips!sgi!shinobu!odin!cashew.asd.sgi.com!kurt From: kurt@cashew.asd.sgi.com (Kurt Akeley) Newsgroups: comp.sys.sgi Subject: Re: Interpolating Colors in Lighting Mode? Message-ID: <1990Nov5.165452.12567@odin.corp.sgi.com> Date: 5 Nov 90 16:54:52 GMT References: <3801@idunno.Princeton.EDU> Sender: news@odin.corp.sgi.com (Net News) Reply-To: kurt@cashew.asd.sgi.com (Kurt Akeley) Organization: sgi Lines: 48 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? You've run into a bug/feature of non-VGX systems. Prior to the VGX, IRIS systems did infinite lighting computations only when a new normal was passed, rather than for each vertex. When lmcolor() was introduced some of the problems with this "short cut" were corrected, some were documented, and others, such as yours, were missed altogether. I tried your code on a GTX and it failed just as you described, because the GTX does only a single lighting calculation. On my VGX things worked just fine. To solve the problem on all machines, simply call v3f() prior to drawing each vertex: bgnpolygon(); c3f(c1); n3f(normal); v3f(v1); c3f(c2); n3f(normal); v3f(v2); c3f(c3); n3f(normal); v3f(v3); endpolygon(); I will file a bug against machines that exhibit this behavior. Thanks. -- kurt