Discussion
The Simple Geometry Behind Any Road
jstanley: You're missing one very important type of curve: a clothoid (or "Euler spiral") is a curve of continuously-varying radius, these are encountered on roads very frequently. And especially on race circuits.A clothoid is used to connect two lines the same way your fillet is, except instead of just 1 radius it has a radius configured for each end and smoothly changes in between.https://en.wikipedia.org/wiki/Euler_spiralThey are also used in railways, because on a railway you don't have the freedom of moving the car's position across the road, so a transition from a straight track to a constant radius would imply an instantaneous step change in centrifugal force, or infinite jerk. Using a clothoid to smooth the change between the straight track and the constant-radius turn means the lateral acceleration increases smoothly instead of instantaneously.
red_admiral: And then you have various types of hairpin bend where you actually vary the width of the lanes with the radius: https://www.google.com/maps/@46.8360535,9.6369913,68m
dilberx: many are yet to catchup
trelbutate: I was also confused about that because they did mention clothoids in their first post: https://sandboxspirit.com/blog/art-of-roads-in-gamesAlthough re-reading that it seems they just don't want to deal with the math involved
amelius: Here's a nice article on it:https://www.dgp.toronto.edu/~mccrae/projects/clothoid/sbim20...
21asdffdsa12: Expected it to at least mention the slant imposed on any road surface so water does not pool. Disappointed to tears and thus salt-water-aquaplaning in all games build upon this.
lencastre: vehicular speed is very important as a consideration in any road curvature, as well as “pitch and yaw” when changing slope and direction at speed, so… simple it is not, and if we are mostly “offsetting” straight lines and arcs, we are doing it wrong
kalmar: The care taken here to achieve aesthetically pleasing results reminds me of this post about creating nice transit maps in the Transit App: https://blog.transitapp.com/how-we-built-the-worlds-pretties...
ajs1998: :( but the math is fun And they went through all this effort anyways, and to blog about it.
the_arun: Roads need to be in 3D, right? I mean for turning elevation on the edges matter. Are you covering them in your next post?
nkrisc: I skimmed some parts I was already familiar with so maybe I missed a mention, but the issue with transitioning from straight to circular arc like this is you get an (theoretically) instantaneous change in lateral forces on the vehicle at the transition point.Obviously it’s much less of a problem in a game, but it can look strange if you’ve implemented animations that make vehicles lean when going around curves or are limiting vehicle speeds based on those computer lateral forces.In a game at least, there’s lots of simple ways to work around the issue.In a real road, it would likely not feel good and probably would cause issues.
pontifier: When I worked on autonomous vehicles I realized that if I really wanted to figure out how to get the vehicle to end up where I wanted, I had to model the actual processes involved. It wasn't actually that difficult. I literally just generated a set of curves that would start with the wheels of a vehicle pointed straight ahead, and tracing the path the car would follow if the steering wheel started being turned at a reasonable rate to a maximum fixed angle, holding it there for some amount of time, then straightening the wheel again. This curve wasn't a simple shape at all, but it didn't matter. It gave the most accurate results. Once the family of curves was generated, I could just select the one that best fit the situation.