Converts text into a 3D model that can be rendered in WebGL mode.
This method transforms flat text into extruded 3D geometry, allowing for dynamic effects like depth, warping, and custom shading.
It works by taking the outlines (contours) of each character in the provided text string and constructing a 3D shape from them.
Once your 3D text is ready, you can rotate it in 3D space using orbitControl() — just click and drag with your mouse to see it from all angles!
Use the extrude slider to give your letters depth: slide it up, and your flat text turns into a solid, multi-dimensional object.
You can also choose from various fonts such as "Anton", "Montserrat", or "Source Serif", much like selecting fancy fonts in a word processor,
The generated model (a Geometry object) can be manipulated further—rotated, scaled, or styled with shaders—to create engaging, interactive visual art.
Examples
Syntax
textToModel(str, x, y, width, height, [options], [options.extrude], [options.sampleFactor])
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.