Extensible 3D (X3D)
Part 1: Architecture and base components

Fog component (Proposed)

Existing Component Name: xj3d_Fog
--- X3D separator bar ---

cube 1. Introduction

1.1 Name

The name of this component is "Fog". This name shall be used when referring to this component in the COMPONENT statement (see 7.2.5.4 Component statement).

1.2 Overview

This clause describes the Fog component of this part of ISO/IEC 19775. This includes how additional fog effects are defined as well as how fog effect the rendered image. Table 1 provides links to the major topics in this clause.

Table 1 — Topics

cube 2 Concepts

2.1 Overview

24 Environmental Effects defines a basic global fog that applies to all objects when bound. This component provides additional fog extensions that provide the ability to define local fog effects that override the global effects when defined. Global fog uses the computed screen distance of the camera from the vertex to calculate the fog amount. This component allows the user to provide a per-vertex explicit value of the fog. This is typically known as Volumetric Fog.

This specification provides the ability to define local fog effects on a per-object or per-group basis, as well as the ability to change the computed fog depth on a per-vertex basis for nodes descended from X3DComposedGeometryNode.

2.2 Local Fog Semantics

2.2.1 Scoping Of Local Fog

When a LocalFog node is to be applied, it shall effect only objects that are in the same transformation hierarchy as the fog. This allows for the creation of realistic effects such as a single room smoke-filled room inside a larger building. If a local fog and a global fog is defined and active, the lighting contribution from the local fog shall be used instead of the global effect.

Local fog effects shall not effect nodes derived from X3DBackgroundNode.

2.2.2 Local and Bindable Fog Interaction

If a global Fog node is bound and a LocalFog node is enabled, the LocalFog node shall have precedence over the globally bound fog, in determining the fog colour contribution to the lighting equations defined in 17 Lighting component.

2.2.3 Fog Colour Calculation

If, during the traversal of the scene graph, more than one LocalFog node is encountered in the path from the root to a given leaf node, only the contribution of the LocalFog instance closest to the leaf node shall be used. All other fog values shall be ignored.

cube 3. Node Reference

3.1 FogCoordinate

FogCoordinate : X3DGeometricPropertyNode {
  MFFloat [in,out] depth     []     [0,1]
  SFNode  [in,out] metadata  NULL   [X3DMetadataObject]
}

This node defines a set of explicit fog depths on a per-vertex basis. This depth value shall be applied per-vertex and used to replace the automatically generated depth. Fog coordinates take precedence over implicitly generated depths; specifying fog coordinates will result in the implicit depth (visibilityRange) being ignored. Details on lighting equations can be found in 17.2.2 Lighting model.

One depth value per vertex shall be supplied. If the user does not provide sufficent, the last value defined will be replicated for any further vertices.

3.2 LocalFog

LocalFog : X3DFogNode {
  SFColor  [in,out] color           1 1 1    [0,1]
  SFBool   [in,out] enabled         TRUE
  SFString [in,out] fogType         "LINEAR" ["LINEAR"|"EXPONENTIAL"]
  SFNode   [in,out] metadata        NULL     [X3DMetadataObject]
  SFFloat  [in,out] visibilityRange 0        [0,-∞)
}

The LocalFog node provides a way to simulate atmospheric effects by blending objects with the colour specified by the color field based on the distances of the various objects from the viewer. The distances are calculated in the coordinate space of the LocalFog node. The visibilityRange specifies the distance in metres (in the local coordinate system) at which objects are totally obscured by the fog. Objects located outside the visibilityRange from the viewer are drawn with a constant colour of color. Objects very close to the viewer are blended very little with the fog color. A visibilityRange of 0.0 disables the LocalFog node. The visibilityRange is affected by the scaling transformations of the LocalFog node's parents; translations and rotations have no affect on visibilityRange. Values of the visibilityRange field shall be in the range [0,-∞).

The fogType field controls how much of the fog colour is blended with the object as a function of distance. If fogType is "LINEAR", the amount of blending is a linear function of the distance, resulting in a depth cueing effect. If fogType is "EXPONENTIAL," an exponential increase in blending is used, resulting in a more natural fog appearance.

The effect of fog on lighting calculations is described in 17 Lighting component.

cube 4 Support Levels

The Fog component provides a single level of support as specified in Table 2.

Table 2 — Fog component support levels

Level Prerequisites Nodes/Features Support
1 Core 1
Grouping 1
EnvironmentalEffects 2
FogCoordinate All fields fully supported.
LocalFog All fields fully supported.
--- X3D separator bar ---
[ Xj3D Homepage | Xj3D @ Web3d | Screenshots | Dev docs | Dev Releases | Contributors | Getting Started ]
Last updated: $Date: 2004-09-03 16:36:23 $