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

12 Shape component

--- X3D separator bar ---

cube 12.1 Introduction

12.1.1 Name

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

12.1.2 Overview

This clause describes the Shape component of this part of ISO/IEC 19775. The Shape component defines nodes for associating geometry with their visible properties and the scene environment. Table 12.1 provides links to the major topics in this clause.

Table 12.1 — Topics

cube 12.2 Concepts

12.2.1 Shape nodes

The Shape node associates a geometry node with nodes that define that geometry's appearance. Shape nodes must be part of the transformation hierarchy to have any visible result, and the transformation hierarchy must contain Shape nodes for any geometry to be visible (the only nodes that render visible results are Shape nodes and the Background nodes described in 24 Environmental effects). A Shape node contains exactly one geometry node in its geometry field, which is of type X3DGeometryNode. The Shape node descends from the abstract base type X3DShapeNode.

12.2.2 Appearance node

Shape nodes may specify an Appearance node that describes the appearance properties (material, texture and texture transformation) to be applied to the Shape's geometry. All valid children of the Apperance node descend from the abstract base type X3DAppearanceChildNode.

Nodes of the following type may be specified in the material field of the Appearance node:

This set may be extended by creating new nodes derived from the X3DMaterialNode abstract base type.

The Appearance node specifies texture mapping in its texture field. Valid values of the texture field are descendants of X3DTextureNode, including:

This set may be extended by creating new nodes derived from the abstract X3DTextureNode base class as defined in 18.3.2 X3DTextureNode.

Nodes of the type X3DTextureTransformNode may be specified in the textureTransform field of the Appearance node (see 18.3.4 X3DTextureTransformNode), including:

The interaction between the appearance properties and properties specific to geometry nodes is described in 13 Geometry3D component and 14 Geometry2D component

An Appearance node ,may specify additional information about the appearance of the geometry. Special properties may be defined for lines and filled areas. These properties are defined in the lineProperties and fillProperties fields by the following nodes, respectively:

cube 12.3 Abstract types

12.3.1 X3DAppearanceChildNode

X3DAppearanceChildNode : X3DNode { 
  SFNode [in,out] metadata NULL [X3DMetadataObject]
}

This is the base node type for the child nodes of the X3DAppearanceNode type.

12.3.2 X3DAppearanceNode

X3DAppearanceNode : X3DNode {
  SFNode [in,out] metadata NULL [X3DMetadataObject]
}

This is the base node type for all Appearance nodes.

12.3.3 X3DMaterialNode

X3DMaterialNode : X3DAppearanceChildNode {
  SFNode [in,out] metadata NULL [X3DMetadataObject]
}

This is the base node type for all Material nodes.

12.3.4 X3DShapeNode

X3DShapeNode : X3DChildNode, X3DBoundedObject {
  SFNode  [in,out] appearance NULL     [X3DAppearanceNode]
  SFNode  [in,out] geometry   NULL     [X3DGeometryNode]
  SFNode  [in,out] metadata   NULL     [X3DMetadataObject]
  SFVec3f []       bboxCenter 0 0 0    (-∞,∞)
  SFVec3f []       bboxSize   -1 -1 -1 [0,∞) or −1 −1 −1
}

This is the base node type for all Shape nodes.

cube 12.4 Node reference

12.4.1 Appearance

Appearance : X3DAppearanceNode { 
  SFNode [in,out] fillProperties   NULL [FillProperties]
  SFNode [in,out] lineProperties   NULL [LineProperties]
  SFNode [in,out] material         NULL [X3DMaterialNode]
  SFNode [in,out] metadata         NULL [X3DMetadataObject]
  MFNode [in,out] shaders          []   [X3DShaderNode]
  SFNode [in,out] texture          NULL [X3DTextureNode]
  SFNode [in,out] textureTransform NULL [X3DTextureTransformNode]
}

The Appearance node specifies the visual properties of geometry. The value for each of the fields in this node may be NULL. However, if the field is non-NULL, it shall contain one node of the appropriate type.

The material field, if specified, shall contain a Material node. If the material field is NULL or unspecified, lighting is off (all lights are ignored during rendering of the object that references this Appearance) and the unlit object colour is (1, 1, 1). Details of the X3D lighting model are in 17 Lighting component.

The texture field, if specified, shall contain one of the various types of texture nodes (see 18 Texturing component). If the texture node is NULL or the texture field is unspecified, the object that references this Appearance is not textured.

The textureTransform field, if specified, shall contain a TextureTransform node as defined in 18.4.8 TextureTransform. If the textureTransform is NULL or unspecified, the textureTransform field has no effect.

The lineProperties field, if specified, shall contain a LineProperties node as specified in 12.4.3 LineProperties. If lineProperties is NULL or unspecified, the lineProperties field has no effect.

The fillProperties field, if specified, shall contain a FillProperties node as specified in 12.4.2 FillProperties. If fillProperties is NULL or unspecified, the fillProperties field has no effect.

The shaders field contains a listing, in order of preference, of nodes that describe programmable shaders that replace the fixed rendering requirements of this part of ISO/IEC 19775 with user-provided functionality. If the field is not empty, one shader node is selected and the fixed rendering requirements defined by this specification are ignored. The field shall contain one of the various types of shader nodes as specified in 31 Programmable shaders component.

12.4.2 FillProperties

FillProperties : X3DAppearanceChildNode { 
  SFBool  [in,out] filled     TRUE
  SFColor [in,out] hatchColor 1 1 1 [0,1]
  SFBool  [in,out] hatched    TRUE
  SFInt32 [in,out] hatchStyle 1     [0,∞)
  SFNode  [in,out] metadata   NULL  [X3DMetadataObject]
}

The FillProperties node specifies additional properties to be applied to all polygonal areas on top of whatever appearance is specified by the other fields of the respective Appearance node. Thus, hatches are applied on top of the already rendered appearance of the node. Hatches are not affected by lighting.

The hatchStyle field selects a hatch pattern as defined in the International Register of Graphical Items (see 2.[REG]). The hatches are rendered using the colour specified by the hatchColor field.

The associated geometry shall be filled and/or hatched only when the respective values of the filled and/or hatched fields have value TRUE.

12.4.3 LineProperties

LineProperties : X3DAppearanceChildNode { 
  SFBool  [in,out] applied              TRUE
  SFInt32 [in,out] linetype             1    [1,∞)
  SFFloat [in,out] linewidthScaleFactor 0    [-∞,∞)
  SFNode  [in,out] metadata             NULL [X3DMetadataObject]
}

The LineProperties node specifies additional properties to be applied to all line geometry. The linetype and linewidth shall only be applied when the applied field has value TRUE. When the value of the applied field is FALSE, a solid line of nominal width shall be produced. The colour of the line is specified by the associated Material node.

The linetype field selects a line pattern as defined in the International Register of Graphical Items (see 2.[REG]). X3D browsers shall support linetypes 1 through 5 with linetype 1 being the default. X3D browsers may support any other of the registered linetypes. If a linetype that is not supported is requested, linetype 1 shall be used. Table 12.2 specifies the first sixteen linetypes as defined in the Linetype Section of the International Register of Graphical Items.

Table 12.2 — International registry of graphical items linetypes

1 Solid
2 Dashed
3 Dotted
4 Dashed-dotted
5 Dash-dot-dot
6 (single)
7 (single dot)
8 (double arrow)
10 (chain line)
11 (center line)
12 (hidden line)
13 (phantom line)
14 (break line 1)
15 (break line 2)
16 User-specified dash pattern

The linewidthScaleFactor is a multiplicative value that scales a browser dependent nominal linewidth by the linewidth scale factor. This resulting value shall then be mapped to the nearest available line width. A value less than or equal to zero refers to the minimum available line width.

12.4.4 Material

Material : X3DMaterialNode { 
  SFFloat [in,out] ambientIntensity 0.2         [0,1]
  SFColor [in,out] diffuseColor     0.8 0.8 0.8 [0,1]
  SFColor [in,out] emissiveColor    0 0 0       [0,1]
  SFNode  [in,out] metadata         NULL        [X3DMetadataObject]
  SFFloat [in,out] shininess        0.2         [0,1]
  SFColor [in,out] specularColor    0 0 0       [0,1]
  SFFloat [in,out] transparency     0           [0,1]
}

The Material node specifies surface material properties for associated geometry nodes and is used by the X3D lighting equations during rendering. 17 Lighting component contains a detailed description of the X3D lighting model equations.

All of the fields in the Material node range from 0.0 to 1.0.

The fields in the Material node determine how light reflects off an object to create colour:

  1. The ambientIntensity field specifies how much ambient light from light sources this surface shall reflect. Ambient light is omnidirectional and depends only on the number of light sources, not their positions with respect to the surface. Ambient colour is calculated as ambientIntensity × diffuseColor.
  2. The diffuseColor field reflects all X3D light sources depending on the angle of the surface with respect to the light source. The more directly the surface faces the light, the more diffuse light reflects.
  3. The emissiveColor field models "glowing" objects. This can be useful for displaying pre-lit models (where the light energy of the room is computed explicitly), or for displaying scientific data.
  4. The specularColor and shininess fields determine the specular highlights (e.g., the shiny spots on an apple). When the angle from the light to the surface is close to the angle from the surface to the viewer, the specularColor is added to the diffuse and ambient colour calculations. Lower shininess values produce soft glows, while higher values result in sharper, smaller highlights.
  5. The transparency field specifies how "clear" an object is, with 1.0 being completely transparent, and 0.0 completely opaque.

12.4.5 Shape

Shape : X3DShapeNode {
  SFNode  [in,out] appearance NULL     [X3DAppearanceNode]
  SFNode  [in,out] geometry   NULL     [X3DGeometryNode]
  SFNode  [in,out] metadata   NULL     [X3DMetadataObject]
  SFVec3f []       bboxCenter 0 0 0    (-∞,∞)
  SFVec3f []       bboxSize   -1 -1 -1 [0,∞) or −1 −1 −1
}

The Shape node has two fields, appearance and geometry, which are used to create rendered objects in the world. The appearance field contains an Appearance node that specifies the visual attributes (e.g., material and texture) to be applied to the geometry. The geometry field contains a geometry node. The specified geometry node is rendered with the specified appearance nodes applied. See 12.2 Concepts for more information.

17 Lighting component contains details of the X3D lighting model and the interaction between Appearance nodes and geometry nodes.

If the geometry field is NULL, the object is not drawn.

The bboxCenter and bboxSize fields specify a bounding box that encloses the Shape node's geometry. This is a hint that may be used for optimization purposes. The results are undefined if the specified bounding box is smaller than the actual bounding box of the geometry at any time. A default bboxSize value, (-1, -1, -1), implies that the bounding box is not specified and, if needed, is calculated by the browser. A description of the bboxCenter and bboxSize fields is contained in 10.2.2 Bounding boxes.

cube 12.5 Support levels

The Shape component provides three levels of support as specified in Table 12.3.

Table 12.3 — Shape component support levels

Level Prerequisites Nodes/Features Support
1 Core 1
Rendering 1
Texturing 1
X3DAppearanceChildNode(abstract) n/a
X3DAppearanceNode (abstract) n/a
  X3DMaterialNode (abstract) n/a
X3DShapeNode (abstract) n/a
Appearance textureTransform optionally supported.
lineProperties not supported. fillProperties not supported. Shaders not supported.
Material ambientIntensity optionally supported. shininess optionally supported. specularColour optionally supported. A Material with emissiveColour not equal to (0,0,0), diffuseColor equal to (0,0,0) is an unlit material. One-bit transparency; transparency values ≥ 0.5 transparent.
Shape All fields fully supported.
2 Core 1
Rendering 1
Texturing 1
All fields fully supported.
All Level 1 Appearance nodes except Appearance All fields fully supported.
    Appearance fillProperties not supported. Shaders not supported.
    LineProperties All fields fully supported.
3 Core 1
Rendering 1
Texturing 1
 
All Level 2 Appearance nodes All fields fully supported.
    FillProperties All fields fully supported.
--- X3D separator bar ---