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

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

Postby Paradox » Sun Apr 19, 2009 10:36 pm

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 6179 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 6179 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)
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

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

Postby Jojon » Mon Apr 20, 2009 8:32 am

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
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

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

Postby Paradox » Sun Apr 26, 2009 11:36 am

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).
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

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

Postby Jusme » Sun Apr 26, 2009 5:39 pm

But then running halfway into that wall?
Jusme
 
Posts: 84
Joined: Tue Aug 26, 2008 8:55 pm

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

Postby Jojon » Sun Apr 26, 2009 9:46 pm

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.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

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

Postby Jahmen » Mon Aug 03, 2009 6:10 am

Ah a lesson in Geek :ugeek: 101. :ugeek: Just pullin ya chain! :lol: Can't wait to try it.
Jahmen
 
Posts: 56
Joined: Sun Aug 31, 2008 3:15 am

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

Postby Shoggoth » Thu Jan 14, 2010 7:36 pm

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.?
Shoggoth
 
Posts: 91
Joined: Thu Jan 15, 2009 10:27 am

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

Postby Paradox » Thu Jan 14, 2010 8:24 pm

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.
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada


Return to Paradox's Journal

Who is online

Users browsing this forum: No registered users and 0 guests

cron