KHR_implicit_shapes extension Draft Proposal#2370
Conversation
|
Rename "convex"->"convexHull". Tidy up phrasing, documentation. Improved introduction text; add an inline sample defining a shape. Clarifications around degenerate shapes & node scale. Remove backticks when not referring to a property.
There was a problem hiding this comment.
The contents of this PR do not match the repo in which the extension was developed: https://github.com/eoineoineoin/glTF_Physics/tree/master/extensions/2.0/Khronos/KHR_collision_shapes/schema
If changes are needed, the original repo should also be updated so that it stays in sync.
|
note that in X3D
Collision for navigation can be a property on Grouping Node types
https://web3d.org/documents/specifications/19775-1/V4.0/Part01/components/navigation.html#Collision
and then there is a whole Rigid Body Physics Component for other object-object collisions
https://web3d.org/documents/specifications/19775-1/V4.0/Part01/components/rigidBodyPhysics.html
________________________________
From: Aaron Franke ***@***.***>
Sent: Thursday, May 30, 2024 6:17 PM
To: KhronosGroup/glTF ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [KhronosGroup/glTF] Merge of KHR_collision_shapes extension (PR #2370)
@aaronfranke commented on this pull request.
The contents of this PR do not match the repo in which the extension was developed: https://github.com/eoineoineoin/glTF_Physics/tree/master/extensions/2.0/Khronos/KHR_collision_shapes/schema
________________________________
In extensions/2.0/Khronos/KHR_collision_shapes/schema/glTF.KHR_collision_shapes.shape.mesh.schema.json<#2370 (comment)>:
+ "skin": {
+ "description": "The index of a skin with which to deform the mesh.",
+ "allOf": [ { "$ref": "glTFid.schema.json" } ]
+ },
+ "weights": {
+ "type": "array",
+ "description": "The weights of the instantiated morph target.",
+ "minItems": 1,
+ "items": {
+ "type": "number"
+ }
+ },
I'm confused, why are skins and weights used for collision meshes? Where was the discussion on this? What is the use case?
—
Reply to this email directly, view it on GitHub<#2370 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB2TSM72PNKRZZVZHCH2ZF3ZE6QOZAVCNFSM6AAAAABE5T5AW6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAOBZGQ2TEMJVHE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Remove convex hull options from base KHR_collision_shapes; for many
cases, convex hulls are not necessary and having to support convex hull
generation in a viewer may be a significant implementation burden.
Refactor morph targets to support the common use-case of describing a
mesh collider which intends to use the same morph target weights as a
node's instance weights. Add an explicit recommendation for how an
extension can reference a collision shape.
Upgrade schemas to draft 2020-12.
|
@eoineoineoin - Thanks for bringing up 'implicit shapes'. If I could pick two shapes that would help AEC, it would be cylinder and cube. We could add a million other shapes, but I would compromise everything, just to get these two into a future spec somehow. We pay a very high price for cylinders (HVAC, railings, cables, rebar, etc). If the industry agreed on this, there would be a lot of precision gained (measurement), less data-loss (from pre-baked tessellation) and far fewer triangles transported and rendered. Same for 'Cubes'. If the industry agreed on a cube shape, rather than "I think these 16 triangles are a cube", it would add a lot of meaning for AEC - the design intent is captured, it's manifold, it has an agreed volume, render outline-style without guessing, improved z-fighting of overlapping volumes. I know it's a very low bar, but you've got to start somewhere and these two additions add an impressive amount of value IMHO. |
|
@wallabyway I've lost track of some of the discussion/developments here, and am (unfortuantely) not up to date. But a while ago, I also advocated for basically creating When "shapes" are defined here (non-renderable, as part of a "collision" extension), then someone will create a new extension that defines the same shapes, but "renderable". And in the worst case, one defines a "box" as (min, max), and the other one defines a "box" as (origin, size), and we all know what happens then... Some further related discussion is in #1135 and around #1986 (comment) , and many issues that are linked to/from these. (It's hard to wrap this up - that's why I lost track...). |
Hey Marco, Right, it does seem that there's interest in using the shapes for rendering, amongst other things. So, at the very least, there's a rename of the extension and associated reworking of documentation in the works, to ensure it's obviously usable for multiple different use-cases. The "mesh" shape type is causing us some hassle, though, so I want to see if you have any thoughts here. For things like physics, selectability, UI, etc., it's useful to be able to describe a shape which is derived from a
My concern is that with option 1, the options available in the |
|
It's hard to say anything really profound here, without all the context, and not knowing the plans that may have been discussed internally already. So all I can say is very high-level, and should be taken with a grain of salt. I think that having a real glTF
That said, from my current, limited understanding, I'm not sure what the problem would be with the point that " glTF meshes are already renderable via nodes" that you mentioned:
If I understood your concern correctly, then it is that someone could do something like Or, referring to your point
Then I think that the (I might be missing a point here...) |
|
I have been reading through the recent changes to use a collider or trigger "geometry" object. I have some concern with the new version of the spec because it references "node", that implies referencing a node, which must be visible in core gltf. Is there a way to use meshes in physics colliders without rendering those meshes? Related to this problem is a confusing paragraph here, so I would like some clarification on this:
if I understand correctly, does this paragraph that the nodes and child nodes (a comment by Khronos members implies this actually means descendants) in the context of mesh geometry are taken in local space of the referenced if so, can I ask if an acceptable way to implement hidden mesh collision shapes is to make a node whose scale is [0,0,0] (which hides the mesh as per the core gltf spec): since the collision shape children use a coordinate space relative to this node, child nodes will ignore the 0 scale. Does this make any sense? if for some reason using [0,0,0] scale is not possible, the only alternatives I can think of are using a translation at 1e+99 to effectively hide the mesh, or relying on the node visbility extension (but this will not degrade well to older versions of Blender, for example) |
|
|
||
| | | Type | Description | | ||
| | ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| | **plane** | `object` | A plane centered at the origin in local space, with normal along the Y axis in local space, optionally with finite extents and may be double or single-sided. | |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| When the `type` of a shape refers to a shape type defined by this extension, the shape must not supply a value for a different shape type e.g. a shape whose `type` is "box" must not have a defined `sphere` property. Similarly, if `type` does not reference a shape type declared by `KHR_implicit_shapes`, an extension or other mechanism should supply an alternate shape definition. | ||
|
|
||
| By default, planes have infinite extents along their tangent and bitangent vectors, specified as X and Z in local space, respectively. A plane may optionally provide `sizeX` and `sizeZ` properties to specify a finite size along these axes. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| } | ||
| ``` | ||
|
|
||
| To describe the geometry which represents the object, shapes must define at most one of the following properties: |
There was a problem hiding this comment.
Consider requiring the corresponding object (so it's always available in the Object Model).
There was a problem hiding this comment.
Do you mean that even if a shape was utilizing the default values, you'd want to require an empty object? e.g.
"shapes" = [
{
"type": "sphere",
"sphere": {}
}
...
One complication on REQUIREing one of the objects that other extensions may add additional types and may not wish to have a fallback:
"shapes" = [
{
"type": "teapot",
"extensions": {
"ext_teapot_shape" : {
....
}
}
}
...
For those types, we wouldn't want to require an unrelated object in the shape.
There was a problem hiding this comment.
Even when an object is syntactically empty it's not semantically empty because most shape properties have default values so, e.g., "sphere": {} actually means "sphere": { "radius": 0.5 }.
The extension should require an object matching the type so future extensions wouldn't require unrelated objects.
|
|
||
| When the `type` of a shape refers to a shape type defined by this extension, the shape must not supply a value for a different shape type e.g. a shape whose `type` is "box" must not have a defined `sphere` property. Similarly, if `type` does not reference a shape type declared by `KHR_implicit_shapes`, an extension or other mechanism should supply an alternate shape definition. | ||
|
|
||
| By default, planes have infinite extents along their tangent and bitangent vectors, specified as X and Z in local space, respectively. A plane may optionally provide `sizeX` and `sizeZ` properties to specify a finite total size along these axes. |
There was a problem hiding this comment.
As currently written, the language may imply that either both plane extents must be set or none.
|
|
||
| By default, planes have infinite extents along their tangent and bitangent vectors, specified as X and Z in local space, respectively. A plane may optionally provide `sizeX` and `sizeZ` properties to specify a finite total size along these axes. | ||
|
|
||
| Degenerate shapes are prohibited. If provided, a plane must have positive non-zero `sizeX` and `sizeZ` extents. A sphere must have a positive, non-zero radius. A box shape must have positive non-zero values for each component of `size`. The cylinder and capsule shapes must have a positive, non-zero `height`, both `radiusTop` and `radiusBottom` must be non-negative, and at least one of `radiusTop` and `radiusBottom` must be non-zero. |
|
|
Draft of an extension which describes generic, non-renderable shapes suitable for collision detection.
Known Implementations
Blender importer/exporter
Babylon.js importer
Godot importer
Sample Assets
https://github.com/eoineoineoin/glTF_Physics/tree/master/samples