How to curve meshes by a shader?
There are many algorithms to calculate a path/curve by and I’m currently exploring Bézier curves, more precisely Quadratic and Cubic Bézier curves. The difference between these Bézier curves are the number of control points defining the curve.
It’s not that hard to create a Bézier curve in i. e. the game engine Unity3D that I’m currently working with. The problem in my current exploration is to do manipulate the vertices of a mesh by it and through a shader. A shader is a program mostly intended to modify how graphics are rendered and that runs on the GPU. https://en.wikipedia.org/wiki/Shading_language
Currently I’ve created a Unity Shader that bends meshes, but I have a transformation space problem with the control points of the Bézier curve. All works fine when the mesh is in world origo, but when moving things around it stops behaving as I would like to. I’m currently trying out different kinds of solutions and looking at many different third party examples that do things similar to how I would like it to work.
Below you can see a snapshot of my shader:
Here some different approaches that other people are trying