I’ve learned that video game ‘clipping’ is caused by high velocity, thin colliders, and too-slow physics updates. Why are terrain surfaces in most 3D video games paper-thin? Why isn’t terrain given extra fill/thickness inside and under it to prevent ‘falling through the map into the void’?

1.11K views

I could see why you might not want to fill under the terrain in a game that features things like underground caves, but thin terrain seems to be present in a huge majority of 3D games (even those without underground features) and is not engine-specific. Why is terrain almost always a fragile piece of origami that’s so easily punctured?

In: Technology

39 Answers

Anonymous 0 Comments

So game engines already do this or they would never work at all.

The collision engine checks “which side of this triangle am I on?” But if you build one of these engines you quickly find that a hard check clips all the damn time.

So you add what’s called an “epsilon” to the check. Essentially as you say your wall “thickness” – if something jumped past the wall in my calculation of where it was “supposed” to be, but not by that much, treat it as still outside/touching the wall and move it back outside. Some games do this by just moving things back immediately, some essentially put little “springs” on the object to “pull” it back outside.

You can technically make that epsilon as big as you want! But then – you can’t make any feature thinner than it. Like, if you want to walk on the roof and in the attic – too thick and it keeps kicking you up to the roof.

Also the springs solution (which is otherwise generally simpler/more general) can have weird effects when you’re too far from the surface – stuff that clips too far immediately gets *launched* back in the other direction. Sort of like the difference between walking and jumping on a trampoline.

You can try to track things more granularly but it all comes down to tradeoffs in performance vs dev time vs accuracy. And there’s always some situation the designers didn’t think of – like a tire that shoots off at mach 4 when you place it in a whole pile of grenades. In the end, computer physics is limited by its sample rate. If you’re doing physics at 30 fps, that tire moved *~~11~~ 45 meters* since your last update. You can sample faster, but then you’re making the game slower.

FWIW, some games have special logic for “terrain” that treats it as “infinitely thick” – but then your terrain and your building floors work differently, and caves and overhangs become problematic.

Source: software dev, wrote several game-style physics/collision systems in college.

You are viewing 1 out of 39 answers, click here to view all answers.