home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!hal.AVS.COM!joe
- From: joe@avs.com (Joe Peterson)
- Subject: GL lighting problem
- Organization: Advanced Visual Systems Inc.
- Message-ID: <1992Aug12.120510.5556@ctr.columbia.edu>
- Sender: news@ctr.columbia.edu (The Daily Lose)
- X-Newsreader: Tin 1.1 PL4
- Date: Wed, 12 Aug 1992 12:05:10 GMT
- X-Posted-From: hal.avs.com
- X-Posted-Through: sol.ctr.columbia.edu
- Lines: 42
-
- Hi! After working with GL for some time now, I have a burning question about
- lighting. I have thought this problem through, and I just cannot think of
- a good way around the problem, while at the same time I cannot believe there
- is not a solution!
-
- There seems to be a mismatch between our lighting model and GL's. Ours uses
- coefficients for all lighting properties (diffuse, ambient, specular, etc.)
- plus object and light colors. When the lighting is done, the object's and/or
- light's color are combined with the appropriate coefficients to light the
- object. Often we have vertex-colored triangle strips (each vertex is colored,
- and the colors are interpolated across the triangles), and we want to be
- able to adjust the diffuse, ambient, and specular coefficients separately.
-
- GL, however, has the notion of diffuse COLOR, ambient COLOR, etc. This
- really throws me, since it seems to me that the COLOR and the COEFFICIENT
- should be separate. That is, you should be able to set the diffuse &
- ambient coefficients and then go about coloring your triangles.
-
- When I want to draw a bunch of shaded, colored triangles (with a color per
- vertex), I do a c3f(), an n3f(), and a v3f() to pass the color, normal, and
- vertex. What I want to adjust the ambient coefficient of the model I am
- rendering? I don't see a way to do this unless I actually multiply each
- color component by my ambient coefficient FOR EVERY VERTEX (pretty time
- consuming!).
-
- What I do as a compromise to all of this is set lmcolor to LMC_AD. Then
- I set the ambient light intensity to 0.3 times the intensity the user
- wants. This has the effect of giving me ambient and diffuse lighting that
- matches the object's color. Unfortunately, the user cannot adjust the
- ambient coefficient on a per-object basis. In the vertex-colored case,
- the user cannot adjust the diffuse coefficient either!
-
- Has anyone else run into this problem? If your application's lighting model
- follows the GL model (i.e. lets the user set the diffuse and ambient COLOR
- for an object), there would be no problem. But hoe does one deal the the
- vertex-colored case?
-
- Am I missing something obvious? Please respond via email... I may miss it
- in this newsgroup!
-
- Thanks! Joe Peterson
- joe@avs.com
-