Titania X3D Editor

Bring Colours to Your Life.

Titania v4.3.1

Bring Colours to Your Life.

X3D Reference

Controlling color on coordinate-based geometry

Motivation

  • The Material node gives an entire shape the same color
  • You can provide colors for individual parts of a shape using a Color node

Syntax: Color

A Color node contains a list of RGB values (similar to a Coordinate node):

XML Encoding

Classic Encoding

Used as the color field value of IndexedFaceSet, IndexedLineSet, PointSet or ElevationGrid nodes.

Binding colors

  • Colors in the Color node override those in the Material node
  • You can bind colors
    • To each point, line, or face
    • To each coordinate in a line, or face

Syntax: PointSet

A PointSet geometry node creates geometry out of points:

  • color - provides a list of colors
  • Always binds one color to each point, in order

XML Encoding

Classic Encoding

Syntax: IndexedLineSet

An IndexedLineSet geometry node creates geometry out of lines:

  • color - list of colors
  • colorIndex - selects colors from list
  • colorPerVertex - control color binding

XML Encoding

Classic Encoding

Controlling color binding for line sets

The colorPerVertex field controls how color indexes are used:

  • FALSE: one color index to each line (ending at -1 coordinate indexes)
  • TRUE: one color index to each coordinate index of each line (including -1 coordinate indexes)

Syntax: IndexedFaceSet

An IndexedFaceSet geometry node creates geometry out of faces:

  • color - list of colors
  • colorIndex - selects colors from list
  • colorPerVertex - control color binding

XML Encoding

Classic Encoding

Controlling color binding for face sets

The colorPerVertex field controls how color indexes are used (similar to line sets):

  • FALSE: one color index to each face (ending at -1 coordinate indexes)
  • TRUE: one color index to each coordinate index of each face (including -1 coordinate indexes)

Syntax: ElevationGrid

An ElevationGrid geometry node creates terrains:

  • color - list of colors
  • colorPerVertex - control color binding
  • Always binds one color to each grid point or square, in order

XML Encoding

Classic Encoding

Controlling color binding for elevation grids

The colorPerVertex field controls how color indexes are used (similar to line and face sets):

  • FALSE: one color to each grid square
  • TRUE: one color to each height for each grid square

Summary

The Color node lists colors to use for parts of a shape:

  • Used as the value of the color field
  • Color indexes select colors to use
  • Colors override Material node

The colorPerVertex field selects color per line/face/grid square or color per coordinate.