Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KHR_animation_pointer #2147

Merged
merged 50 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d2d2e2f
add transmission specs
jim-ec Mar 25, 2020
36c5432
add thickness spec
jim-ec Mar 25, 2020
03276f9
add absorption spec
jim-ec Mar 26, 2020
8701f10
remove optional dependency on thickness
jim-ec Mar 26, 2020
0aa4f66
fix transmission spec
jim-ec Mar 30, 2020
dfda721
Update README.md
Apr 1, 2020
2f0a7bf
Update README.md
Apr 1, 2020
9b52d13
refactor to refraction extension
jim-ec Apr 1, 2020
a87419f
update thickness extension
jim-ec Apr 1, 2020
f4f6eba
move thickness extension to its own branch
jim-ec Apr 1, 2020
e308ef5
initial draft
jim-ec Apr 1, 2020
6ebfa3c
improve thickness extension
jim-ec Apr 1, 2020
d0196ac
Merge pull request #3 from KhronosGroup/master
UX3D-nopper Apr 28, 2020
90c91ea
Merge branch 'master' into extensions/KHR_materials_thickness
jim-ec Apr 28, 2020
36ab973
Merge branch 'master' into extensions/KHR_materials_transmission
jim-ec Apr 28, 2020
5b6a698
remove refraction related files as already present in KHR_materials_r…
jim-ec Apr 28, 2020
ed16458
remove absorption related files as already present in KHR_materials_a…
jim-ec Apr 28, 2020
0c9896b
Merge pull request #4 from ux3d/extensions/KHR_materials_transmission
Apr 28, 2020
5d7d535
Minor fixes.
UX3D-nopper Apr 28, 2020
285d945
Merge pull request #7 from ux3d/extensions/KHR_materials_thickness
UX3D-nopper Apr 28, 2020
1ac92d0
Merge pull request #8 from KhronosGroup/master
UX3D-nopper Aug 13, 2020
821b165
Initial draft for EXT_lights_environment
UX3D-nopper Aug 13, 2020
a2f177c
Removed thickness.
UX3D-nopper Aug 13, 2020
5cd666e
Fixed some typos. Clarified the coordinate system.
UX3D-nopper Aug 14, 2020
969ec0b
Added physical units.
UX3D-nopper Aug 14, 2020
785ce36
Merge pull request #9 from KhronosGroup/master
UX3D-nopper Oct 19, 2020
3a89422
Merge pull request #10 from KhronosGroup/master
UX3D-nopper Sep 20, 2021
f4c8f41
Merge pull request #12 from KhronosGroup/master
UX3D-nopper Sep 23, 2021
ab25476
Merge pull request #13 from KhronosGroup/master
UX3D-nopper Sep 23, 2021
a8510d2
Merge pull request #14 from KhronosGroup/main
UX3D-nopper Oct 5, 2021
9ab4997
Merge pull request #15 from KhronosGroup/main
UX3D-nopper Oct 17, 2021
ef0827b
Merge pull request #16 from KhronosGroup/main
UX3D-nopper Nov 2, 2021
869d10a
Merge pull request #18 from KhronosGroup/main
UX3D-nopper Apr 21, 2022
cff5737
Clean KHR_animation_pointer
UX3D-nopper Apr 21, 2022
46436ff
Removed not required extensions.
UX3D-nopper Apr 21, 2022
ebd91b8
Clean KHR_animation_pointer
UX3D-nopper Apr 21, 2022
30e55a0
Merge branch 'extensions/KHR_animation_pointer' of github.com:ux3d/gl…
UX3D-nopper Apr 21, 2022
7a5fe98
added clarification regarding material animation.
hybridherbst May 5, 2022
9ec5cfe
Merge pull request #19 from prefrontalcortex/add-material-anim-notes-…
UX3D-nopper May 10, 2022
f35e2b2
Fixed required from path to pointer, as the property was renamed.
UX3D-nopper May 31, 2022
5004fcf
Renamed path to pointer. Added clarification, when pointer is
UX3D-nopper Jun 7, 2022
d5b4ea7
Cleaned up tables and added missing emissive strength.
UX3D-nopper Jun 7, 2022
199bc9c
Clarified name animation in general. Added iridescence.
UX3D-nopper Jun 11, 2022
397a9f7
Added clarifications.
UX3D-nopper Jun 11, 2022
95e28d5
Removed matrix animation.
UX3D-nopper Jun 20, 2022
32de659
Sync KHR_animation_pointer extension spec
lexaknyazev Jan 22, 2024
c9a089a
Rename the schema file
lexaknyazev Jan 22, 2024
ea5bf27
Tightened valid usage & updated examples
lexaknyazev Jan 29, 2024
16e0975
Update status & fix punctuation
lexaknyazev Feb 5, 2024
f801241
Add links
lexaknyazev Feb 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 257 additions & 0 deletions extensions/2.0/Khronos/KHR_animation_pointer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
# KHR\_animation\_pointer

## Contributors

- Alexey Knyazev
- Ben Houston, Threekit
- Bryce Hutchings, Microsoft [@brycehutchings](https://twitter.com/brycehutchings)
- Don McCurdy
- Ed Mackey, AGI [@emackey](https://github.com/emackey)
- Felix Herbst, prefrontal cortex [@hybridherbst](https://twitter.com/hybridherbst)
- Gary Hsu, Microsoft [@bghgary](https://twitter.com/bghgary)
- Jamie Marconi, Microsoft [@najadojo](https://twitter.com/najadojo)
- Joe Herdman, [@jbherdman](https://github.com/jbherdman)
- Lewis Weaver, Microsoft
- Marco Hutter
- Norbert Nopper, UX3D [@UX3DGpuSoftware](https://twitter.com/UX3DGpuSoftware)

Copyright 2024 The Khronos Group Inc.
See [Appendix](#appendix-full-khronos-copyright-statement) for full Khronos Copyright Statement.

## Status

Release Candidate

## Dependencies

Written against the glTF 2.0 spec.

## Overview

This extension provides a standardized way of animating arbitrary glTF properties according to the [glTF 2.0 Asset Object Model](../../../../specification/2.0/ObjectModel.adoc).

### Motivation
elalish marked this conversation as resolved.
Show resolved Hide resolved

The base glTF 2.0 specification supports animating only node transformation or morph target weights. With this extension, an animation can target any mutable property in a glTF asset, such as material factors or camera field of view.

The **glTF 2.0 Asset Object Model** defines JSON pointers and data types of the mutable glTF properties.

### Operation

Each animation target specified by the JSON Pointer is resolved to the corresponding glTF asset property and the value of the latter is dynamically updated using values provided by the animation channel output accessor. The property being animated **MUST** be mutable as defined by the **glTF 2.0 Asset Object Model**.

The JSON Pointer **MUST** point to a property defined in the asset. A property is considered defined if it is present in the asset explicitly or if it has a default value and its enclosing object is present.

In the following example, both the `/materials/0/pbrMetallicRoughness/baseColorFactor` and `/materials/0/pbrMetallicRoughness/metallicFactor` are valid pointers: the base color factor is defined explicitly while the metallic factor has a spec-defined default value and the `pbrMetallicRoughness` object is defined.

```json
{
"asset": {
"version": "2.0"
},
"materials": [
{
"pbrMetallicRoughness": {
"baseColorFactor": [ 1.0, 0.0, 0.0, 1.0 ],
}
}
]
}
```

Pointers to the asset properties that do not have a spec-defined default value, such as `/cameras/0/perspective/zfar`, are invalid if the property is not defined in the asset explicitly.

The same property **MUST NOT** be targeted more than once in one animation, i.e., different channels of the same animation **MUST NOT**:

- have identical pointers;
- target an array property and individual elements of the same array;
- target the same node property with a pointer and with an unextended animation target object.

The output accessor **MUST** be compatible with the animated property data type (see the table below) and the values provided by it **MUST** be valid for the property being animated.

| Asset Object Model Data Type | Output Accessor Type |
|------------|---|
| `bool` | SCALAR |
| `float` | SCALAR |
| `float[]` | SCALAR |
| `float2` | VEC2 |
| `float3` | VEC3 |
| `float4` | VEC4 |
| `float2x2` | MAT2 |
| `float3x3` | MAT3 |
| `float4x4` | MAT4 |
| `int` | SCALAR |

> [!NOTE]
> There are currently no mutable properties of matrix types in the ratified glTF 2.0 specification or extensions.

#### Output Accessor Component Types

If the Object Model Data Type is one of the `float*` types, the output accessor values are converted based on the accessor's component type as follows:

- float accessor values are used as-is;
- non-normalized integer accessor values are converted to the equal floating-point values, e.g., `1` to `1.0`;
- normalized integer accessor values are converted using the equations from the [Animations section of the glTF 2.0 specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#animations).

Keyframe interpolation **MUST** happen after type conversions, using floating-point values.

If the Object Model Data Type is `int`, the output accessor component type **MUST** be one of the non-normalized integer types and its values are used as-is.

If the Object Model Data Type is `bool`, the output accessor component type **MUST** be _unsigned byte_; `0` is converted to `false`, any other value is converted to `true`.

Animation samplers used with `int` or `bool` Object Model Data Types **MUST** use `STEP` interpolation.

#### `extras`

Properties located in `extras` objects **MAY** be targeted as well, but validity and interpretation of the animated values is entirely application specific.

## Extension Usage

To use this extension, the animation channel target path **MUST** be set to `"pointer"` and the actual JSON pointer value is provided in the extension object's `pointer` property. The animation channel `node` property **MUST NOT** be set.

> [!NOTE]
> Implementations not supporting this extension will ignore animation channels with undefined `node` properties according to the base glTF 2.0 specification.

## glTF Schema Updates

- **JSON schema**: [animation.channel.target.KHR_animation_pointer.schema.json](schema/animation.channel.target.KHR_animation_pointer.schema.json)

## Examples

### Node Rotation

The following two snippets represent the same animation expressed with an unextended animation target and with the animation pointer extension.

```json
"animations": [
{
"channels": [
{
"sampler": 0,
"target": {
"node": 0,
"path": "rotation"
}
}
],
"samplers": [
{
"input": 0,
"interpolation": "LINEAR",
"output": 1
}
]
}
]
```

```json
"animations": [
{
"channels": [
{
"sampler": 0,
"target": {
"path": "pointer",
"extensions": {
"KHR_animation_pointer": {
"pointer": "/nodes/0/rotation"
}
}
}
}
],
"samplers": [
{
"input": 0,
"interpolation": "LINEAR",
"output": 1
}
]
}
]
```

### Base Color

The following animation uses the animation pointer extension to target a base color factor.

```json
"animations": [
{
"channels": [
{
"sampler": 0,
"target": {
"path": "pointer",
"extensions": {
"KHR_animation_pointer": {
"pointer": "/materials/0/pbrMetallicRoughness/baseColorFactor"
}
}
}
}
],
"samplers": [
{
"input": 0,
"interpolation": "LINEAR",
"output": 1
}
]
}
]
```

## References

- [glTF 2.0 Asset Object Model](../../../../specification/2.0/ObjectModel.adoc)

- [JavaScript Object Notation (JSON) Pointer, RFC 6901](https://www.rfc-editor.org/info/rfc6901)

## Appendix: Full Khronos Copyright Statement

Copyright 2024 The Khronos Group Inc.

This Specification is protected by copyright laws and contains material proprietary
to Khronos. Except as described by these terms, it or any components
may not be reproduced, republished, distributed, transmitted, displayed, broadcast
or otherwise exploited in any manner without the express prior written permission
of Khronos.

Khronos grants a conditional copyright license to use and reproduce the unmodified
Specification for any purpose, without fee or royalty, EXCEPT no licenses to any patent,
trademark or other intellectual property rights are granted under these terms.

Khronos makes no, and expressly disclaims any, representations or warranties,
express or implied, regarding this Specification, including, without limitation:
merchantability, fitness for a particular purpose, non-infringement of any
intellectual property, correctness, accuracy, completeness, timeliness, and
reliability. Under no circumstances will Khronos, or any of its Promoters,
Contributors or Members, or their respective partners, officers, directors,
employees, agents or representatives be liable for any damages, whether direct,
indirect, special or consequential damages for lost revenues, lost profits, or
otherwise, arising from or in connection with these materials.

This specification has been created under the Khronos Intellectual Property Rights
Policy, which is Attachment A of the Khronos Group Membership Agreement available at
https://www.khronos.org/files/member_agreement.pdf. Khronos grants a conditional
copyright license to use and reproduce the unmodified specification for any purpose,
without fee or royalty, EXCEPT no licenses to any patent, trademark or other
intellectual property rights are granted under these terms. Parties desiring to
implement the specification and make use of Khronos trademarks in relation to that
implementation, and receive reciprocal patent license protection under the Khronos
IP Policy must become Adopters and confirm the implementation as conformant under
the process defined by Khronos for this specification;
see https://www.khronos.org/conformance/adopters/file-format-adopter-program.

Where this Specification identifies specific sections of external references, only those
specifically identified sections define normative functionality. The Khronos Intellectual
Property Rights Policy excludes external references to materials and associated enabling
technology not created by Khronos from the Scope of this Specification, and any licenses
that may be required to implement such referenced materials and associated technologies
must be obtained separately and may involve royalty payments.

Khronos® is a registered trademark, and glTF™ is a trademark of The Khronos Group Inc. All
other product names, trademarks, and/or company names are used solely for identification
and belong to their respective owners.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "KHR_animation_pointer glTF Animation Channel Target Extension",
"type": "object",
"description": "Extension object providing the JSON Pointer to the animated property.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"pointer": {
"type": "string",
"format": "json-pointer",
"description": "JSON pointer to the animated property. The animation channel path value **MUST** be `pointer`."
},
"extensions": { },
"extras": { }
},
"required": [ "pointer" ]
}
Loading