Re: Question about materials.

Bernie Roehl ([email protected])
Tue, 17 Oct 1995 06:20:12 -0400


Patrick Sweeney writes:
> How do the ambientColor,
> difsuseColor, specularColor, and shininess fields relate to the standard
> Phong illumination model? I am using:
> red = ambientColor[0] + difsuseColor[0] * dotproduct(L,N) +
> specularColor[0] * cos(theta) ^ shininess.

[same for other colors]

That looks right. There should be a "+ emissiveColor[0]" in there as well,
of course, and the difsuse and specular colors are actually sums of the
results from all the lights. And each of them are scaled by the light's
[0]'th color component. Once there's an Environment node, the
ambientIntensity and ambientColor[0] fields from that node would be used to
scale the material's ambientColor[0] value.

> Also, I have been computing the color of a light as:
> red=intensity*color[0]
> green=intensity*color[1]
> blue=intensity*color[2]

That looks right to me.

So...

red = emissiveColor[0]
+ ambientColor[0] * env.ambientColor[0] * env.ambientIntensity
+ difsuseColor[0]
* sum { light[i].inten * light[i].color[0] * dotproduct(L, N) }
+ specularColor[0]
* sum { light[i].inten * light[i].color[0] * cos(theta) ^ shininess }

Of course, that's not the way it would be coded; still, that should be the
basic lighting equation.

Caveat reader: it's 5 am where I am, so everything I'm saying may well be
complete nonsense. Corrections welcome.

-- 
   Bernie Roehl
   University of Waterloo Dept of Electrical and Computer Engineering
   Mail: [email protected]    Voice:  (519) 888-4567 x 2607 [work]
   URL: http://sunee.uwaterloo.ca/~broehl

  • Next message: [email protected]: "Midwest VR Users Group"
  • Previous message: Master Zap: "Re: ADMIN: VRML + JAVA - A Wedding"
  • Maybe in reply to: Patrick Sweeney: "Question about materials."