Class SoLight

  • All Implemented Interfaces:
    SafeDisposable
    Direct Known Subclasses:
    SoDirectionalLight, SoPointLight, SoSpotLight

    public class SoLight
    extends SoNode
    Abstract base class for all light source nodes. SoLight is the abstract base class for all light nodes. A light node defines an illumination source that may affect subsequent shapes in the scene graph, depending on the current lighting style. Light sources are affected by the current transformation. A light node under a separator does not affect any objects outside that separator.

    You can also use a node kit to create a light. See SoLightKit.

    An SoEnvironment node can be used to specify additional options related to lighting:

    • The ambient light component of the Phong reflection model.
    • Light attenuation for SoPointLight and SoSpotLight nodes.
    • Ambient occlusion.

    Lighting is enabled by default (default model is PER_VERTEX_PHONG). When lighting is enabled, there must be light nodes (e.g. SoDirectionalLight) in the scene graph for objects to be easily visible. When using the Open Inventor viewer classes (e.g. SoWinExaminerViewer), the viewer will create a "headlight" (directional light attached to the camera) if no other light nodes exist when setSceneGraph() is called.

    By default, lighting is only computed for the "front" faces of geometry, so the back face of the geometry will be dark. The front face is determined by the normal vector, if specified, or by the vertex ordering (see SoShapeHints) if normals are computed by Open Inventor. To enable "two sided" lighting (lighting both front and back faces) see SoShapeHints.

    The maximum number of lights depends on the hardware, but at least eight simultaneous lights are supported.

    File format/default:

    This is an abstract class. See the reference page of a derived class for the format and default values.

    Action behavior:

    SoGLRenderAction
    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.

    See Also:
    SoDirectionalLight, SoEnvironment, SoLightKit, SoLightModel, SoMaterial, SoPointLight, SoSpotLight
    • Field Detail

      • on

        public final SoSFBool on
        Determines whether the source is active or inactive. When inactive, the source does not illuminate at all.
      • intensity

        public final SoSFFloat intensity
        Illumination intensity of light source. Valid values range from 0.0 (no illumination) to 1.0 (maximum illumination).
      • color

        public final SoSFColor color
        Light source illumination color.