Procedural Road Generator
Generates procedural roads, bridges, and terrain cuts/fills using a blazing fast 2.5D approach.
Overview
Generates procedural roads, bridges, and terrain cuts/fills using a blazing fast 2.5D approach.
Inputs (11)
- Centerlines (Curve): List of 3D road centerlines
- Terrain (Mesh): Base landscape mesh
- Directions (Integer): Number of directions (1 or 2)
- Lanes/Dir (Integer): Number of lanes per direction
- Lane Width (Number): Width of an individual lane
- Shoulder (Number): Width of the hard shoulder
- Threshold (Number): Max vertical distance before becoming a bridge
- Pillar Sep (Number): Distance between bridge pillars
- Blend Angle (Number): Embankment cut/fill slope angle (degrees)
- Subdivide (Number): Resolution along the road for terrain modification
- Colorize (Boolean): Colorize terrain/volumes for Cut (Red) and Fill (Blue)
Outputs (10)
- Terrain (Mesh): Modified terrain mesh
- Road Table (Mesh): Asphalt surface mesh
- Lanes (Curve): Lane centerlines
- Railings (Curve): Road boundaries and shoulders
- Pillars (Curve): Bridge pillar lines
- Cut Volume (Mesh): Excavated earth volume
- Fill Volume (Mesh): Added earth volume
- Contours (Curve): Normal contours (1m)
- Main Contours (Curve): Main contours (5m)
- Info (Text): Method, assumptions, simplifications and references.
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- Each centreline is sampled every Subdivide metres. At each station a horizontal normal (tangent × Z) gives the deck edges at ± (Directions × Lanes/Dir × Lane Width / 2 + Shoulder) and the lane centrelines. The deck is flat across at the centreline Z.
- The terrain height under the centre and both edges is found by vertical ray casting. If the centreline is more than Threshold above the terrain the station is a bridge: no earthworks, and a pillar line is drawn down to the terrain at least every Pillar Sep, measured along the centreline arc length.
- Otherwise, at each edge differing from the ground by more than 0.1 m, a ray is cast outwards at Blend Angle from horizontal, up for cut and down for fill; where it hits the terrain is the daylight point. If it misses, or the edge is within 0.1 m, the slope toe is put 2 m out at ground level.
- Cut and fill volumes are built between consecutive station profiles (daylight, edge, centre, edge, daylight versus the original ground under the same points). Each strip is split into triangles, split again where road and ground cross, and the volume is plan area × mean depth of each prism.
- The terrain is rebuilt: original vertices within the daylight width + 1.5 × Subdivide of any station are removed, the station points are added (except those near other roads), and the set is re-triangulated with 2D Delaunay; triangles with an edge over 150 m are removed.
- Outputs: modified terrain, deck meshes, lane and edge polylines, pillar lines, closed cut and fill meshes, and contours of the output terrain every 1 m (Contours, levels not on a 5 m multiple) and every 5 m (Main Contours); total cut and fill in m³ are shown on the component only.
Assumptions
- Centrelines are 3D and already carry the design levels; the tool does not design a vertical alignment.
- Model units are metres (fixed 0.1 m, 2 m, 150 m and 10 000 m ray offset); other units raise a warning.
- The terrain is a single-valued surface (one height per plan point).
Simplifications and limits
- No crossfall, camber or superelevation; the deck is level across.
- Deep cuts (tunnels) are not detected; only high fills become bridges.
- Volumes use the prismoid approximation between stations spaced Subdivide apart; stations more than 3.5 × Subdivide apart (gaps, bridges) are skipped.
- Junctions are handled only by removing terrain points near other roads; there is no junction geometry.
- A tangent that turns more than 90° between stations is treated as flipped and reversed, so hairpins with a coarse Subdivide can get wrong edge sides.
Workflow
- Road centrelines with levels (for example from a road network tool) and a terrain mesh -> Centerlines and Terrain.
- Modified Terrain -> slope, flood or visibility analyses.
References
- Grasshopper Delaunay solver (Grasshopper.Kernel.Geometry.Delaunay) for re-triangulation.