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

33  Texturing3D Component

--- X3D separator bar ---

cube 33.1 Introduction

33.1.1 Name

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

33.1.2 Overview

This clause describes the Texturing3D component of this document. Table 33.1 provides links to the major topics in this clause.

Table 33.1 — Topics

cube 33.2 Concepts

33.2.1 Overview

This component provides additional texturing extensions to the basic capabilities defined in X3D. Many applications need to describe surface properties as data points in a volume of space, rather than a flat surface. These textures operate with three dimensions. A texture of this type is termed a volumetric texture.

Volumetric textures are essential for advanced rendering effects related to fog and lighting, as well as industry-specific needs such as medical and CAD visualization.

33.2.2 3D texturing concepts

3D texturing specifies texel colours based on a volume of space. An object that is being rendered on that 3D texture effectively cuts a volume out of the texels provided by the texture.

This document assumes standard commodity hardware that presents 3D textures as a series of 2D slices of the volume that can then be interpolated and composited together to form a 3D volume of space. There is no assumption about the existence of true voxel rendering hardware capability.

A 3D volume of texture is specified as a number of 2D planes (images) of data that are ordered in a depth-wise manner. Figure 33.1 shows two base images that can be layered together resulting in the volume of a 3D texture. In this example, the texture would have a dimension of n × m × 2.

Description of 3D texture

Figure 33.1 — Formation of 3D texture from two 2D textures

33.2.3 Texture coordinates

The coordinate system of the texture is a right-handed coordinate system as shown in Figure 33.1. The coordinate components are defined to be (r,s,t) as values along the R, S, and T axes, as depicted in Figure 33.1.

33.2.4 Texture coordinate generation for primitive objects

Some geometry nodes are not capable of having 3D texture coordinates set by the user ( e.g., Box and Cone). For these cases, 3D textures coordinates are automatically generated based on the following rules:

  1. All coordinates are generated in the range [0, 1] for the given axis. 0 is for the minimum value of the coordinate vertex on that axis, and 1 is assigned to the maximum value of the coordinate vertex on that axis.
  2. Orientation is oriented along the z-axis, looking in the -Z direction with a zero angle aligned with the axis.
  3. S coordinate is generated from left to right based on the maximum extents of the X-axis vertex values.
  4. T coordinate is generated from top to bottom based on the maximum extents of the Y-axis vertex values.
  5. R coordinate is generated from front (+Z) to back (-Z) based on the maximum extents of the Z-axis vertex values.

The default 3D texture coordinate generation described above is performed only when the Appearance.texture contains a node derived from X3DTexture3DNode, or when it contains MultiTexture and the first child of it is X3DTexture3DNode. In particular, it means that using 3D texture has no effect on the default texture coordinate generation algorithm when this 3D texture is used:

In the above two cases, the default coordinate generation still follows the standard algorithm (described at each particular geometry node, best suited for 2D textures). The reason for this is that a node may use multiple textures, both 3D and 2D, and in the above cases it's impossible for the X3D browser to know which texture generation scheme (best suited for 3D or 2D texture) is a better default.

33.2.5 Texture map image formats

Node types specifying 3D texture maps may supply data with a number of color components between one and four. The valid types and interpretations of 3D textures are identical to that for 2D textures. The definition of texture formats is defined in 18.2.1 Texture map formats.

cube 33.3 Abstract types

33.3.1 X3DTexture3DNode

X3DTexture3DNode : X3DSingleTextureNode {
  SFString [in,out] description       ""
  SFNode   [in,out] metadata          NULL  [X3DMetadataObject]
  SFBool   []       repeatR           FALSE
  SFBool   []       repeatS           FALSE
  SFBool   []       repeatT           FALSE
  SFNode   []       textureProperties NULL  [TextureProperties]
}  

This abstract node type is the base type for all node types that specify 3D sources for texture images.

NOTE  The base node type diverges from the standard X3D textures by making the default repeat modes FALSE, rather than TRUE. This is because 3D textures are almost never used in a repeated rendering mode, and because repeat mode TRUE for 3D textures can produce odd rendering artifacts.

cube 33.4 Node reference

33.4.1 ComposedTexture3D

ComposedTexture3D : X3DTexture3DNode {
  SFString [in,out] description       ""
  SFNode   [in,out] metadata          NULL  [X3DMetadataObject]
  MFNode   [in,out] texture           []    [X3DTexture2DNode]
  SFBool   []       repeatR           FALSE
  SFBool   []       repeatS           FALSE
  SFBool   []       repeatT           FALSE
  SFNode   []       textureProperties NULL  [TextureProperties]
}

The ComposedTexture3D node defines a 3D image-based texture map as a  collection of 2D texture sources at various depths and parameters controlling tiling repetition of the texture onto geometry.

The texture values are interpreted with the first image being at depth 0 and each following image representing an increasing depth value in the R direction. A user shall provide 2n source textures in this array. The individual source textures will ignore their repeat field values.

See 33.2 Concepts, for a general description of 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.

33.4.2 ImageTexture3D

ImageTexture3D : X3DTexture3DNode, 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]
  MFString [in,out] url                  []     [URI]
  SFBool   []       repeatR              FALSE
  SFBool   []       repeatS              FALSE
  SFBool   []       repeatT              FALSE
  SFNode   []       textureProperties    NULL   [TextureProperties]
}

The ImageTexture3D node defines a texture map by specifying a single image file that contains complete 3D data and general parameters for mapping texels to geometry.

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. While there are no required file formats, it is recommended that one of the following formats be supported:

  1. DDS (see [DDS]),h
  2. DICOM (see 2.[DICOM]),
  3. NRRD (see [NRRD]), and/or
  4. .vol (see [VOL]).

See 33.2 Concepts for a general description of texture maps.

33.4.3 PixelTexture3D

PixelTexture3D : X3DTexture3DNode {
  SFString [in,out] description       ""
  MFInt32  [in,out] image             [0 0 0 0]
  SFNode   [in,out] metadata          NULL      [X3DMetadataObject]
  SFBool   []       repeatR           FALSE
  SFBool   []       repeatS           FALSE
  SFBool   []       repeatT           FALSE
  SFNode   []       textureProperties NULL      [TextureProperties]
}

The PixelTexture3D node defines a 3D image-based texture map as an explicit array of pixel values (image field) and parameters controlling tiling repetition of the texture onto geometry.

The image field describes the raw data to be used for this 3D texture. The first value of the array is the number of components to the image and shall be a value between 0 and 4. The following three numbers are the size of the texture: width, height and depth, respectively. The remaining values of the array are treated as the pixels for the image. There shall be at least width × height × depth number of pixel values provided. Each of the width, height and depth values is required to be a power of two.

See 33.2 Concepts for a general description of 3D texture maps.

See 17 Lighting component for a description of how the texture values interact with the appearance of the geometry. 5.7 SFImage and MFImage describes the specification of an image.

33.4.4 TextureCoordinate3D

TextureCoordinate3D : X3DSingleTextureCoordinateNode {
  SFString [in,out] mapping  ""
  SFNode   [in,out] metadata NULL [X3DMetadataObject]
  MFVec3f  [in,out] point    []   (-∞,∞)
}

The TextureCoordinate3D node is a geometry property node that specifies a set of 3D texture coordinates used by vertex-based geometry nodes ( e.g., IndexedFaceSet and ElevationGrid) to map 3D textures to vertices.

Providing 3D texture coordinates to objects that only have 2D textures defined shall result in implementation dependent rendering.

33.4.5 TextureCoordinate4D

TextureCoordinate4D : X3DSingleTextureCoordinateNode {
  SFString [in,out] mapping  ""
  SFNode   [in,out] metadata NULL [X3DMetadataObject]
  MFVec4f  [in,out] point    []   (-∞,∞)
}

The TextureCoordinate4D node is a geometry property node that specifies a set of 4D (homogeneous 3D) texture coordinates used by vertex-based geometry nodes ( e.g., IndexedFaceSet and ElevationGrid) to map 3D textures to vertices.

Providing 4D texture coordinates to objects that only have 2D textures defined shall result in implementation dependent rendering.

33.4.6 TextureTransform3D

TextureTransform3D : X3DSingleTextureTransformNode {
  SFVec3f    [in,out] center      0 0 0   (-∞,∞)
  SFString   [in,out] mapping     ""
  SFNode     [in,out] metadata    NULL    [X3DMetadataObject]
  SFRotation [in,out] rotation    0 0 1 0 (-∞,∞)
  SFVec3f    [in,out] scale       1 1 1   (-∞,∞)
  SFVec3f    [in,out] translation 0 0 0   (-∞,∞)
}

The TextureTransform3D node specifies a 3D transformation that is applied to texture coordinates (see 33.4.4 TextureCoordinate3D). This node affects the way texture coordinates are applied to the geometric surface. The transformation consists of (in order):

  1. a translation;
  2. a rotation about the centre point; and
  3. a non-uniform scale about the centre point.

These parameters support changes to the size, orientation, and position of textures on shapes. These operations appear reversed when viewed on the surface of geometry.

EXAMPLE  A scale value of (1 2 2) will scale the texture coordinates and have the net effect of shrinking the texture size by a factor of 2 (texture coordinates are twice as large and thus cause the texture to repeat) in the T and R dimensions and leave the S dimension unscaled. A translation of (0.5 0.0 0.0) translates the texture coordinates +0.5 units along the S-axis and has the net effect of translating the texture -0.5 along the S-axis on the geometry's surface. A rotation of π/2 of the texture coordinates results in a -π/2 rotation of the texture on the geometry.

The center field specifies a translation offset in texture coordinate space about which the rotation and scale fields are applied. The scale field specifies a scaling factor in S, T and R of the texture coordinates about the center point. All scale values shall be in the range (-∞,∞). The rotation field specifies a rotation of the texture coordinates about the center point after the scale has been applied. A positive rotation value makes the texture coordinates rotate counterclockwise about the centre, thereby rotating the appearance of the texture itself clockwise. The translation field specifies a translation of the texture coordinates.

A 3D transform may be applied to 2D textures. The results are implementation dependent.

33.4.7 TextureTransformMatrix3D

TextureTransformMatrix3D : X3DSingleTextureTransformNode {
  SFString   [in,out] mapping     ""
  SFMatrix4f [in,out] matrix      1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1  (-∞,∞)
  SFNode     [in,out] metadata    NULL    [X3DMetadataObject]
}

The matrix field specifies a generalized, unfiltered 4×4 transformation matrix that can be used to modify the texture. Any set of values is permitted.

cube 33.5 Support levels

The 3D Texturing component defines two levels of support as specified in Table 33.2.

Table 33.2 — 3D texturing component support levels

LevelPrerequisitesNodes/FeaturesSupport
1 Core 1
Grouping 1
Shape 1
Rendering 1
Texturing 1
X3DTexture3DNode n/a
TextureTransformMatrix3D All fields fully supported.
TextureTransform3D All fields fully supported.
TextureCoordinate3D All fields fully supported.
TextureCoordinate4D All fields fully supported.
ComposedTexture3D All fields fully supported.
PixelTexture3D All fields fully supported.
2 Core 1
Grouping 1
Shape 1
Rendering 1
Texturing 1
ImageTexture3D All fields fully supported.
--- X3D separator bar ---