Skip to content

Commit

Permalink
Add EXT_implicit_geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
j9liu committed Jun 4, 2024
1 parent c805aaf commit dc1029a
Show file tree
Hide file tree
Showing 15 changed files with 655 additions and 26 deletions.
193 changes: 193 additions & 0 deletions extensions/2.0/Vendor/EXT_implicit_geometry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# EXT_implicit_geometry

## Contributors
- Sean Lilley, Cesium
- Janine Liu, Cesium

## Status
Draft

## Dependencies
Written against the glTF 2.0 specification.

## Overview

This extension allows mesh primitives to represent renderable implicit surfaces. Typically, a glTF mesh primitive requires `attributes` that supply mesh data, and uses `mode` to indicate the mesh topology. With `EXT_implicit_geometry`, the primitive may omit these properties and instead use the extension to infer the implicit 3D volume.

The following example illustrates how a primitive with this extension may represent an implicit box.

```
{
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"box": {
"size": [2, 2, 2]
}
}
}
}
]
}
```

Primitives with this extension may still be affected by node transforms to position, orient, and scale the shape as needed.

## Supported Geometry

Currently, this extension supports the following implicit geometries:
- [`box`](#box)
- [`cylinder`](#cylinder)
- [`sphere`](#sphere)
- [`ellipsoid`](#ellipsoid)
- [`region`](#region)

Only **one** shape may be defined at a time.

By default, the implicit 3D volume is assumed to fill the entire shape specified in the extension. However, each shape allows an optional `slice` property to define the subsection of the shape in which the 3D volume is actually rendered. For instance, while the extension may define an implicit sphere, its `slice` can limit the volume to be only half of the full sphere.

### Box

The `box` property represents an axis-aligned box that is centered at the origin. The `size` property indicates its size in meters along the `x`, `y`, and `z` axes.

<table>
<tr>
<th>
Example
</th>
<th>
Visual
</th>
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"box": {
"size": [1, 0.5, 2],
}
}
}
}
]
</pre></td>
<td>
<img width="600px" src="figures/non-uniform-box.png"/>
</td>
</tr>
</table>

### Cylinder

The `cylinder` property represents a cylinder that is aligned with the `y`-axis and centered at the origin. The `radius` and `height` properties indicate the dimensions of the cylinder in meters.

<table>
<tr>
<th>
Example
</th>
<th>
Visual
</th>
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"cylinder": {
"radius": 2,
"height": 3
}
}
}
}
]
</pre></td>
<td>
**TODO** visual example
</td>
</tr>
</table>

### Sphere

The `sphere` property represents a sphere that is centered at the origin. The `radius` of the sphere is specified in meters.

<table>
<tr>
<th>
Example
</th>
<th>
Visual
</th>
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"sphere": {
"radius": 2,
}
}
}
}
]
</pre></td>
<td>
**TODO** visual example
</td>
</tr>
</table>

### Ellipsoid

The `ellipsoid` property represents an ellipsoid that is centered at the origin. The `radii` property indicates the radii of the ellipsoid in meters along the `x`, `y`, and `z` axes.

**TODO** visual example

<table>
<tr>
<th>
Example
</th>
<th>
Visual
</th>
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"ellpisoid": {
"radii": [2, 3, 4]
}
}
}
}
]
</pre></td>
<td>
**TODO** visual example
</td>
</tr>
</table>
```
### Region
The `region` property represents a region above the surface of an ellipsoid. Though the ellipsoid itself is centered at the origin, the region may be distant from the origin due to its properties.
The `semiMajorAxis` property indicates the radii of the ellipsoid in meters along the `x`, `y`, and `z` axes.
## Optional vs. Required
This extension is required, meaning it should be placed in both the `extensionsUsed` list and `extensionsRequired` list.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions extensions/2.0/Vendor/EXT_implicit_geometry/schema/box.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "box.schema.json",
"title": "Box",
"type": "object",
"description": "An implicit box centered at the local space origin.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"size": {
"type": "array",
"description": "The size of the box in three dimensions.",
"items": {
"type": "number"
},
"minItems": 3,
"maxItems": 3
},
"bounds": {
"$ref": "box.bounds.schema.json",
"description": "The optional bounds of the box."
}
},
"required": [
"size"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "cylinder.bounds.schema.json",
"title": "Cylinder Bounds",
"type": "object",
"description": "A set of bounds for an implicit cylinder surface. Defines the subsection of the cylinder that the implicit volume actually occupies.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"minRadius": {
"type": "number",
"description": "The minimum radial bound of the cylinder.",
"minimum": 0,
"maximum": 1,
"default": 0
},
"maxRadius": {
"type": "number",
"description": "The maximum radial bound of the cylinder.",
"minimum": 0,
"maximum": 1,
"default": 1
},
"minHeight": {
"type": "number",
"description": "The minimum height bound of the cylinder.",
"minimum": 0,
"maximum": 1,
"default": 0
},
"maxHeight": {
"type": "number",
"description": "The maximum height bound of the cylinder.",
"minimum": 0,
"maximum": 1,
"default": 1
},
"minAngle": {
"type": "number",
"description": "The maximum angular bound of the cylinder in radians. Values must be in the range [-pi, pi].",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"default": -3.14159265359
},
"maxAngle": {
"type": "number",
"description": "The maximum angular bound of the cylinder in radians. Values must be in the range [-pi, pi].",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"default": 3.14159265359
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "cylinder.schema.json",
"title": "Cylinder",
"type": "object",
"description": "An implicit cylinder centered at the local space origin.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"radius": {
"type": "number",
"description": "The radius of the cylinder in local space.",
"minimum": 0
},
"height": {
"type": "number",
"description": "The height of the cylinder in local space.",
"minimum": 0
},
"bounds": {
"$ref": "cylinder.bounds.schema.json",
"description": "The optional bounds of the cylinder."
}
},
"required": [
"radius",
"height"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "ellipsoid.bounds.schema.json",
"title": "Ellipsoid Bounds",
"type": "object",
"description": "A set of bounds for an implicit ellipsoid surface. Defines the subsection of the ellipsoid that the implicit volume actually occupies.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"minRadius": {
"type": "number",
"description": "The minimum radial bound of the ellipsoid.",
"minimum": 0,
"maximum": 1,
"default": 0
},
"maxRadius": {
"type": "number",
"description": "The maximum radial bound of the ellipsoid.",
"minimum": 0,
"maximum": 1,
"default": 1
},
"minAngle": {
"type": "array",
"description": "The minimum angular bounds of the ellipsoid in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
},
"minItems": 2,
"maxItems": 2,
"default": [-3.14159265359, -1.57079632679]
},
"minAngle": {
"type": "array",
"description": "The maximum angular bounds of the ellipsoid in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
},
"minItems": 2,
"maxItems": 2,
"default": [3.14159265359, 1.57079632679]
},
}
}
Loading

0 comments on commit dc1029a

Please sign in to comment.