> Date:         Mon, 17 Mar 2003 12:39:10 -0800
> From: Monica Sleumer <[EMAIL PROTECTED]>
>
> I'm having a very strange problem with the colors in my scenegraph. I'm
> using a series of shape3Ds that all share the same appearance and
> geometry objects to save memory. The problem is, the majority of them
> reflect the specular color from one of their flat surfaces at all times.
>
> It doesn't matter where I put the light source - even if I put the
> directional light perpendicular to their flat surfaces, some of them
> will reflect the specular color anyways.

What results are you expecting?

Specular lighting effects depend upon the position/direction of the
light and the direction of the eye (position too if local eye is
enabled) relative to the surface normals, just like a mirror.

Often this is just an approximation to reality -- for more realistic
effects, especially with flat surfaces, you can increase the
triangulation density of the surface to provide more normals, and use a
local eye (this is broken in the 1.3 release of Java 3D, fixed in
1.3.1), or do shading at the pixel level.

A small image would be helpful to diagnose the problem.

> To make matters worse, for some reason the specular color is being
> rounded up to the nearest bright color. For instance, if I set the
> specular color to dark brown, most of my shapes will be bright yellow on
> one side. It really looks terrible. If I set it to dark green, they will
> be bright green on that side, etc.

The final result color adds in the diffuse/ambient color of the material
along with the specular material color and the colors of the lights,
modulated by the light and surface normals.  If local eye is enabled
then the specular components also take into account the vector to the
local eye position, otherwise the vector to the eye is assumed to be the
view direction.  See Section E.2 of the Java 3D Specification for the
complete lighting equations.

Material color components such as the ambient, diffuse, emmisive, and
specular can be overridden by vertex colors present in the geometry
arrays -- this is specified by setColorTarget() method of the Material
node component.

> I think it might be a GraphicsDevice-level problem, since the problem is
> not consistent across different operating systems.

There are some OpenGL issues with respect to the specular color when
applied to textured surfaces.  These are addressed by the
GL_EXT_separate_specular_color extension, but this extension is not
available from all vendors.  This could be the source of inconsistencies
between systems.  You might try the D3D version of Java 3D to see if
that works better for you.

Also, the apparent shape, intensity, and color of specular hightlights
can be greatly affected by the gamma correction of your monitor.  Make
sure they're all displaying the same gamma if you're trying to compare
specular highlighting effects.

-- Mark Hood

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to