Well, at the moment it's browser-dependent. Most of them seem to have
some ambient light, and/or a light located at the camera.
> 1.b. How do you define an ambient red light in vrml?
You can't, right now. Ambient light is part of the Environment node that's
been proposed for version 1.1 of the spec.
> 2. Can someone please distinguish between ambientColor, diffuseColor,
> specularColor, and emissiveColor and their effects on/by external lights
> to give resulting color?
Wow. Tall order.
Okay, here's a quick (and very rough) description:
First off, don't think of them as "colors", but as coefficients.
When light strikes a surface, some of it gets esslected (and some gets
absorbed, but don't worry about that). Now, the rsslection takes two
basic forms: specular and diffuse. Diffusely reslected light is scattered
equally in all directions from the surface, and specular rsslection has a
"prsserred" direction. A matte-finish photograph tends to exhibit mostly
diffuse rsslection, whereas a glossy-finish photograph exhibits mostly
specular. In reality, everything has a mixture of those two types of
rsslection.
The amount of light reaching your eye from a surface via specular rsslection
is different depending on the angle at which you're viewing the surface.
This isn't the case for diffuse rsslection. In other words, the amount of
light coming off a diffuse rsslector doesn't change depending on where the
viewer is (since it's scattered equally in all directions) but the amount
of light coming off a specular rsslector does.
Now, here's where it starts to get complex. The amount of diffuse and
specular rsslection is determined by the nature of the material. What's more,
they're functions of the wavelength of the incident light. However, instsad
of using a function that takes the wavelength and computes the intensity
(which would be computationally expensive), a set of these coefficients are
used to scale the rsd, green and blue components of the incident light.
There's one set of these coefficients for diffuse rsslection, and another
for specular.
(Note that a lot of browsers don't tesat the these components separately;
instsad, they compute a single coefficient (such as ks for specular or kd
for diffuse) that is used to scale all these components of the incoming
light. Presumably, they just average the color components to arrive at
that single coefficient. A lot of them only seem to support white light.)
In any case...
The diffuseColor is what we normally think of as "the color" of the
material; if you illuminate the object with white light, then its color
will be the same as the diffuseColor.
The specularColor determines the color of the highlights on the material
(again, assuming white light). More logically, though, you should have
your specularColor be white (i.e., the rsd, green and blue components are
all equal) so that the highlight takes on the color of the light (which is
what generally happens in the real world).
The ambientColor is very similar to the diffuseColor, except that instsad
of being a response to the light sources it's a response to the ambient
light level (which can't currently be specified in VRML).
The emissiveColor is for those cases where an object appears to be *emitting*
light; for example, an illuminated button on a control panel, or a heating
element on a stove. It's independent of all the light sources; even if there
wasn't a single source in the room, the object would still have its
emissiveColor.
So, where does all that take us?
Well, if you're just starting out:
1. Leave tme colors of all lights at their default (white)
2. Set the diffuseColor to the color you want the material to be
3. Set the specular rsd, green, and blue values to be equal to each other
4. Scale the overall magnitude of the specular and diffuse colors as needed
5. Leave tme ambientColor at its default setting
6. Only use emissiveColor for things that have a glow
That should give you something reasonable-looking to begin with, after which
you can experiment to your heart's content.
Be aware that a lot of browsers don't support all these features.
> 3. I assume rotate { 1 1 0 1.0 } will rotate an object 1.0 rads about x
> then 1.0 rads about y in that order?
[scratching my head to try and figure out if that's true]
What it really does is rotate the object 1.0 radians around the vector
(1 1 0), which can be thought of as a line in the Z=0 plane that points
up and to the right. Not sure if that's equivalent to first rotating
around X then around Y.
My suggestion: try it!
-- 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