All right! Managed to figure out how to do
procedural mesh generation. These will be used for creating tentacles and procedural tubes.
Segments are created based on the given radius (vertex distance from center line), segment lenght and number of faces. A segment face is made up of two basic mesh triangles. For now, the start radius and end radius is given and the in between are interpolated. Later I'll add an array based approach were each segment radius can be specified independently.
Notes:
-Currently the ends are not filled in since I plan to add something else to the ends later. Also due to backface culling, it appears as if the mesh wasn't complete. However, if either the camera or the mesh is rotated around then the other side is visible.
-Mesh is colored in the steps below.
3 sided mesh segments
4 sided segments
10 sided segments
... and before I got things working properly
The next step was to add bones to the mesh. Since bones in Unity are Transforms/GameObjects, it's quite easy to set them up. There are a few other properties to set up which bone affects which vertices and how much (weight). This approach isn't recommended for most models, but for the simple "tentacle" it works very well.
To keep things simple, for the color I just used vertex colors lerping from red to green. Also, added a few simple animations to the bones. However, this approach can work with certain types of shaders (e.g. Particle).
Moving the y position of the bones with a sine function:
Rotating the bones:
Scaling the bones:
You may have notice that there is something odd at certain angles.
Not sure if it's the shader or setup but since most likely I'll be using materials with textures, it may not be an issue. But if the issue still persists then I'll look into it. In case anyone knows what is happening, do let me know.