Modifying mesh using spline


Hi, all!

I have a tiny mesh piece (a small section) and a spline.
I want to extrude this mesh section over spline so it becomes solid mesh (so it should be
properly compressed / inflated on spline turns).
Any ideas how to approach this?


Spline-based proceural roads with intersections - any implementations?

Like a road mesh, or a bridge?


Like a road mesh and/or bridge


There are some algos and ideas out there.

As for Urho specifically, the RibbonTrail class implements Geometry in a roughly similar way, so maybe it will be helpful?

Build any road curve from a road section

The terms you’re looking for to help with googling are “lofting” and “parallel curves”/“parallel transport.”

Assuming you had a spline and planar mesh to extrude the process is:

  • For each vertex compute the planar coordinates on the constrained axes (signed distance from 0,0 on XY where Z is the extrusion axis)
  • March along the spline, at each step build an orthonormal basis system
  • Emit vertices as SplinePositionTd + OrthonormalBasisX * SignedDistanceX + OrthoNormalBasisY * SignedDistanceY
  • Rotate vertex normals by minimal twist quat between the previous and next direction vector
    • That means knowing where you came from and where you will be next
  • Deal with UVs however you choose to
  • Repeat until done
  • Emit index buffers
  • Recompute tangents (you cannot rely on rotating tangents)

It’s relatively simple for extruding a 2d polygon, but it’s a nightmare to loft an arbitrary mesh as that’s full of edge of cases.


IOGRAM has a bunch of geometry related functions for this. Here is the source, and this is what I mocked up in the editor in about ~5min (try the live version here, and get project files here):


Hello! I’m trying to create something like this:

With Urho. I’ve did this before in UE4’s Blueprint (as seen here, but it way more difficult in Urho. Could anyone help me out with some tips?


Well, with Urho a general approach is to do everything manually.
I currently work on the same thing (roadmap generation algorithm + building road mesh structure),
the code is a bit messy and unfinished, but I’d like share what I found.

The basic structure is road intersection. We consider close half of each road to be belonging to intersection. The center of intersection is considered (0, 0) and we use 2D vectors for all calculations at this stage. We sort roads by angle using Atan2 and split by pairs.
Example: intersecting roads ABCD. After sorting by angle CABD. Split by pairs - CA, AB, BD, DC.
For each pair we draw spline through points on outer road edge and plain lines through middle
points of roads. Also we add extra geometry for sidewalks/borderstones.
After we got 2D geometry we project it to the ground. I project all road itersection coordinates to
terrain and then smooth-out roads using Spline. And then correct the landscape to prevent it being
higher than the road. That is basic idea. Hope that helps.
Some people suggest using shader magic to build roads directly using terrain itself, but the solution is too complex and have too many limitations.