This pottery simulator is all done using shaders 🤯

Here's a thread of how I did it 👇
[1/7]
I start with a shader that can project (orthographic) any object onto a cylindrical surface.

This is done by taking an object's world xyz coords, mapping them to cylindrical coords, and rendering them to a texture.
[2/7]
The colour of the projection is then calculated based on how far each vertex is from the surface of the cylinder. Sorta like a depth map.

By not clearing the texture every frame, you can keep track of where the hand has moved inside the cylinder.
[3/7]
This texture can be used as a displacement map on the cylinder. This lets you press into the mesh to deform it.

Surface normals can then be generated in the shader from the displacement map.

I could have used tessellation here, but was too lazy 🤷‍♂️
[4/7]
Now here's the fun part.

By simply scrolling the texture horizontally, you get the illusion of the cylinder rotating.

It looks like you're deforming a moving mesh.
[5/7]
If you scroll the texture fast enough you get a really convincing effect. Setting the material roughness close to 0 gives that wet clay look.

While this technique doesn't support pulling the clay upwards or outwards (yet), I'm amazed by how well it works!
[6/7]
The best part of my pottery shader is that it works with any object.

It's super precise and doesn't rely on colliders at all! 🐴
You can follow @pushmatrix.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.