HackerTrans
トップ新着トレンドコメント過去質問紹介求人

Ef996

no profile record

投稿

Show HN: I was surprised by this interactive GPU line rasterization explanation

twitter.com
6 ポイント·投稿者 Ef996·2 か月前·0 コメント

The Simple Geometry Behind Any Road

sandboxspirit.com
5 ポイント·投稿者 Ef996·3 か月前·0 コメント

The Data Structures of Roads

sandboxspirit.com
5 ポイント·投稿者 Ef996·4 か月前·0 コメント

コメント

Ef996
·3 か月前·議論
Author here. Engineers use clothoids as the primary geometry for high-speed roads by offsetting a centerline clothoid. However, the offset of a clothoid is not itself a clothoid, so the left and right edges are not mathematically clothoids.

A clothoid is simply a mathematically ideal way to achieve continuously increasing curvature along a path. In practice, it can be approximated by chaining multiple circular arcs with decreasing radii.
Ef996
·5 か月前·議論
Nope. But I mean aren't functions of circles essentially some kind of SDFs in 2d? Or at least those of disks.
Ef996
·5 か月前·議論
I will definitely explore this in the future as architecture is probably my next passion after roads :D
Ef996
·5 か月前·議論
This is amazing. Some objective would be great
Ef996
·5 か月前·議論
Author here: i agree the article oversimplified here and in practice vehicle tracks can sometimes be non concentric. But it has nothing to do with differentials. Differentials just allow wheels to rotate at different speeds (as perimeter of a smaller radius circle is smaller the outer one). Non parallelism usually comes from the Ackerman steering or slipping. But rear tracks of a vehicle going slowly through sand will always be concentric. Parallelism is important for engineers because it also allows multiple vehicles to go in parallel on a multi lane road. You can see how that is failing with bezier paths in the CS2 ss in the article. Also hairpin turns are usually designed with arcs in mind as well
Ef996
·5 か月前·議論
Will share more soon. I have some more recordings of it on x https://x.com/SandboxSpirit if you're interested.
Ef996
·5 か月前·議論
Thanks for references! I initially considered bevy for this but I was a bit scared it was not mature enough. How do you find it now?
Ef996
·5 か月前·議論
Haha. I myself tried to play CS like that. Start with a historical core. The thing is the way the game is implemented buildings only have rectangular footprints while in reality buildings occupy the spaces more organically. I actually spent quite some time on google maps trying to see what pattern historical buildings followed to fill in spaces but couldn't get a definitive answer. I drafted it at some point in sketchup. Here is the result

https://imgur.com/a/procedurally-generated-buildings-that-or...
Ef996
·5 か月前·議論
True. I mostly meant not personal vehicles, so jut buses, trams etc. I supposed emergency services will use those dedicated lanes. or maybe civilization is so advanced those will be served via flying only. Idk just since fiction thinking.
Ef996
·5 か月前·議論
Yep, good point. I am myself a huge fan of livable oriented infrastructure (bike lanes, pedestrian paths, public transportation) but the hard truth is that roads were initially designed for carriages and later for cars. A though I recurrently have is how would a city designed from scratch by a civilization that uses only bikes and walking look like?
Ef996
·5 か月前·議論
I am a huge fan of satisfactory as well (probably no surprise for anyone)
Ef996
·5 か月前·議論
I mean they are not a math nightmare per se if you’re comfortable with the theory. What I meant is that they become comparatively complex to integrate into a system like this. Think about arc length, compute intersections, reparametrization, etc., and with clothoids that usually means some complex numerical algorithms.

Using circular arcs or even simple third-degree polynomials (like cubic parabolas) reduces many of those operations to trivial O(1) function calls, which makes them much cheaper to evaluate and manipulate procedurally, especially when you're computing it 60 times per frame
Ef996
·5 か月前·議論
Wow, that’s a really detailed deep dive, saved it for a read later. I didn’t even realize clothoids are also tricky to connect. I never really dared to jump into actually implementing them myself.
Ef996
·5 か月前·議論
Yes, I don't even know how I didn't know about this at the time of wiring the article. But a must read for sure!
Ef996
·5 か月前·議論
Glad you mentioned it. Cubic parabolas were actually used by eraly railway engineers as good approximations of clothoids back when numerically solving a true euler spiral was a daunting task.

They are visually very close because their curvature increseases approximately linearly along the curve but not exactly. Mathematically speaking if you wirte the cubic parabola as something like y = kx^3, the second derivative (which give the curvature) grows linearly with x which makes it behave similary in gentle transitions.

The problem is that the second derivative is not enough alone for having a true smooth curvature. The real curvature formula has in the denominator the first derivative as well (slope) making it not increase perfectly linearly along the curve. (denominator becomes larger and larger as x incrases)

But yeah, cubic parabola is basaically a good enough approximation. Might be a good solution for a system like this.
Ef996
·5 か月前·議論
Very happy reading this because I was always thinking exactly the same about historical games. One of my turn offs for any historical city building is when they are grid based. I always found that to be highly unrealistic, but I yeah, was aware that it was just some unneeded complexity and just my nerdy nitpicks. The point you make would’ve actually been a strong argument in my article. Too bad I didn’t have the inspiration to include it. The way historical cities developed in an ordered yet intricate way without any central planning (same as ant colonies) is actually very fascinating and I might write about this at some point.
Ef996
·5 か月前·議論
For sure I will. Thanks a lot for your interest. To anybody's disappointment, I didn't even know Hacker News was a thing until I saw a ton of traffic coming from it. But I guess I'll be more active here since there are a lot of like-minded people.
Ef996
·5 か月前·議論
Hello, I am the creator of this road system. The thing is that I myself don't even know what I want to do with it. lol. Maybe an asset or a game (a bit scared to jump in a full fledge game to be honest).

I am a fun of Junxions my self which follow closely. But the approach in my system if very different. Junxions creator uses the same kind of node base/bezier shapes paradigm where intersections happen as node graphs and not automatically as collisions between road segments. It's hard to explain but I am planning to dive into more details on why those two approaches are different in my next blog deep dive.