---
name: "SoEnvironment"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SoEnvironment/3iv"
---

# SoEnvironment(3iv)

global environment node

## NAME

SoEnvironment — global environment node

## INHERITS FROM

SoBase \> SoFieldContainer \> SoNode \> SoEnvironment

## SYNOPSIS

**#include \<Inventor/nodes/SoEnvironment.h\>**

**enum FogType {** **SoEnvironment::NONE**	No fog\
 **SoEnvironment::HAZE**	Linear increase in opacity with distance\
 **SoEnvironment::FOG**	Exponential increase in opacity\
 **SoEnvironment::SMOKE**	Exponential squared increase in opacity\
 **}**

Fields from class SoEnvironment:

**SoSFFloat**	**ambientIntensity**\
 **SoSFColor**	**ambientColor**\
 **SoSFVec3f**	**attenuation**\
 **SoSFEnum**	**fogType**\
 **SoSFColor**	**fogColor**\
 **SoSFFloat**	**fogVisibility**

Methods from class SoEnvironment:

	**SoEnvironment()**\
 **static SoType**	**getClassTypeId()**

Methods from class SoNode:

**void**	**setOverride(SbBool state)**\
 **SbBool**	**isOverride() const**\
 **SoNode \***	**copy(SbBool copyConnections = FALSE) const**\
 **virtual SbBool**	**affectsState() const**\
 **static SoNode \***	**getByName(const SbName &name)**\
 **static int**	**getByName(const SbName &name, SoNodeList &list)**

Methods from class SoFieldContainer:

**void**	**setToDefaults()**\
 **SbBool**	**hasDefaultValues() const**\
 **SbBool**	**fieldsAreEqual(const SoFieldContainer \*fc) const**\
 **void**	**copyFieldValues(const SoFieldContainer \*fc, SbBool copyConnections = FALSE)**\
 **SbBool**	**set(const char \*fieldDataString)**\
 **void**	**get(SbString &fieldDataString)**\
 **virtual int**	**getFields(SoFieldList &resultList) const**\
 **virtual SoField \***	**getField(const SbName &fieldName) const**\
 **SbBool**	**getFieldName(const SoField \*field, SbName &fieldName) const**\
 **SbBool**	**isNotifyEnabled() const**\
 **SbBool**	**enableNotify(SbBool flag)**

Methods from class SoBase:

**void**	**ref()**\
 **void**	**unref() const**\
 **void**	**unrefNoDelete() const**\
 **void**	**touch()**\
 **virtual SoType**	**getTypeId() const**\
 **SbBool**	**isOfType(SoType type) const**\
 **virtual void**	**setName(const SbName &name)**\
 **virtual SbName**	**getName() const**

## DESCRIPTION

**This node describes global environmental attributes such as ambient lighting, light attenuation, and fog.**

**Ambient lighting is the amount of extra light impinging on each surface point when the lighting** **model is Phong (see SoLightModel**).

Light attenuation affects all subsequent lights in a scene (see **SoLight**). It is a quadratic function of distance from a light source to a surface point. The three coefficients are specified in the **attenuation** field. Attenuation works only for light sources with a fixed location, such as point and spot lights.

Fog has one of four types, each of which blends each surface point with the specified fog color. Each type interprets the **visibility** field to be the distance at which fog totally obscures objects. A **visibility** 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.

Note that this node has effect only during rendering, and that it does not inherit field values from other **SoEnvironment** nodes.

## FIELDS

**SoSFFloat**	**ambientIntensity**\
 **SoSFColor**	**ambientColor**\
 Intensity and RGB color of ambient lighting (for Phong lighting).

**SoSFVec3f**	**attenuation**\
 Squared, linear, and constant light attenuation coefficients (in that order) with respect to distance of light from surface (for Phong lighting).

**SoSFEnum**	**fogType**\
 **SoSFColor**	**fogColor**\
 **SoSFFloat**	**fogVisibility**\
 Type of fog, color of fog, and visibility distance, which is the distance at which fog totally obscures objects.

## METHODS

	**SoEnvironment()**\
 Creates an environment node with default settings.

**static SoType**	**getClassTypeId()**\
 Returns type identifier for this class.

## ACTION BEHAVIOR

**SoGLRenderAction**\
 Sets the current environment parameters to those specified with this node. Successive geometries will be rendered using this environment.

## FILE FORMAT/DEFAULTS

```
Environment {
ambientIntensity	0.2
ambientColor	1 1 1
attenuation	0 0 1
fogType	NONE
fogColor	1 1 1
fogVisibility	0
}
```

## SEE ALSO

**SoLight, SoLightModel**
