Page 1 of 1

Slow load times for your Ages? I have a solution for you...

PostPosted: Sun Apr 19, 2009 10:36 pm
by Paradox
Although I realize this isn't the optimal place to post such information, I also realize that only a subset of builders will understand this information, and even fewer will understand the mathematically detailed explanation (and those who do: you understand more than I do). However, this information should be available somewhere for people who understand the basics of colliders and want to improve their Ages.

Do not use Triangle Mesh colliders!

Okay, slightly more detailed: Use Convex Hull colliders wherever you can!

It is actually faster in many cases for the physics engine to calculate convex bounds rather than concave triangle bounds. In one example, I replaced the floor of my Pahts Shell with 3 convex meshes rather than a single triangle mesh. It loads much faster once I removed unnecessary colliders and converted as many as possible to convex hulls.

Here is the actual mesh, which I had originally set to use triangle bounds. This is a top view, but the floor extends for about 1 Blender unit down.
proxybounds.jpg
proxybounds.jpg (35.52 KiB) Viewed 7833 times


Here are the new colliders (3 of them), all using convex hull bounds, and much faster for loading and collision detection.
convexbounds.jpg
convexbounds.jpg (32.99 KiB) Viewed 7833 times


Convex bounds work as if the object was "shrink-wrapped", forming a collider from the vertices the farthest away from the centre. With convex bounds, you need only to store the vertices that are farthest away, whereas triangle/proxy bounds need to store all vertices and faces, even if they aren't needed.

Good things to use convex bounds for:
  • Bookshelves
  • Desks
  • Furniture in general
  • Trees (only the trunks if they are fairly straight, no collision on the leaves)
  • Doors
  • Platforms
  • Cubic walls
  • Anything convex that is animated (this is where things will speed up a LOT)

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Mon Apr 20, 2009 8:32 am
by Jojon
Oho, interesting. Showing my geometry ignorance, it surprises me that it is a simpler calculation to check a spot on a runtime generated convex hull, than a predefined flat surface. This seems well worth trying - thanks for telling.


Hmm, out of irritatingly compulsive curiousity: so all the parts in the pictures form a single flat surface, or is there a 1' height difference?

Just counting faces, it looks like you've saved yourself 18 triangles (which should be removeable even with static_tris, or?). Hmm, if there's nothing on the outside and the surfaces are indeed flat, you should be able to go wild and get away with just three, or max five, in total, by extending outwards... :P

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Sun Apr 26, 2009 11:36 am
by Paradox
The floor is all flat, and about 1 blender unit thick.

A bit more advice: Build custom collider meshes whenever possible, and do not add collision faces for parts that are inaccessible. The engine still has to calculate the collider even if it will never be used. (Example: most of the outside of the Pahts shell walls are always again another shell and will never need collision for those faces).

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Sun Apr 26, 2009 5:39 pm
by Jusme
But then running halfway into that wall?

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Sun Apr 26, 2009 9:46 pm
by Jojon
Jusme wrote:But then running halfway into that wall?


The OUTside of the wall, which faces the OUTside of your neighbour's wall (which is likely to have its own inside collider, too). I'd extend Paradox's argument and say there's visible geometry that one could hand-cull here, as well (unless your neighbour has decided to grab land and utilise your outer wall as his inner one. :9) -- additionally, parts of those shell walls are made up from doublesided faces, which I don't believe they need to be - not that they are all that many, mind.

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Mon Aug 03, 2009 6:10 am
by Jahmen
Ah a lesson in Geek :ugeek: 101. :ugeek: Just pullin ya chain! :lol: Can't wait to try it.

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Thu Jan 14, 2010 7:36 pm
by Shoggoth
I noticed you recommended using convex hulls for furniture. What's the advantage of using the convex hull option, versus a box, for rectangular objects like doors, shelves, straight benches, etc.?

Re: Slow load times for your Ages? I have a solution for you...

PostPosted: Thu Jan 14, 2010 8:24 pm
by Paradox
Box bounds are even faster than convex hulls, but they aren't appropriate for all objects. If you can get away with a box, use one. If you need things more rounded and shaped, use convex hulls.

If you need something that absolutely can't use convex hulls, make a separate low-poly collision mesh with triangle bounds.