-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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_texture_video #2285
base: main
Are you sure you want to change the base?
KHR_texture_video #2285
Changes from 2 commits
bebde53
d383a12
bc8a54d
c052aea
cd098bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# KHR_texture_video | ||
|
||
## Contributors | ||
|
||
* Dwight Rodgers, Adobe | ||
* Gary Hsu, Microsoft | ||
* Emmett Lalish, Google | ||
|
||
## Status | ||
|
||
Draft | ||
|
||
## Dependencies | ||
|
||
Written against the glTF 2.0 spec. | ||
|
||
## Overview | ||
|
||
This extension allows glTF models to use videos as textures. A client that does not implement this extension can ignore the provided video and continue to rely on the PNG and JPG textures available in the base specification. Defining a fallback texture is optional. | ||
|
||
Video textures support use cases such as water or other textures that continuously repeat, coordination of video texture playback by animation (in conjunction with `KHR_animation_pointer`), or control of video texture playback by interactivity (in conjunction with `KHR_interactivity`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is For interactivity, note that OMI's physics extensions already define an interactible trigger. You can specify a trigger shape that a user can point at in the world and interact with. What actually gets triggered is defined by other extensions, so this video player extension could define that a given OMI trigger plays the video. I would highly recommend that we move forward with OMI physics so that we can use these extensions together (we could rename to have the KHR_ prefix if Khronos is in favor). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. KHR_interactivity is an ongoing work by the 3d format's group's DTSG on behaviors and interactivity. It is still an early work in progress, but a partial draft should be available on a branch soon. |
||
|
||
## glTF Schema Updates | ||
|
||
The `KHR_texture_video` extension is added to the `textures` node and specifies a `source` property that points to the index of the `images` node which in turn points to the video. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
How does
I think what you meant is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this. I have updated this section to be more clear and precise in the latest commit. Please let me know if it is clear and unambiguous now. |
||
|
||
The following glTF will load `texture.webm` in clients that support this extension, and otherwise fall back to `image.png`. | ||
|
||
``` | ||
"textures": [ | ||
{ | ||
"source": 0, | ||
"extensions": { | ||
"KHR_texture_video": { | ||
"source": 0, | ||
"playhead": 0, | ||
"autoplay": true, | ||
"loop": true | ||
} | ||
} | ||
} | ||
], | ||
"extensions": { | ||
"KHR_texture_video": { | ||
"videos": [ | ||
"uri": "texture.webm" | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not valid JSON, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this. I believe it is resolved in the latest commit. Please let me know if you see any further problems with this. |
||
} | ||
} | ||
"images": [ | ||
{ | ||
"uri": "image.png" | ||
} | ||
] | ||
``` | ||
|
||
When used in the glTF Binary (.glb) format the `images` node that points to the texture video uses the `mimeType` value of `video/webm;codecs=vp8` or `video/webm;codecs=vp9`. | ||
|
||
``` | ||
"textures": [ | ||
{ | ||
"source": 0, | ||
"extensions": { | ||
"KHR_texture_video": { | ||
"source": 1, | ||
} | ||
} | ||
} | ||
], | ||
"images": [ | ||
{ | ||
"mimeType": "image/png", | ||
"bufferView": 1 | ||
} | ||
] | ||
"extensions": { | ||
"KHR_texture_video": { | ||
"videos": [ | ||
"mimeType": "video/webm;codecs=vp8", | ||
"bufferView": 2 | ||
] | ||
} | ||
] | ||
``` | ||
|
||
### JSON Schema | ||
|
||
todo: update | ||
[glTF.KHR_texture_video.schema.json](schema/glTF.KHR_texture_video.schema.json) | ||
|
||
## Fallback | ||
|
||
When a fallback image is defined, this extension should not be present in `extensionsRequired`. This will allow all clients to render the glTF, and those that support this extension can display the animated texture. | ||
|
||
## Video formats | ||
|
||
Future extensions could add support for other video container mimetypes or related animation mimetypes such as animated GIFs, dotLottie, while retaining the same structure for controlling the animations, including the path to the playhead property (/textures/#/extensions/KHR_texture_video/playhead). This extension supports only webm container with vp8 or vp9 codec unless additional extensions are also used by the content to add support for other codecs or containers. | ||
|
||
## Control by animation | ||
|
||
`KHR_texture_video` extension can be used on animation channels to control the playhead on an object by object basis by using `KHR_texture_video` in conjunction with `KHR_animation_pointer`: | ||
|
||
``` | ||
{ | ||
"animations": [ | ||
{ | ||
"channels": [ | ||
{ | ||
"sampler": 0, | ||
"target": { | ||
"path": "pointer", | ||
"extensions": { | ||
"KHR_animation_pointer" : { | ||
"pointer" : "/textures/0/extensions/KHR_texture_video/playhead" | ||
} | ||
} | ||
} | ||
}, | ||
... | ||
``` | ||
|
||
In this example, the playhead for all instances of texture 0 in the scene will be controlled by sampler 0, regardless of which nodes are using the texture. | ||
|
||
The properties that are animatable are: `playhead`, `loop`. All other properties defined in this extension are not animatable. | ||
|
||
## Control by interactivity | ||
|
||
Controlling video playback via interactivity in conjunction with `KHR_interactivity` can be done in two ways: | ||
Playback can be controlled by using the interactivity extension's capabilities for starting and stopping animations, and attaching the video texture to animation as above. | ||
Playback can be controlled by directly manipulating, via json-pointer, the parameters listed as animatable above. | ||
|
||
### Using Without a Fallback | ||
|
||
To use video textures without a fallback, define `KHR_texture_video` in both `extensionsUsed` and `extensionsRequired`. The `texture` node will then have only an `extensions` property as shown below. | ||
|
||
``` | ||
"textures": [ | ||
{ | ||
"extensions": { | ||
"KHR_texture_video": { | ||
"source": 1, | ||
"autoplay": true | ||
} | ||
} | ||
} | ||
] | ||
``` | ||
|
||
|
||
## Known Implementations | ||
|
||
Video textures of this form are currently supported in threejs and Babylon, but currently must be created using custom JavaScript in the viewer. With support of this extension, the video texture could be created automatically by the GLTF loader and the GLTF animation could control the video playback. | ||
|
||
## Resources | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file should be named
README.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. I have fixed it in the latest commit.