Consistently look to mesh, regardless of geometry

I am trying to create a tube based on points that are not evenly spaced. I am using the HermitSpline creation, which creates a nicely smoothed curve, with a specified number of points between each original data point. The problem with this is that I do not get a very even looking mesh when the data points get spaced out at different intervals. I think maybe updating the geometry isn’t the way I should go about doing this? Maybe a shader would give the effect I am looking for (a consistent or even random, but evenly spaced bumpy texture)? Or if I could just get the curve to have evenly spaced points along it?

Playground link

Is the one on the left the one you want? Can you precise what is wrong with your tube :slight_smile: ?

So the green one here is the style I am trying to go for. https://www.babylonjs-playground.com/#MBP0UX#1

However, you can see that whenever the curve gets stretched out, the individual radial points get spaced further apart resulting in the issue I am running in to. Ideally I would have something like looks like the green one, regardless of the tubes geometry points/number of points. I am unsure if that is actually possible, so I would be okay with trying to get an even number of points along the curve path, which for these examples is easy enough, however for my actual project, the original points can be erratically placed as far as distances are concerned. I can try to put together a better example of that as well.

So here, the straight tube shows the issue I previously mentioned a bit better. Although the original points are all on the same line, since the CreateCatmullRomSpline (HermitSpline does the same) is making 10 points between each original point, it gets pretty wonky looking when the distances between the original points vary.

Yeah I get your point. So it is more a mathematical question actually :slight_smile:

Did you consider using Bump texture instead? It would be easy to get that look and far more performant

So I have been trying to use a bump texture, and maybe I am just bad at it, but I can’t seem to get something to look correct. And then there is the case of still getting the u and v scaling of the bump texture consistent between different tubes.

I think I have close to a solution, as I have my own getPointAt function, so I just use that multiple times to get evenly spaced points. I think it still needs to be improved on some, as the beginning and end point are still sometimes to close together, but that is a later problem.

I would still be interested to see a bump texture/displacement map that could do something kind of similar, as I didn’t have much luck. I tried this and this

1 Like

Displacement will help for sure. That’s something you can try :slight_smile:
Please keep us posted with your findings