2023-01-31 | 2023-02-01 |
2023-02-12
2023-02-01
TMA-1
Fan's of
2001: A Space Odyssey may recognise TMA-1 as referring to the Tycho Magnetic Anomaly a.k.a. 'The Monolith'.
TMA-1
From time to time our terrain creation throws up anomalies and we currently have our own version of TMA-1 near Ladybower Reservoir.
1
2
3
4
Triangles (everything is a triangle) that have been classified as 'highway' take their height from the nearest road centre line. The third image shows how we
think the top of the monolith is getting it's height from a farm track instead of the road it is actually part of because road centre line is being clipped.
This is one of those fairly obvious bugs that make you question how something has ever worked. Can this really be the first time a road centre line is being clipped in this way? In mitigation, it probably
is happening elsewhere but it is not usually noticed because mostly there are not such extremes of elevation and there are plenty of other road centre lines nearby, to erm... take up the slack - as it were.
One thing that
really bothers me is that the code makes a big song and dance about clipping the road centre line. It actually goes out of it's way to do it. The second thing that bothers me is that I wrote that code and I have a nagging feeling that there was a very good reason for clipping it.
It's relatively straightforward to comment out the clipping part and see what happens - and that's clearly what I intend to do, but I really don't like the "comment it out and see what happens" approach.
Even more impressive in isolation
Pretty conclusive win for the "comment and see what happens" approach:
This is now fixed - but what have I broken?
Except it isn't fixed at all. The large anomaly has changed to a small anomaly:
Still broken
Time to eliminate things. First, the top view shows that the assignment of materials looks right, which implies that the triangles are being assigned the correct type. What you can see in the 'unlit' image below is a section of highway (dark grey) and what we call
KerbH
(light grey) - the horizontal part of the kerb. Also visible are two trees (one full and one partial) and two land areas 'trees' (dark green) and what is probably 'unassigned' - which shows as light green here:
Material Assignment
This is the lit version:
More confusing when lit
The wireframe show how complicated the triangulation is. All those narrow slivers are very worrying with the phrase 'floating point rounding error' ever present:
Terrifying
For reference: This is what a highway cross-section should look like. The 'hidden' transition area is only visible in the wireframe:
This is an example of the sort of mess we get into when a highway is near the corner of four AS30s with a significant slope:
Boundary problem
The only proper solution to this is to calculate heights across boundaries, i.e. treat the AS30 we are working on as the centre of nine (3 x 3) AS30s.