Class SoEnvironment

  • All Implemented Interfaces:
    SafeDisposable

    public class SoEnvironment
    extends SoNode
    Global environment node. This node describes global environmental attributes such as ambient lighting, light attenuation, ambient occlusion and fog.

    Ambient light (ambientIntensity and ambientColor) is the amount of global light impinging on each surface point when the lighting model is Phong (see SoLightModel). The ambient light values effectively specify a minimum brightness for all shapes. Even if no light source is directly shining on a surface, the ambient component will light up the surface a little bit to prevent it from being pure black.

    Light attenuation (attenuation) is the loss of light intensity over distance. The greater the distance from the light source, the lower the intensity. Attenuation affects all subsequent Point and Spot lights in a scene (see SoLight). See attenuation field for more details.

    Ambient occlusion (ambientOcclusion) is a rendering effect that simulates how much of the global ambient light can reach different parts of a shape. Parts that are less exposed to the ambient light, i.e. more occluded, will appear darker. This effect is very useful to better discern the shapes of objects. The ambientOcclusion field controls this effect for shape nodes other than SoVolumeRendering and point sets. (although point sets can "generate" ambient occlusion). SoVolumeRendering also supports ambient occlusion, but it must be enabled using an SoVolumeRenderingQuality node.
    Ambient occlusion limitations:

    • Important performance penalty can be experienced on Intel HD and UHD Graphics integrated GPU

      No Ambient Occlusion Ambient Occlusion
      Example with a lineset extracted from a DTI

    Fog has one of four types, each of which blends each surface point with the specified fog color (usually set equal to the rendering window background color). Each type interprets the fogVisibility field to be the distance at which fog totally obscures objects. A fogVisibility value of 0 (the default) causes the SoEnvironment node to set up fog so that the visibility is the distance to the far clipping plane of the current camera. Using a fog of type HAZE results in a linear fog between the fogStart value and the fogVisibility value.

    File format/default:

    Environment {

      ambientIntensity 0.2
      ambientColor 1 1 1
      attenuation 0 0 1
      ambientOcclusion false
      ambientOcclusionIntensity 1.0
      ambientOcclusionRadius 4.0
      fogType NONE
      fogColor 1 1 1
      fogStart 0
      fogVisibility 0
    }

    Action behavior:

    SoGLRenderAction
    Sets the current environment parameters to those specified with this node. Successive geometries will be rendered using this environment. Sets: SoEnvironmentElement, SoLightAttenuationElement

    See Also:
    SoLight, SoLightModel
    • Field Detail

      • ambientIntensity

        public final SoSFFloat ambientIntensity
        Intensity of ambient light (for Phong lighting). Default is 0.2.
      • ambientColor

        public final SoSFColor ambientColor
        RGB color of ambient lighting (for Phong lighting). Default is 1, 1, 1.
      • attenuation

        public final SoSFVec3f attenuation
        Squared, linear, and constant light attenuation coefficients (in that order). Default is 0, 0, 1. So, by default, no attenuation is applied.

        Attenuation only applies to Point and Spot lights. In the physical world attenuation is proportional to 1/d^2, where 'd' is the distance from the surface to the light source. However, this function causes the light to decrease very rapidly, so linear and constant coefficients can also be specified. The attenuation factor applied to the light is 1 / (c0*d^2 + c1*d + c2).

      • ambientOcclusion

        public final SoSFBool ambientOcclusion
        If set to true, ambient occlusion is activated. Default is false

        Limitation:

        • Important performance penalty can be experienced on Intel HD and UHD Graphics integrated GPU

        Since:
        Open Inventor 10.2

      • ambientOcclusionIntensity

        public final SoSFFloat ambientOcclusionIntensity
        Intensity of ambient occlusion: the higher the value, the darker the scene. Default is 1.0.

        Note: This field is "global", which means that if you have multiple instances of SoEnvironment node, any change in the intensity field of one instance will automatically be applied to the intensity field of the other instances. As a result, the intensity of the ambient occlusion is the same for the whole scene

        Since:
        Open Inventor 10.10

      • ambientOcclusionRadius

        public final SoSFFloat ambientOcclusionRadius
        Specifies the radius of the "sphere" (in world space) beyond which the ambient occlusion has no more effect. Default is 4.0.

        Note: This field is "global", which means that if you have multiple instances of SoEnvironment node, any change in the radius field of one instance will automatically be applied to the radius field of the other instances. As a result, the radius of the ambient occlusion is the same for the whole scene.

        Since:
        Open Inventor 10.10

      • fogColor

        public final SoSFColor fogColor
        Fog color. Default is 1, 1, 1.
      • fogStart

        public final SoSFFloat fogStart
        Distance at which the linear fog HAZE starts to be applied. Default is 0. Between fogStart and fogVisibility, the HAZE fog is linear, and beyond the fogVisibility distance, the fog totally obscures objects. This field has no effect on other types of fog.
      • fogVisibility

        public final SoSFFloat fogVisibility
        Fog visibility distance, which is the distance at which fog totally obscures objects. Default is 0. A value of 0 (the default) causes the SoEnvironment node to set up fog so that the visibility is the distance to the far clipping plane of the current camera.
    • Constructor Detail

      • SoEnvironment

        public SoEnvironment()
        Creates an environment node with default settings.