Convert 2D line drawing into 3D object in p5.js

Hi,

Welcome to the forum! :slight_smile:

One way to do this is to let the user click and draw points on the canvas in 2d. Each time you store the x and y coordinates and when the user has finished, you construct the 3d geometry with the beginShape() and endShape() functions.

Basically if you have 4 points in 2d space, you need to construct the 3d points to “solidify” your stroke like this :

Check out this tutorial for creating custom 3d meshes :

1 Like