| | |
- Material
class Material |
| |
Node specifying rendering properties affecting the lighting model
The Material node specifies a set of properties which affect
the lighting model applied to the geometry during rendering.
The Material node should be managed by surrounding Appearance
node (which should in turn be managed by a surrounding Shape
node).
Attributes of note within the Material object:
diffuseColor -- the "base" color of the material, reflects
light from OpenGL lights based on the normals of the
geometry.
emissiveColor -- the "glow" color of material, present even
if there's no light in the scene
specularColor -- determines the color of highlights
ambientIntensity -- a fraction of the diffuseColor reflected
from the surface based on the ambient (background)
lighting in the scene. Note: OpenGL is capable of
creating ambient lighting that is not tied to diffuseColor,
this definition is taken from the VRML 97 specification.
shininess -- determines the softness and size of highlights,
higher values make the highlights smaller and sharper.
transparency -- the inverse of alpha, higher values make the
geometry more transparent. Any non-zero transparency value
will force the use of the transparent sorted geometry
algorithm, which could be a considerable performance hit
for large models.
Reference:
http://www.vrml.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#Material |
| |
- __init__(self, diffuseColor=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004), transparency=0, ambientIntensity=0.20000000000000001, emissiveColor=(0, 0, 0), shininess=0.20000000000000001, specularColor=(0, 0, 0))
- render(self)
- Called by the Appearance node, returns whether we are transparent or not
- set_ambientIntensity(self, value)
- Set VRML-style ambient intensity (multiplier of diffuse color, range 0 to 1)
- set_diffuseColor(self, (r, g, b))
- Set VRML-style diffuse color (range 0.0 to 1.0) three components
- set_emissiveColor(self, (r, g, b))
- Set VRML-style emissive color (range 0.0 to 1.0) three components
- set_shininess(self, value)
- Set VRML-style shininess (range 0 to 1) float value
- set_specularColor(self, (r, g, b))
- Set VRML-style specular color (range 0.0 to 1.0) three components
- set_transparency(self, value)
- ## Note: the numbers used here are wrong according to the OpenGL man pages,
## they should be from -1 to +1, but using those numbers just gives you
## black objects for all but the brightest colours.
| |