Shape component

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

See also X3D specification of the Shape component.

Contents:

1. Supported nodes

  • Shape(Pascal API: TShapeNode)

    The basic X3D node for "something that can be visible and collides". Inside the Shape.geometry field place a geometry node, like IndexedFaceSet. Inside the Shape.appearance field (optionally) place the Appearance node.

  • Appearance(Pascal API: TAppearanceNode)

    Describes the shape look (textures, material, shaders and such). Place this node inside Shape.appearance field.

  • Material(Pascal API: TMaterialNode)

    The classic (Phong lighting moddel) material. Describes how the shape interacts with lights. In simple terms: what is the color of the shape. Place this node inside Appearance.material field.

  • PhysicalMaterial(Pascal API: TPhysicalMaterialNode)

    The material using physical (PBR, physically-based rendering) equations for lighting. Consistent with glTF and latest Blender material specifications. Importing a glTF model automatically makes it use this material type (unless GltfForcePhongMaterials has been used).

    Place this node inside Appearance.material field.

  • UnlitMaterial(Pascal API: TUnlitMaterialNode)

    The unlit material. Lights do not affect the look of this material. It has only a simple color (emissiveColor) multiplied by the optional texture (emissiveTexture). Using this material is very efficient.

    Place this node inside Appearance.material field.

  • TwoSidedMaterial(Pascal API: TTwoSidedMaterialNode)

    Deprecated. Using this material node is now equivalent to using a subset of Phong Material. Note that if you want to see the mesh from two sides, just set geometry solid to FALSE, it is completely independent of the material node, will work with Material, PhysicalMaterial, UnlitMaterial as well.

    TODO: We don't support separateBackColor and related properties. So TwoSidedMaterial always looks the same from both sides.

  • LineProperties(Pascal API: TLinePropertiesNode)

    Configure line width and type (pattern). This node can be placed in Appearance.lineProperties, and it affects a shape that uses a line geometry, like 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 in GLInformationString output 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.

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

2. TODOs

  • FillProperties are not implemented yet.