PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Terrain still has collision inaccuracies, POSSIBLY due to different triangulation #93

Open DoctorAnsem opened 4 years ago

DoctorAnsem commented 4 years ago

2019-10-10 20_28_14

This thing. It took me a while till I figured it out, but everywhere this happens there was actually a different sort of issue with the stock terrain too - during munge, the triangulation edges would be opposite of what ZE displayed (or not actually displayed but you know how square polygons are), which sometimes makes object placement on steep terrain a nightmare. Since according to the the wiki, SP terrain gets its collision from the munged stock terrain, is it possible that the visual triangulation is the same as in ZE and not the munged stock terrain?

PrismaticFlower commented 4 years ago

Yup, Shader Patch does generate the terrain's geometry itself it is perfectly possible it is doing it in a slightly different way to terrainmunge. Is it possible that TerrainOffset could be used to work around this for now, by nudging the terrain geometry a little bit to line up with the collision?

DoctorAnsem commented 4 years ago

Not really. It's not flat areas that are the problem (which they will be if the terrain is offset in height though), it's the more steep angles where triangulation actually affects the polygon's orientation. This isn't easy to explain without illustration, but basically the vertices are all in their correct places, it's the direction of the edge that splits the square that is mismatched. Basically as if visual geometry is using / and the collision mesh is using \ . Or the other way around, but I guess the point remains the same.

It's not a horribly disruptive problem to be fair, but it does raise eyebrows every now and then.

PrismaticFlower commented 4 years ago

Oh right! Triangulation of course. Don't know why I didn't click into what you were saying right away. It certainly sounds plausible to me that the way I'm splitting the quads might be causing some difference. Not sure when I'll have the time to look into it but I'll definitely try to investigate at some point.