Si no me equivoco, todo depende del Appearance que le des a la esfera.

No he usado Java3D, pero chusmeando la API, encontras lo siguiente:
Las fuentes de luz, solo afectan a la superficies de objetos que
absorban o reflejen dicha luz.
La superficie de cada objeto tiene ciertas propiedades del tipo
Material, que es la que define como es afectada la superficie del
objeto por la luz. Estas propiedades del material las definis en la
clase 'Material'. Esta clase Material es parte del 'Appearance'.

Con lo cual cuando creas una esfera usando:
Sphere sphere1 = new Sphere()
Sphere sphere2 = new Sphere(rad)
Ambas se crean con un Appearance por default que ya tiene definido el
Material para reflejar la luz.

Pero si vos seteas un Appearance, tendrias que definirle al mismo un
Material. Si el Material de un Appearance esta seteado a null, la luz
no afectara al objeto de ninguna manera.
"Material - defines the appearance of an object under illumination,
such as the ambient color, diffuse color, specular color, emissive
color, and shininess. These attributes are defined in a Material
object."

Appearance appearance = new Appearance();
appearance.setMaterial(material)


"The properties that can be set for a Material object are:

* Ambient color - the ambient RGB color reflected off the surface of
the material. The range of values is 0.0 to 1.0. The default ambient
color is (0.2, 0.2, 0.2).

* Diffuse color - the RGB color of the material when illuminated. The
range of values is 0.0 to 1.0. The default diffuse color is (1.0, 1.0,
1.0).

* Specular color - the RGB specular color of the material
(highlights). The range of values is 0.0 to 1.0. The default specular
color is (1.0, 1.0, 1.0).

* Emissive color - the RGB color of the light the material emits, if
any. The range of values is 0.0 to 1.0. The default emissive color is
(0.0, 0.0, 0.0).

* Shininess - the material's shininess, in the range [1.0, 128.0] with
1.0 being not shiny and 128.0 being very shiny. Values outside this
range are clamped. The default value for the material's shininess is
64.

* Color target - the material color target for per-vertex colors, one
of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, or AMBIENT_AND_DIFFUSE. The
default target is DIFFUSE.Material(material);
"

Todo sacado de: http://download.java.net/media/java3d/javadoc/1.5.1/index.html
Clases Sphere, Light, Material, Appearance.

Espero que te sirva!

De todas maneras, como te dije, no he usado la Java 3D, y no he
escuchado buenos comentarios con respecto a la misma. Asi que si no
estas muy avanzado en lo que estes haciendo, quizas te convenga
averiguar por otras opciones. Como las opciones que recomienda Abel.

Saludos,

Marcos.
_______________________________________________
Lista de correo Programacion.
[email protected]
http://listas.fi.uba.ar/mailman/listinfo/programacion

Responder a