home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sgi / 12289 next >
Encoding:
Text File  |  1992-08-12  |  2.6 KB  |  56 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!hal.AVS.COM!joe
  3. From: joe@avs.com (Joe Peterson)
  4. Subject: GL lighting problem
  5. Organization: Advanced Visual Systems Inc.
  6. Message-ID: <1992Aug12.120510.5556@ctr.columbia.edu>
  7. Sender: news@ctr.columbia.edu (The Daily Lose)
  8. X-Newsreader: Tin 1.1 PL4
  9. Date: Wed, 12 Aug 1992 12:05:10 GMT
  10. X-Posted-From: hal.avs.com
  11. X-Posted-Through: sol.ctr.columbia.edu
  12. Lines: 42
  13.  
  14. Hi!  After working with GL for some time now, I have a burning question about
  15. lighting.  I have thought this problem through, and I just cannot think of
  16. a good way around the problem, while at the same time I cannot believe there
  17. is not a solution!
  18.  
  19. There seems to be a mismatch between our lighting model and GL's.  Ours uses
  20. coefficients for all lighting properties (diffuse, ambient, specular, etc.)
  21. plus object and light colors.  When the lighting is done, the object's and/or
  22. light's color are combined with the appropriate coefficients to light the
  23. object.  Often we have vertex-colored triangle strips (each vertex is colored,
  24. and the colors are interpolated across the triangles), and we want to be
  25. able to adjust the diffuse, ambient, and specular coefficients separately.
  26.  
  27. GL, however, has the notion of diffuse COLOR, ambient COLOR, etc.  This
  28. really throws me, since it seems to me that the COLOR and the COEFFICIENT
  29. should be separate.  That is, you should be able to set the diffuse &
  30. ambient coefficients and then go about coloring your triangles.
  31.  
  32. When I want to draw a bunch of shaded, colored triangles (with a color per
  33. vertex), I do a c3f(), an n3f(), and a v3f() to pass the color, normal, and
  34. vertex.  What I want to adjust the ambient coefficient of the model I am
  35. rendering?  I don't see a way to do this unless I actually multiply each
  36. color component by my ambient coefficient FOR EVERY VERTEX (pretty time
  37. consuming!).
  38.  
  39. What I do as a compromise to all of this is set lmcolor to LMC_AD.  Then
  40. I set the ambient light intensity to 0.3 times the intensity the user
  41. wants.  This has the effect of giving me ambient and diffuse lighting that
  42. matches the object's color.  Unfortunately, the user cannot adjust the
  43. ambient coefficient on a per-object basis.  In the vertex-colored case,
  44. the user cannot adjust the diffuse coefficient either!
  45.  
  46. Has anyone else run into this problem?  If your application's lighting model
  47. follows the GL model (i.e. lets the user set the diffuse and ambient COLOR
  48. for an object), there would be no problem.  But hoe does one deal the the
  49. vertex-colored case?
  50.  
  51. Am I missing something obvious?  Please respond via email...  I may miss it
  52. in this newsgroup!
  53.  
  54.                 Thanks!  Joe Peterson
  55.                 joe@avs.com
  56.