Road Splines Procedural Tool

Road Splines Procedural Tool

This is a new road building tool based on the built-in Unity splines & terrain tools.

I am building this because existing road tools aren’t exactly what I want, and this may help other people.

There are a number of Pros and Cons versus other road tools. It’s primarily for country road building than city building. There are no fixed pieces of road to attach, and no road textures except for very plain background textures.

Pros:

  • Auto road shader: All road details, roadside lines, intersection lines, dirt/gravel overlay, rain is automatic, non-repetitive, and customisable. Each road spline has a material instance and can be modified separately.

  • One-click Intersections: Select three spline kots, click ‘give-way’ or ‘stop’ and the intersection is done (see picture/s below). The side road is snapped at 90 degrees. Intersection lines are automatic, with customisable line colours. One line of external code can also create an intersection from three compatible knots.

  • Auto gravel (non-destructive): The terrain underneath the road is painted in real-time whenever a road spline knot is moved. Enabling auto gravel pauses terrain painting and vice-versa. Uses one terrain texture spot.

  • Auto height (non-destructive): WIP.

  • Road center camber adjust: Adjust the center height of the road between 0 - 45 degrees.

  • Road mesh bumpiness: WIP.

  • Auto sign posts: WIP.

Cons:

  • No pre-built sections of road. Does not suit city building or highways.

Other Info
There is no lag when click+dragging a road spline knot. This scene (pictured below) only has five splines, but both the road and terrain painting update at ~30 fps.

There is a gravel road shader I’m working on alongside the tarmac shader.

The road can be any width, but the tarmac shader only draws a max of two lanes at this time.

Any number of intersections can be made (with automatic line markings), but start & end intersection knots must use the start & end knot of splines in consecutive order. Side roads can be any spline start/end. Start & end knots have shared-colour marked gizmos.

This is a WIP. Most of the hard parts are done but it still has missing features. I’ll be working on these over the next few months.

Please post any feedback you have… if you think this would be suitable for your project but is missing one thing, or have any other feedback.

Thanks

Road Splines Procedural Tool:
2024-08_TestIntersection04b

Tarmac Road Shader:

Road shaders have a low-angle sheen effect, which Unitys renderer (most renderers AFAIK) don’t actually do.

The road looks good but terrain doesn’t quite match, so still thinking about which way to go with this.

With a more detailed terrain, the difference would be less noticable.

Also; the road shader doesn’t do mip-maps. Shimmering & aliased pixels aren’t very noticable in game view. TAA anti-aliasing removes 90% of the shimmering/aliasing but also detail.

Low-angle sheen & low-angle fade effects. No mip-mapping. FXAA Anti-aliasing.