Post

IndexedFaceSet

IndexedFaceSet

Overview

IndexedFaceSet defines polygons using index lists corresponding to vertex coordinates. IndexedFaceSet is a geometry node containing a Coordinate or CoordinateDouble node, and can also contain Color or ColorRGBA, Normal and TextureCoordinate nodes.

The IndexedFaceSet node belongs to the Geometry3D component and requires at least level 2, its default container field is geometry. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
+ X3DNode
  + X3DGeometryNode
    + X3DComposedGeometryNode
      + IndexedFaceSet

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

MFInt32 [in] set_colorIndex [0,∞) or -1

colorIndex values define the order in which Color or ColorRGBA values are applied to polygons (or vertices), interspersed by -1 if colorlPerVertex=true.

Hints

  • If colorIndex array is not provided, then Color or ColorRGBA values are indexed according to the coordIndex field. Omitting duplicative colorIndex fields can reduce file size.
  • If colorPerVertex=’false’ then one index is provided for each polygon defined by the coordIndex array. No sentinel -1 values are included.
  • If colorPerVertex=’true’ then a matching set of indices is provided, each separated by sentinel -1, that exactly corresponds to individual values in the coordIndex array polygon definitions.
  • This field is not accessType inputOutput since X3D browsers might use different underlying geometric representations for high-performance rendering, and so output events are not appropriate.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

MFInt32 [in] set_texCoordIndex [-1,∞)

List of texture-coordinate indices mapping attached texture to corresponding coordinates.

Hints

  • Use an authoring tool!
  • If texCoordIndex array is not provided, then TextureCoordinate values are indexed according to the coordIndex field. Omitting duplicative texCoordIndex fields can reduce file size.
  • This field is not accessType inputOutput since X3D browsers might use different underlying geometric representations for high-performance rendering, and so output events are not appropriate.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

MFInt32 [in] set_normalIndex [0,∞) or -1

normalIndex values define the order in which normal vectors are applied to polygons (or vertices), interspersed by -1 if normalPerVertex=true.

Hints

  • This field may be ignored, applying the default value regardless.
  • If normalIndex array is not provided, then Normal values are indexed according to the coordIndex field. Omitting duplicative normalIndex fields can reduce file size.
  • This field is not accessType inputOutput since X3D browsers might use different underlying geometric representations for high-performance rendering, and so output events are not appropriate.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

MFInt32 [in] set_coordIndex [0,∞) or -1

coordIndex indices provide the order in which coordinates are applied to construct each polygon face. Order starts at index 0, commas are optional between sets.

Hints

  • Sentinel value -1 is used to separate indices for each successive polygon.
  • This field is not accessType inputOutput since X3D browsers might use different underlying geometric representations for high-performance rendering, and so output events are not appropriate.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

SFBool [ ] solid TRUE

Setting solid true means draw only one side of polygons (backface culling on), setting solid false means draw both sides of polygons (backface culling off).

Hints

  • Mnemonic “this geometry is solid like a brick” (you don’t render the inside of a brick).
  • If in doubt, use solid=’false’ for maximum visibility.
  • AccessType relaxed to inputOutput in order to support animation and visualization.

Warning

  • Default value true can completely hide geometry if viewed from wrong side!

SFBool [ ] ccw TRUE

ccw defines clockwise/counterclockwise ordering of vertex coordinates, which in turn defines front/back orientation of polygon normals according to Right-Hand Rule (RHR).

Hints

  • A good debugging technique for problematic polygons is to try changing the value of ccw, which can reverse solid effects (single-sided backface culling) and normal-vector direction.
  • Clockwise

Warning

  • Consistent and correct ordering of left-handed or right-handed point sequences is important throughout the coord array of point values.

SFBool [ ] convex TRUE

The convex field is a hint to renderers whether all polygons in a shape are convex (true), or possibly concave (false). A convex polygon is planar, does not intersect itself, and has all interior angles < 180 degrees.

Hints

  • Concave is the opposite of convex. Interchange profile
  • Only convex=true IndexedFaceSets have guaranteed support.
  • Select convex=false (i.e. concave) and solid=false (i.e. two-sided display) for greatest visibility of geometry.
  • convex polygon
  • Tessellation

Warning

  • Concave or inverted geometry may be invisible when using default value convex=true, since some renderers use more-efficient algorithms to perform tessellation that may inadvertently fail on concave geometry.

SFFloat [ ] creaseAngle 0 [0,∞)

creaseAngle defines angle (in radians) for determining whether adjacent polygons are drawn with sharp edges or smooth shading. If angle between normals of two adjacent polygons is less than creaseAngle, smooth shading is rendered across the shared line segment. Interchange profile

Hints

  • Only 0 and π radians supported.
  • creaseAngle=0 means render all edges sharply, creaseAngle=3.14159 means render all edges smoothly.
  • Radian units for angular measure

SFBool [ ] colorPerVertex TRUE

Whether Color or ColorRGBA values are applied to each point vertex (true) or to each polygon face (false).

Hint

Warning

  • If child Color or ColorRGBA node is not provided, then geometry is rendered using corresponding Appearance and material/texture values.

SFBool [ ] normalPerVertex TRUE

Whether Normal node vector values are applied to each point vertex (true) or to each polygon face (false).

Hint

  • If no child Normal node is provided, the X3D browser shall automatically generate normals, using creaseAngle to determine smoothed shading across shared vertices.

MFInt32 [ ] colorIndex [ ] [0,∞) or -1

colorIndex values define the order in which Color or ColorRGBA values are applied to polygons (or vertices), interspersed by -1 if colorlPerVertex=true.

Hints

  • If colorIndex array is not provided, then Color or ColorRGBA values are indexed according to the coordIndex field. Omitting duplicative colorIndex fields can reduce file size.
  • If colorPerVertex=’false’ then one index is provided for each polygon defined by the coordIndex array. No sentinel -1 values are included.
  • If colorPerVertex=’true’ then a matching set of indices is provided, each separated by sentinel -1, that exactly corresponds to individual values in the coordIndex array polygon definitions.

Warning

  • If child Color or ColorRGBA node is not provided, then geometry is rendered using corresponding Appearance and material/texture values.

MFInt32 [ ] texCoordIndex [ ] [-1,∞)

List of texture-coordinate indices mapping attached texture to corresponding coordinates.

Hints

  • If texCoordIndex array is not provided, then TextureCoordinate values are indexed according to the coordIndex field. Omitting duplicative texCoordIndex fields can reduce file size.
  • Use an authoring tool!

MFInt32 [ ] normalIndex [ ] [0,∞) or -1

normalIndex values define the order in which normal vectors are applied to polygons (or vertices), interspersed by -1 if normalPerVertex=true.

Hints

  • If normalIndex array is not provided, then Normal values are indexed according to the coordIndex field. Omitting duplicative normalIndex fields can reduce file size.
  • If normalPerVertex=’false’ then one index is provided for each polygon defined by the coordIndex array. No sentinel -1 values are included.
  • If normalPerVertex=’true’ then a matching set of indices is provided, each separated by sentinel -1, that exactly corresponds to individual values in the coordIndex array polygon definitions.
  • If no child Normal node is provided, the X3D browser shall automatically generate normals, using creaseAngle to determine smoothed shading across shared vertices. Interchange profile
  • This field may be ignored, applying the default value regardless.

MFInt32 [ ] coordIndex [ ] [0,∞) or -1

coordIndex indices provide the order in which coordinates are applied to construct each polygon face. Order starts at index 0, commas are optional between sets.

Hint

  • Sentinel value -1 is used to separate indices for each successive polygon.

Warning

  • coordIndex is required in order to connect contained coordinate point values.

MFNode [in, out] attrib [ ] [X3DVertexAttributeNode]

Single contained FloatVertexAttribute node that can specify list of per-vertex attribute information for programmable shaders.

Hint

SFNode [in, out] fogCoord NULL [FogCoordinate]

Single contained FogCoordinate node that can specify depth parameters for fog in corresponding geometry.

SFNode [in, out] color NULL [X3DColorNode]

Single contained Color or ColorRGBA node that can specify color values applied to corresponding vertices according to colorIndex and colorPerVertex fields.

SFNode [in, out] texCoord NULL [X3DTextureCoordinateNode]

Single contained TextureCoordinate, TextureCoordinateGenerator or MultiTextureCoordinate node that can specify coordinates for texture mapping onto corresponding geometry.

SFNode [in, out] tangent NULL [Tangent] non standard

Input/Output field tangent. If there is no Tangent node, the MikkTSpace algorithm is used to generate tangent vectors.

SFNode [in, out] normal NULL [X3DNormalNode]

Single contained Normal node that can specify perpendicular vectors for corresponding vertices to support rendering computations, applied according to the normalPerVertex field.

Hint

  • Useful for special effects. Normal vector computation by 3D graphics hardware is quite fast so adding normals to a scene is typically unnecessary.

Warning

  • normal vectors increase file size, typically doubling geometry definitions. Normal vectors are rapidly computed at run time by GPUs and thus are rarely needed in model files if no special effects are expected. Normal vectors are rapidly computed at run time by GPUs and thus are rarely needed in model files if no special effects are expected.

SFNode [in, out] coord NULL [X3DCoordinateNode]

Single contained Coordinate or CoordinateDouble node that can specify a list of vertex values.

Advice

Hints

  • Polygon
  • Insert a Shape node before adding geometry or Appearance.
  • For advanced extensibility, authors can substitute a type-matched ProtoInstance node (with correct containerField value) for contained node content.

Warnings

  • Rendering characteristics are undefined if polygons are not planar.
  • Avoid self-intersecting polygon line segments, otherwise defined geometry is irregular and rendering results are undefined.

Example

See Also

This post is licensed under CC BY 4.0 by the author.