threlte logo
@threlte/extras

<RoundedBoxGeometry>

webgl <RoundedBoxGeometry> works with WebGL and is available from the @threlte/extras export. webgpu <RoundedBoxGeometry> works with WebGPU and is available from the @threlte/extras/webgpu export.

Creates a rounded box geometry with a Three.js ExtrudeGeometry.

Example

<script>
  import { T, Canvas } from '@threlte/core'
  import { RoundedBoxGeometry } from '@threlte/extras'
</script>

<Canvas>
  <T.PerspectiveCamera
    makeDefault
    position={[3, 3, 3]}
    lookAt={[0, 0, 0]}
  />

  <T.Mesh>
    <RoundedBoxGeometry />
    <T.MeshPhongMaterial color="hotpink" />
  </T.Mesh>
</Canvas>

Component Signature

Props

name
type
required
default
description

args
[width?: number, height?: number, depth?: number] | []
no
[1, 1, 1]
The width, height and depth of the box. Missing values are 1.

creaseAngle
number
no
0.4
Normals are smoothed everywhere except where faces meet at a sharper angle than this, in radians.

radius
number
no
0.05
The radius of the rounded edges and corners.

smoothness
number
no
4
The number of segments used to round each edge. Higher values are smoother.

steps
number
no
1
The number of segments along the box's depth.