← Back to Docs
  • index.html
  • Clayground
  • Clayground.Canvas3D
  • Box3D
  • Clayground 2025.2
  • Box3D QML Type

    A 3D box with customizable dimensions, edge rendering, and toon shading. More...

    Import Statement: import Clayground.Canvas3D
    Inherited By:

    BodyPart

    Properties

    Detailed Description

    Box3D provides a convenient way to create 3D boxes with cartoon-style edge rendering and optional toon shading. The box origin is at the bottom center, making it easy to place objects on ground planes.

    Example usage:

    import QtQuick3D
    import Clayground.Canvas3D
    
    Box3D {
        width: 100
        height: 150
        depth: 100
        color: "red"
        useToonShading: true
        showEdges: true
        edgeColorFactor: 0.4
    }

    See also Box3DGeometry.

    Property Documentation

    allEdges : int [read-only]

    Convenience constant for showing all edges.


    color : color

    The base color of the box.

    Defaults to red.


    depth : real

    Depth of the box along the Z axis.

    Defaults to width (creating a cube by default).


    edgeColorFactor : real

    Darkening factor for edges (0-1).

    Lower values create darker edges.


    edgeMask : int

    Bitmask controlling which edges are visible.

    Use allEdges, topEdges, bottomEdges, etc.


    edgeThickness : real

    Thickness of edge lines.


    faceScale : vector2d

    Scale factor for the selected face.

    See also Box3DGeometry::faceScale.


    height : real

    Height of the box along the Y axis.

    Defaults to width (creating a cube by default).


    scaledFace : enumeration

    Which face of the box should be scaled.

    Use with faceScale to create pyramids, trapezoids, etc.

    See also Box3DGeometry::scaledFace.


    showEdges : bool

    Whether to render dark edge lines.

    Defaults to true.


    useToonShading : bool

    Enables cartoon-style rendering.

    When enabled, uses half-lambert lighting for softer shadows, disables specular highlights and IBL. Works best with strong directional light shadows.


    width : real

    Width of the box along the X axis.

    Defaults to 1.0.