Drawing on shader?

Are there any examples where I can use the mouse to draw on a shader material by displacing the vertices like the example image?

use this but draw on displacement map instead of map


1 Like

is there any way I can draw directly on the mesh instead of drawing on the canvas element that update the texture; or is that not the correct workflow for drawing on a mesh?

you can do that if you wish, of course. see here for an easy way, or here for a hard way.

This example draws on a displacement map.
Hold down CTRL and left mouse button and you can draw directly on the plane.
It uses the UV co-ordinates from the raycaster to draw pixels on the texture used by the displacement map.
Example: Draw a Displacement Map - Three.js Tutorials

1 Like