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 May 31, 2024
1 parent c805aaf commit 659029d
Show file tree
Hide file tree
Showing 20 changed files with 677 additions and 26 deletions.
141 changes: 141 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,141 @@
# 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. The extension's properties will be used instead 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)

Each shape is represented by its aptly named property in the extension. 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 `bounds` 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 `bounds` can limit the volume to be only half of the full sphere.

### Box

The implicit **box** is axis-aligned and centered at the origin, spanning from `(-1, -1, -1)` to `(1, 1, 1)` in local space.

![](figures/unit-box.png)

The `size` property specifies the scale of the box in meters along the `x`, `y`, and `z` axes. This may be specified non-uniformly, as shown below.

![](figures/non-uniform-box.png)

The `bounds` indicate which fraction of the box is actually rendered along each axis. The range of the box is mapped between 0 and 1, where the minimum corner is represented by 0, and the maximum corner is represented by 1. Thus, the bounds on the volume are defined within this range.

![](figures/unit-box-with-bounds.png)

Like `size`, the `bounds` may also be non-uniform.

![](figures/non-uniform-box-with-bounds.png)


#### Full Example

```
{
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"box": {
"size": [2, 2, 2],
"bounds": {
"min": [0.25, 0, 0.25]
"max": [0.75, 0.5, 1]
}
}
}
}
}
]
}
```

### Cylinder

The implicit **cylinder** is aligned with the `y`-axis and centered at the origin in local space. The unit cylinder has a radius of 1 and spans from `[-1, 1]` along the y-axis. The `radius` and `height` properties specify the scale of the cylinder in these respective parameters, in meters.

**TODO** visual example

```
{
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"cylinder": {
"radius": 2,
"height": 2.5
}
}
}
}
]
}
```

### Sphere

The implicit **sphere** is centered at the origin in local space. The unit sphere has a radius of 1. A `radius` is specified to scale the sphere in meters.

**TODO** visual example

```
{
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"sphere": {
"radius": 2
}
}
}
}
]
}
```

### Ellipsoid

The implicit **ellipsoid** is centered at the origin in local space. The unit ellipsoid has radii of `[1, 1, 1]` along the `x`, `y`, and `z` axes. The `radii` property is used to scale the ellipsoid along these axes in meters.

## 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "box.bounds.schema.json",
"title": "Box Bounds",
"type": "object",
"description": "A set of bounds for an implicit box surface. Defines the fraction of the box that the implicit volume actually occupies.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"min": {
"type": "array",
"description": "The minimum bounds of the box in three dimensions.",
"items": {
"type": "number",
"minimum": 0,
"maximum": 1,
},
"minItems": 3,
"maxItems": 3,
"default": [0, 0, 0]
},
"max": {
"type": "array",
"description": "The maximum bounds of the box in three dimensions.",
"items": {
"type": "number",
"minimum": 0,
"maximum": 1,
},
"minItems": 3,
"maxItems": 3,
"default": [1, 1, 1]
},
},
}
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]
},
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "ellipsoid.schema.json",
"title": "Ellipsoid",
"type": "object",
"description": "An implicit ellipsoid centered at the local space origin.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"radii": {
"type": "array",
"description": "The radii of the ellipsoid in meters along the X, Y, and Z axes in local space.",
"items": {
"type": "number",
"minimum": 0
},
"minItems": 3,
"maxItems": 3
},
"bounds": {
"$ref": "ellipsoid.bounds.schema.json",
"description": "The optional bounds of the ellipsoid."
}
},
"required": [
"radii"
]
}
Loading

0 comments on commit 659029d

Please sign in to comment.