Convex hull implementation in GLTF

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Convex hull implementation in GLTF

Postby Leadwerks » Fri Nov 15, 2019 5:35 am

Hi, I am in a discussion to propose building collisions shapes into the GLTF spec here:
https://github.com/KhronosGroup/glTF/is ... -554283346

The appeal here is that artists can set there collision geometry up in the modeling application and export the visual and collision geometry as one single file that is ready to use.

I never liked Collada, but GLTF is actually working well for me. Collisions shapes from Blender and Max are pretty straightforward, but there's a bit of a snag with convex hulls. A point cloud is not really a consistent description of a convex hull at all, because the build step can require additional tolerance values, and these will vary based on where they are being used.

So I thought creating a consistent definition of a convex hull would be the best approach here. This would consist of a vertex array and an array of faces, defined by a plane and a list of indices. Is this consistent with the way Newton internally stores convex hulls? Do you think in the future we could build hulls by explicitly stating the face geometry? Any suggestions on how to improve this idea?
User avatar
Leadwerks
 
Posts: 532
Joined: Fri Oct 27, 2006 2:54 pm

Re: Convex hull implementation in GLTF

Postby Julio Jerez » Fri Nov 15, 2019 10:18 am

no sure why this is a problem, Newton adheres to the strict definition of a Convex Hull.
https://en.wikipedia.org/wiki/Convex_hull

as long as you get the set of vertices from, either a vertex cloud, a set of edge or a set of faces
then ther is no problem. so you can include any data you wish in the file Newton onle require a set of vertices.
the importer will get the vertices from the input data.
and if you need to write an exported, you can use teh debug display for getting teh set of planes, face or edges.
Julio Jerez
Moderator
Moderator
 
Posts: 11086
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex hull implementation in GLTF

Postby Leadwerks » Fri Nov 15, 2019 10:24 am

Blender has a parameter for "minimum triangle area" and Newton has a tolerance value in the convex hull creation function. Other engines and applications probably have something similar. So I was thinking that there is some small ambiguity there, under certain circumstances.

I could easily see this happen where an artist exports a model from Blender that happens to use a huge scale for the root pivot (making for tiny hull vertex points below the threshold the user has set when they are loading the hull), then they load it in Newton and wonder why the convex hull is missing faces. This could happen all the time, because a lot of GLTF files are converted from FBX and rescaled by a factor of 100 or 1000.

That doesn't mean newton has to support this, but maybe the file format should require explicit face information instead of potentially ambiguous point cloud data?
User avatar
Leadwerks
 
Posts: 532
Joined: Fri Oct 27, 2006 2:54 pm

Re: Convex hull implementation in GLTF

Postby Julio Jerez » Fri Nov 15, 2019 11:32 am

I do not care what Blend does or why.
Like I sad before the convex hull algorithm in newton produce exact convex hulls with integer accuracy.
if you pass a shape with too many points, it will make a dense hull, that's why there is a tolerance.
if you want exact hull just ignore the tolerance, that does not affect the accuracy of the physics but will affect the memory and speed.
I am not changing how that work because is correct 100%
if Blender has some different definition they has to change their, our is correct by text book mathematical definition.

Edit:
And again why is that a problem when all the Vertex info is the one thing that is common to all algorithm.
Just use the vertices and ignore the rest.

My guess is that some how some self appointed expert decided they want to export internal format of how the generate the Hull so that the do not have to recreated. But that I do not care.
.
Julio Jerez
Moderator
Moderator
 
Posts: 11086
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex hull implementation in GLTF

Postby Leadwerks » Sat Nov 16, 2019 6:14 am

Okay, so you don't think it's a problem. I am hoping to get this approved and implemented in the Blender exporter because it would make the art pipeline a lot easier for my users.
User avatar
Leadwerks
 
Posts: 532
Joined: Fri Oct 27, 2006 2:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron