Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smooth Spline Path Mesh
#1
I bought this plugin to use for oriented spline path meshes - particulary smooth ones.

The generated meshes are smooth for both pitching and yawing the spline, however upon rolling the surface becomes unsteady, creating a zig zag pattern of triangles. It took me a while to figure out why this happens and while being at it I changed the unclosed mesh triangles to use the same diagonal direction as the closed ones:

Code:
//in SplinePathMeshBuilder
#region ### Build Triangles ###
 // Unclosed Mesh (i.e. line like)
  mTris[triIndex] = vtSegN+ev;
  mTris[triIndex + 1] = vtSegN1+ev;
  mTris[triIndex + 1] = vtSegN1+ev;
  //mTris[triIndex + 2] = vtSegN1 +1+ev;
  //switching diagonals
  mTris[triIndex + 2] = vtSegN + 1+ev;

  mTris[triIndex + 3] = vtSegN1 + 1+ev;
  mTris[triIndex + 4] = vtSegN + 1+ev;
  //mTris[triIndex + 5] = vtSegN+ev;
  //switching diagonals
  mTris[triIndex + 5] = vtSegN1+ev;
This is useful for me to generate visually complex meshes and simple collider meshes that use the same structure instead of having diagonals cross each other. It might be a useful change for others too in case it's not already in the new version or has any other consequences.

However that didn't fix my problem of generating small staircases whenever I twisted and rolled a spline mesh. I figured out how to fix it, but not yet where to best apply that in code. Since the effect is rather subtle on a mesh here is a sketch of what currently happens on the left and what I would like to achieve on the right:
[Image: attachment.php?aid=47]
To get that working with any flat shape each vertex needs to be shifted along the spline tangent (better yet the spline itself?) in relation to its position to the normal, with the maximum shift on the outer width having a magnitude of the segments length/4.
I figured a vector3 cross between the spline up and a vertex' extrusion vector to the spline might do the job, but I have no idea how and where to apply that.
[Image: attachment.php?aid=48]
For an all around smooth Curvy I'd love to get some help with that.


Attached Files Thumbnail(s)
       
Reply
#2
Oh well, nevermind.

I just managed to achieve what I described and figured out it doesn't fix the problem either - in fact it cannot really be fixed. All I can really do is increase the amount of vertices along the width to reduce the influence of this effect. But I keep getting errors when I try to use an open 'line' mesh with more than two vertices so I'm limited to using a closed mesh with a bottom I don't need.

Looking forward to that improved mesh builder, this plugin is great.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can Deform Mesh shrink as well as stretch? davelloyd 1 3 12-09-2024, 11:16 AM
Last Post: _Aka_
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  Is it possible to make the face at the end of mesh? Chanon 3 6 11-14-2024, 04:38 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10:19 AM
Last Post: _Aka_

Forum Jump: