- All Implemented Interfaces:
- Direct Known Subclasses:
public class SoDirectionalLight extends SoLightNode representing a directional light source. This node defines a directional light source that illuminates along rays parallel to a given 3-dimensional vector.
A light node defines an illumination source that may affect subsequent shapes in the scene graph, depending on the current lighting model. Light sources are affected by the current transformation. A light node under an
SoSeparatordoes not affect any objects outside that separator. Lights may be grouped under an
SoGroupnode and still affect the rest of the scene graph. The viewer classes automatically create a directional light, called the headlight, that is automatically updated to shine in the same direction the camera is pointed.
You can also use a node kit to create a light; see the reference page for
The lighting model can be changed using an
SoLightModelnode. Effectively lighting is enabled by default (default model is PER_VERTEX_PHONG), but can be turned off by setting the lighting model to BASE_COLOR. In this case the object's diffuse color is used without modification. This can be useful for axes and annotations.
SoEnvironmentnode can be used to specify additional options related to lighting:
- The ambient light component of the Phong reflection model.
- Light attenuation for
- Ambient occlusion.
When lighting is enabled, the appearance of most geometry depends on the normal vectors specified (or computed) for the geometry. See
SoShapeHintsfor a discussion of normal computation and the concept of "crease angle". By default lighting is only computed for the "front" face of most geometry (there are some exceptions like
SoOrthoSlice). Which face is the front depends on the vertex ordering. Also see
SoShapeHintsto control vertex ordering and to enable "two sided" lighting. Lighting of line geometry is affected by the tangent values, if any, specified with
The color components specified for lights mean something different than for materials. For a light, the numbers correspond to a percentage of full intensity for each color. If the R, G, and B values for a light's color are all 1.0, the light is the brightest possible white. If the values are 0.5, the color is still white, but only at half intensity, so it appears gray. If R=G=1 and B=0 (full red and green with no blue), the light appears yellow. The intensity can also be modulated using the
For materials, the numbers correspond to the reflected percentages of those colors. So if R=1, G=0.5, and B=0 for a material, that material reflects all the incoming red light, half the incoming green, and none of the incoming blue light. In other words, if an OpenGL light has components (LR, LG, LB), and a material has corresponding components (MR, MG, MB), then, ignoring all other reflectivity effects, the light that arrives at the eye is given by (LR*MR, LG*MG, LB*MB). As a result, for example, shining a pure blue light on a pure red cone has no visible effect.
Similarly, if you have two lights that send (R1, G1, B1) and (R2, G2, B2) to the eye, the components are added, giving (R1+R2, G1+G2, B1+B2). If any of the sums are greater than 1 (corresponding to a color brighter than the hardware can display), the component is clamped to 1.
The maximum number of lights depends on the hardware, but at least eight simultaneous lights are supported.
on true intensity 1 color 1 1 1 direction 0 0 -1
Activates this light (if so specified) during traversal. All shape nodes that come after this light in the scene graph are illuminated by this light. The light's direction is affected by the current transformation. Sets:
Constructors Constructor Description
SoDirectionalLight()Creates a directional light source node with default settings.
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
public final SoSFVec3f directionIllumination direction vector.