File: TubePainter.md | Updated: 11/15/2025
This module can be used to paint tube-like meshes along a sequence of points. This module is used in a XR painter demo.
const painter = new TubePainter();
scene.add( painter.mesh );
TubePainter is an addon, and must be imported explicitly, see Installation#Addons.
import { TubePainter } from 'three/addons/misc/TubePainter.js';
The "painted" tube mesh. Must be added to the scene.
Draw a stroke from the current position to the given one. This method extends the tube while drawing with the XR controllers.
position | The destination position.
---|---
Moves the current painting position to the given value.
position | The new painting position.
---|---
Sets the color of newly rendered tube segments.
color | The color.
---|---
Sets the size of newly rendered tube segments.
size | The size.
---|---
Updates the internal geometry buffers so the new painted segments are rendered.