Shape component

This component defines the materials and containers for geometric nodes and their appearance.

See also X3D specification of the Shape component.

Supported nodes:

  • Shape (API reference),
    Appearance (API reference),
    Material (API reference)

    Fully implemented.

  • LineProperties (API reference).
    Fullly implemented.

    Allows to change line width and type (pattern). Suitable for all line geometry, in particular IndexedLineSet and LineSet. It also affects normal (filled) geometry (like IndexedFaceSet) when viewed in wireframe mode (see view3dscene "View -> Fill Mode" menu).

    We only support values 1..5 (Solid .. Dash-dot-dot) for linetype field.

    We use the GPU (OpenGL/OpenGLES) features to render lines with custom width and pattern (type).

    • This has the advantage that it's ultra-fast. Changing line width or using line pattern has virtually zero cost.

    • But the disadvantage is that we only support what the GPU (OpenGL/OpenGLES) supports.

      This particularly hurts on OpenGLES (Android, iOS), where

      1. glLineStipple is not supported (so X3D linetype field will unfortunately do nothing).
      2. Line width is limited. You can see the maxium line width on the console (output of GLInformationString), as "Max line width". Unfortunately, on many Android devices it's just 1. Which means that glLineWidth is supported, but actually completely ignored by the device.

      If you need 100% reliable line width or patterns on Android/iOS, you may need to render them differently, using filled rectangles (e.g. using IndexedFaceSet or Rectangle2D nodes). To simulate line patterns, use small repeatable textures with transparent pixels (you can set texture filtering to "NONE" using TextureProperties node to avoid smoothing the alpha channel).

  • Notes about VRML 1.0 and multiple materials: multiple materials within a single VRML 1.0 Material node work 100% correctly if you change only emissive and transparency, or only diffuse and transparency for each index. For complicated cases (like when you change diffuse, and specular, and emissive...) for each material index -> they will fail.

    This is a wontfix. For OpenGL fixed-function pipeline, changing all glMaterial settings too often (like for a vertex or a face) is prohibitively slow. It's also terribly memory consuming (for castle, display lists of animations (in the older days when we used display lists) of spider and spider queen were eating 130 MB with naive implementation, vs 10 MB with current implementation).

    VRML 2.0 and X3D removed this idea, replacing it with much saner Color and ColorRGBA nodes, that are implemented fully.

TODO: FillProperties, TwoSidedMaterial are missing.