Sick Design
Dear reader,
This week started with some paperwork and then I got sick (still am). Pretty much no code was produced but I had the energy to work on designing my road generation system further. Here is a very brief devblog about it (just go watch Sebastian Lague's newest video if you want more code):
Where I left Off
As of last week, my road generation consisted of a road profile extruded along a curve (+ repeating small meshes). This works for single stretches of road but won't work for junctions:

How is the road surface A morphed into road surface B at the junction?
What happens to potential fences?
In addition, I want road profiles to be modular (e.g. A fence, some asphalt section, another fence) so that they can easily be combined into many road types.
Where I'm going
Road Profile Section
The idea I am going for (I'm skipping the "why and how I got there") is to define a road section. Think a concrete lane, a dirt path, a crash barrier, a median, etc.
Each road section contains the following:
- its extruded ground strips (mostly flat, at least not concave), where the car would usually drive
- its extruded fixtures (can be any shape), think fences or other elements extruded along road but that could be omitted (see below)
- its repeated attachments (c.f. last week's work)

And a road would be composed of a list of left road sections and a list of right road sections (each can also individually be mirrored), to be used on either side of the path it is created along.

Road Transition
Before jumping into junctions, let's see how this new road profile definition will help for auto-generated transitions between two distinct road profiles.
The idea is simple :
1. match as many road profile sections together (not yet sure in which order, but I will probably prefer matching from outside to inside as to preserve borders which are often fences or similar important geometry); they will be extruded just as before and no transition needed
2. the unmatched blocks can be blended together through their ground strips only (fixtures and attachment are not created for transitions, instead I place "end caps" meshes to close the gaps they would create)
Here is a visual example (in this specific case, the two road profiles have matching border sections but a mismatching middle section that can be blended with simple smoothstep curves:

Road Junction
Road junctions are a bit more complex but use the same logic.
Imagine there is a main road and a side road parting from main road's right side (could be at any angle). Right sections of main road will be matched (or blended, just as for transitions) with right sections of side road, and with left sections of side road but in reverse order (see diagram below). Matched sections (below in green and brown) are extruded completely (light strips) between the 2 road profiles and partially just like above (dark strips) to connect them to main road. Unmatched sections of main road can be extruded normally along main road's path (here to the left of green and brown strips). Finally, unmatched sections of side road only have to transition to a flat profile (the right side of main road's unmatched sections, here in red). In addition I can add a fillet (rounded corners at junction, here represented in blue).

Obviously this extends to intersections (the left side of the road was unused in this algorithm).
That's about it for this week! I hope I have transitions working by next Sunday, and maybe intersections (still unsure how many holes my suggested algorithm has!). There will also first be quite a bit of work to convert existing algorithm to this new road profile definition.
