Skip to content

Latest commit

 

History

History
282 lines (221 loc) · 14.7 KB

File metadata and controls

282 lines (221 loc) · 14.7 KB

KHR_animation_pointer

Contributors

Copyright (C) 2018-2022 The Khronos Group Inc. All Rights Reserved. glTF is a trademark of The Khronos Group Inc. See Appendix for full Khronos Copyright Statement.

Status

Draft

Dependencies

Written against the glTF 2.0 spec.

Overview

This extension is based on the animation features of glTF 2.0. The structure of the schemas stay the same.

The only major addition is, that the output values are mapped using a JSON Pointer.

Motivation

At this point of time, one can only target the transformation or weight data of a node.
With this extension, one can technically target any value (scalar, vec2, vec3, vec4 and scalars in an array) in glTF e.g.

  • Color factors in materials
  • Camera field of view

Even using a JSON pointer, the targets and their expected behavior are explictly defined.

Current and future extensions have to write against this specification to allow to animate specific values.

Current and future restrictions

The calculated values can be out of range of the minimum and maximum value, however the values have to be clamped using the properties min and max value before setting the value.

Not animatable properties

glTFid

It is not allowed to animate a glTFid property, as it does change the structure of the glTF in general.

Valid target templates

path Accessor Type Component Type(s) Description
"/nodes/{}/matrix" "SCALAR" 5126 (FLOAT) Matrix elements
"/nodes/{}/rotation" "VEC4" 5126 (FLOAT)
5120 (BYTE) normalized
5121 (UNSIGNED_BYTE) normalized
5122 (SHORT) normalized
5123 (UNSIGNED_SHORT) normalized
XYZW rotation quaternion
"/nodes/{}/scale" "VEC3" 5126 (FLOAT) XYZ scale vector
"/nodes/{}/translation" "VEC3" 5126 (FLOAT) XYZ translation vector
"/nodes/{}/weights" "SCALAR" 5126 (FLOAT)
5120 (BYTE) normalized
5121 (UNSIGNED_BYTE) normalized
5122 (SHORT) normalized
5123 (UNSIGNED_SHORT) normalized
Morph target weights
"/cameras/{}/orthographic/xmag" "SCALAR" 5126 (FLOAT) Horizontal magnification of the view
"/cameras/{}/orthographic/ymag" "SCALAR" 5126 (FLOAT) Vertical magnification of the view
"/cameras/{}/orthographic/zfar" "SCALAR" 5126 (FLOAT) Distance to the far clipping plane
"/cameras/{}/orthographic/znear" "SCALAR" 5126 (FLOAT) Distance to the near clipping plane
"/cameras/{}/perspective/aspectRatio" "SCALAR" 5126 (FLOAT) Aspect ratio of the field of view
"/cameras/{}/perspective/yfov" "SCALAR" 5126 (FLOAT) Vertical field of view in radians
"/cameras/{}/perspective/zfar" "SCALAR" 5126 (FLOAT) Distance to the far clipping plane
"/cameras/{}/perspective/znear" "SCALAR" 5126 (FLOAT) Distance to the near clipping plane
"/materials/{}/pbrMetallicRoughness/baseColorFactor" "VEC4" 5126 (FLOAT)
5120 (BYTE) normalized
5121 (UNSIGNED_BYTE) normalized
5122 (SHORT) normalized
5123 (UNSIGNED_SHORT) normalized
The material's base color factor
"/materials/{}/pbrMetallicRoughness/metallicFactor" "SCALAR" 5126 (FLOAT) The metalness of the material
"/materials/{}/pbrMetallicRoughness/roughnessFactor" "SCALAR" 5126 (FLOAT) The roughness of the material
"/materials/{}/alphaCutoff" "SCALAR" 5126 (FLOAT) The alpha cutoff value of the material
"/materials/{}/emissiveFactor" "VEC3" 5126 (FLOAT) The emissive color of the material
"/materials/{}/normalTexture/scale" "SCALAR" 5126 (FLOAT) Multiplier applied to each normal vector of the normal texture
"/materials/{}/occlusionTexture/strength" "SCALAR" 5126 (FLOAT) Multiplier controlling the amount of occlusion applied
extras

A channel may target extras at any allowed JSON Pointer value but interpretation of the animated values is entirely application specific.

Extension compatibility and fallback behavior

If this extension is used, the animation.channel.target.node must not be set. Because the node isn’t defined, the channel is ignored and not animated due to the current specification.
If this extension is used, the animation.channel.target.path must contain the new pointer constant value.

Animating properties of extensions

Extensions created after KHR_animation_pointer should state which properties can be animated and which cannot.
The following extensions have been created before KHR_animation_pointer and are thus listed here with their animatable properties:

❌ No animatable properties.

Property Animatable
name
color
intensity
type
range
spot.innerConeAngle
spot.outerConeAngle
Property Animatable
clearcoatFactor
clearcoatTexture
clearcoatRoughnessFactor
clearcoatRoughnessTexture
clearcoatNormalTexture
Property Animatable
ior
Property Animatable
sheenColorFactor
sheenColorTexture
sheenRoughnessFactor
sheenRoughnessTexture
Property Animatable
specularFactor
specularTexture
specularColorFactor
specularColorTexture
Property Animatable
transmissionFactor
transmissionTexture

❌ No animatable properties.

❌ No animatable properties.

Property Animatable
thicknessFactor
thicknessTexture
attenuationDistance
attenuationColor

❌ No animatable properties.

❌ No animatable properties.

Property Animatable
offset
rotation
scale
texCoord

❌ No animatable properties.

Example target templates for extensions

path Accessor Type Component Type(s) Description
"/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset" "SCALAR" 5126 (FLOAT) XY offset vector

glTF Schema Updates

Notes and clarifications

JSON Pointer

For a scalar value, the JSON Pointer targets the glTF property.
This means, the property is replaced by the interpolated value.

For any other case, the JSON Pointer targets the glTF property as well but must be an array property.
This means, that the two or more elements do replace the values in the array.

Examples

The following snippet shows the changes for animations from the AnimatedCube asset.

"animations" : [
    {
        "channels" : [
            {
                "name" : "Targeting x, y, z, w for a rotation of node at index 0."
                "sampler" : 0,
                "target" : {
                    "path" : "pointer"
                    "extensions": {
                        "KHR_animation_pointer" : {
                            "pointer" : "/nodes/0/rotation"
                        }
                    }
               }
            }
        ],
        "samplers" : [
            {
                "input" : 0,
                "interpolation" : "LINEAR",
                "output" : 1
            }
        ]
    }
]

Appendix: Full Khronos Copyright Statement

Copyright 2018-2022 The Khronos Group Inc.

Some parts of this Specification are purely informative and do not define requirements necessary for compliance and so are outside the Scope of this Specification. These parts of the Specification are marked as being non-normative, or identified as Implementation Notes.

Where this Specification includes normative references to external documents, only the specifically identified sections and functionality of those external documents are in Scope. Requirements defined by external documents not created by Khronos may contain contributions from non-members of Khronos not covered by the Khronos Intellectual Property Rights Policy.

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.

This specification has been created under the Khronos Intellectual Property Rights Policy, which is Attachment A of the Khronos Group Membership Agreement available at 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/adopters.

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.

Vulkan is a registered trademark and Khronos, OpenXR, SPIR, SPIR-V, SYCL, WebGL, WebCL, OpenVX, OpenVG, EGL, COLLADA, glTF, NNEF, OpenKODE, OpenKCAM, StreamInput, OpenWF, OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL, OpenMAX DL, OpenML and DevU are trademarks of The Khronos Group Inc. ASTC is a trademark of ARM Holdings PLC, OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ES and OpenGL SC logos are trademarks of Silicon Graphics International used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.