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

34 Cube map environmental texturing component

# 34.1. Introduction

## 34.1.1 Name

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

## 34.1.2 Overview

This clause describes the cube map environmental texturing component of this part of ISO/IEC 19775. This includes how additional texturing effects are defined to produce environmental effects such as reflections from objects. Table 34.1 provides lists the major topics in this clause.

Table 34.1 — Topics

34.1 Introduction 34.1.1 Name 34.1.2 Overview 34.2 Concepts 34.2.1 Overview 34.2.2 Texture map formats 34.2.3 Texture map image formats 34.2.4 Texture coordinates 34.2.5 Texture orientation 34.3 Abstract types 34.3.1 X3DEnvironmentTextureNode 34.4. Node reference 34.4.1 ComposedCubeMapTexture 34.4.2 GeneratedCubeMapTexture 34.4.3 ImageCubeMapTexture 34.5 Support levels Figure 34.1 — Mapping texture sides to the texture coordinate axes Table 34.1 — Topics Table 34.2 — Environment Texturing component support levels

# 34.2 Concepts

## 34.2.1 Overview

Cube map environmental texturing provides cubic environmental texture mapping capabilities within X3D. Cubic environment maps support reflection and specular highlighting in a simple way, often in combination with automatic texture coordinate generation (see 18.2.3 Texture coordinates). This component may be combined with the multitexture abilities of the Texturing component (see 18.2.4 Multitexturing) to provide advanced visual effects.

Cubic environment maps ignore most of the normal texture settings (e.g., there are no repeat fields) but they can be mipmapped. The sources can be drawn from any 2D texture source whether dynamically generated or provided from somewhere else as images or pixel arrays.

## 34.2.2 Texture Map Formats

Cubic environment mapping nodes defined as part of this component use a collection of 2D texture maps to define each side of the cube. These may contain from one to four component colour values. The interpretation of the image shall follow the description in 18.2.1 Texture map formats.

All source images shall be square and provide source data in powers of two numbers of pixels. Source images in a cubic environment map shall have identical sizes. Providing differently sized images or rectangular images shall be an error.

EXAMPLE It is not valid to define the front image as a 64×64 image and the left side image as 128×128 pixels.

## 34.2.3 Texture Map Image Formats

Texture nodes that require support for 2D images file formats shall follow the description defined in 18.2.2 Texture map image formats.

## 34.2.4 Texture coordinates

For each texture, the three-dimensional texture coordinates (s,t,r) are treated as a direction vector from the local origin. Each texel drawn onto the geometry is treated as the texel in the environment map that is "seen" from this direction vector.

Texture coordinates for using cubic environment mapped textures are usually dynamically generated as this is far easier to handle for the content developer than providing explicit texture coordinates. It is recommended that an implementation shall also support a minimum of Level 2 Texturing component capabilities (see 18.5 Support levels) in addition to this component. Typically, the CAMERASPACENORMAL or CAMERASPACEREFLECTIONVECTOR modes are used.

To specify explicit texture coordinates, the TextureCoordinate3D node (see 33 Texture3D component) shall be used.

## 34.2.5 Texture Orientation

Cubic environment maps define a single texture as consisting of six separate images, one for each side of a cube. This component defines the six sides as front, back, left, right, top and bottom. These sides shall be oriented as shown in Figure 34.1.

Figure 34.1 — Mapping texture sides to the texture coordinate axes

# 34.3 Abstract Types

## 34.3.1 X3DEnvironmentTextureNode

    X3DEnvironmentTextureNode : X3DSingleTextureNode {
    X3DEnvironmentTextureNode : X3DTextureNode {
      SFString [in,out] description ""
      SFNode   [in,out] metadata    NULL [X3DMetadataObject]
      SFNode   []       textureProperties NULL   [TextureProperties]
    }

This abstract node type is the base type for all node types that specify cubic environment map sources for texture images.

# 34.4 Node reference

## 34.4.1 ComposedCubeMapTexture

    ComposedCubeMapTexture : X3DEnvironmentTextureNode {
      SFNode   [in,out] back           NULL [X3DTexture2DNode]
      SFNode   [in,out] backTexture    NULL [X3DTexture2DNode]
      SFNode   [in,out] bottom         NULL [X3DTexture2DNode]
      SFNode   [in,out] bottomTexture  NULL [X3DTexture2DNode]
      SFString [in,out] description    ""
      SFNode   [in,out] front          NULL [X3DTexture2DNode]
      SFNode   [in,out] frontTexture   NULL [X3DTexture2DNode]
      SFNode   [in,out] left           NULL [X3DTexture2DNode]
      SFNode   [in,out] leftTexture    NULL [X3DTexture2DNode]
      SFNode   [in,out] metadata       NULL [X3DMetadataObject]
      SFNode   [in,out] right          NULL [X3DTexture2DNode]
      SFNode   [in,out] rightTexture   NULL [X3DTexture2DNode]
      SFNode   [in,out] top            NULL [X3DTexture2DNode]
      SFNode   [in,out] topTexture     NULL [X3DTexture2DNode]
      SFNode   []       textureProperties NULL   [TextureProperties]
    }

The ComposedCubeMapTexture node defines a cubic environment map source as an explicit set of images drawn from individual 2D texture nodes.

NOTE The original names for ComposedCubeMapTexture fields backTexture, bottomTexture, frontTexture, leftTexture, rightTexture, and topTexture in X3D version 3 are back, bottom, front, left, right, and top, respectively.

See 34.2 Concepts for a general description of cube map environmental texture maps.

See 18 Texturing component for a general description of the X3DTexture2DNode abstract type and interpretation of rendering for 2D images. When used as a source for cubic environment maps, the fields repeatS and repeatT fields shall be ignored.

## 34.4.2 GeneratedCubeMapTexture

    GeneratedCubeMapTexture : X3DEnvironmentTextureNode {
      SFString [in,out] description       ""
      SFNode   [in,out] metadata          NULL   [X3DMetadataObject]
      SFString [in,out] update            "NONE" ["NONE"|"NEXT_FRAME_ONLY"|"ALWAYS"]
      SFInt32  []       size              128    (0,∞)
      SFNode   []       textureProperties NULL   [TextureProperties]
    }

The ComposedCubeMapTexture GeneratedCubeMapTexture node defines a cubic environment map that sources its data from internally generated images, rendered from a virtual situated perspective in the scene.

The viewpoint of the generated texture is based on the location and orientation of the associated geometry in world space.

NOTE An object trying to render itself in the scene graph can cause infinite loops in the renderer implementation and is thus not permitted.

The field of view shall be π/2 radians (or the equivalent angle base units) with an aspect ratio of 1:1.

The size field indicates the resolution of the generated images in number of pixels per side.

The update field can be used to request a regeneration of the texture. Setting this field to "ALWAYS" will cause the texture to be rendered every frame. A value of "NONE" will stop rendering so that no further updates are performed even if the contained scene graph changes. When the value is set to "NEXT_FRAME_ONLY", it is an instruction to render the texture at the end of this frame, and then not render it again. In this case, the update frame indicator is set to this frame; at the start of the next frame, the update value shall be automatically set back to "NONE" to indicate that the rendering has already taken place. Since this is a change of value for the update field, an output event is automatically generated.

## 34.4.3 ImageCubeMapTexture

    ImageCubeMapTexture : X3DEnvironmentTextureNode, X3DUrlObject {
      SFTime   [in,out] autoRefresh          0.0  [0,∞)
      SFTime   [in,out] autoRefreshTimeLimit 3600.0  [0,∞)
      SFString [in,out] description          ""
      SFBool   [in,out] load                 TRUE
      SFNode   [in,out] metadata             NULL [X3DMetadataObject]
      SFTime   [in,out] refresh              0.0  [0,∞)
      MFString [in,out] url                  []   [URI]
      SFNode   []       textureProperties    NULL [TextureProperties]
    }

The ImageCubeMapTexture node defines a cubic environment map source as a single file format that contains multiple images, one for each side.

The texture is read from the URL specified by the url field. When the url field contains no values, texturing is disabled. The url field is defined in 9.2.1 URLs, URNs and URIs. Browsers are not required to support any specific cube map environment texture format. It is recommended that browsers support the Microsoft DDS cube map environment texture file format (see [DDS]).

See 18.2 Concepts for a general description of texture maps.

# 34.5 Support levels

The Cube map environmental texturing component defines three levels of support as specified in Table 34.2.

Table 34.2 — Cube map environmental texturing component support levels

Level | Prerequisites | Nodes/Features | Support
--- | --- | --- | ---
1 | Core 1 Grouping 1 Shape 1 Rendering 1 Texturing 1 |  |
|  | X3DEnvironmentTextureNode | n/a
|  | ComposedCubeMapTexture | All fields fully supported.
2 | Core 1 Grouping 1 Shape 1 Rendering 1 Texturing 1 |  |
|  | ImageCubeMapTexture | All fields fully supported.
3 | Core 1 Grouping 1 Shape 1 Rendering 1 Texturing 1 |  |
|  | GeneratedCubeMapTexture | All fields fully supported.