-
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
EXT_texture_avif #2235
base: main
Are you sure you want to change the base?
EXT_texture_avif #2235
Conversation
I have done a PR to three to get this added there. |
I have also done a PR for Babylon |
- Omar Shehata, Cesium, [@OmarShehata](https://github.com/OmarShehata) | ||
- Pascal Massimino, Google, [@Skal65535](https://github.com/skal65535) |
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 content of this section should not have been copy-pasted.
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.
I guess we are the authors?
I added myself, Don and you :)
|
||
## Best Practices | ||
|
||
Since AVIF is not as widely supported as JPEG and PNG, it is recommended to use this extension only when transmission size is a significant bottleneck. For example, in geospatial applications the total texture payload can range from gigabytes to terabytes of data. In those situations, AVIF textures can be used without a fallback to improve storage and transmission. |
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.
Replace the copy-pasted WebP rationale with something specific to AVIF. The section should mention concrete glTF use-cases that benefit from using this extension.
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.
I changed it a bit, but copy is now my strong suite, feel free to update it to what you think is better.
For me the main advantage while developing mobile open gl is transfer size on 4g.
beeing able to only have to download 2mb instead of 20 is a big win.
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.
That's only a win on network transmission / disk storage. AVIF decoding complexity is higher than with other formats and GPU memory usage is the same as JPEG / PNG / WebP. For example (don't copy this literally), a 3D application that features real photos / paintings may prioritize transmission size over other other metrics.
In a case of glTF, images are used as textures, for which GPU throughput is usually more important, so our general recommendation is to use KHR_texture_basisu
.
This section should provide glTF use-cases that prioritize transmission / storage size and are not bound by GPU memory or throughput.
Since AVIF is not as widely supported as JPEG and PNG, it is recommended to use this extension only when transmission size is a significant bottleneck. For example, in geospatial applications the total texture payload can range from gigabytes to terabytes of data. In those situations, AVIF textures can be used without a fallback to improve storage and transmission. | ||
|
||
When a fallback image is defined, this extension should not be present in `extensionsRequired`. This will allow all clients to render the glTF correctly, and those that support this extension can request the optimized AVIF version of the textures. | ||
|
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.
Given the flexibility of the format (auxiliary images, sequences, etc.), the extension spec must define an appropriate scope that is compatible with glTF texture usage.
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.
@lexaknyazev is it necessary to specify limitations on color space and bit depth? Or can those be inherited from the core specification, and overridden explicitly by a future extension should we choose to allow, for example, Display P3 or Rec 2100 HLG?
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 core specification already defines color management. Other extra features that could be present in AVIF files should be addressed here.
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.
I added a part about this only being a replacement for jpeg / png.
I added support for the extension in gltf-pipeline today
https://github.com/leon/gltf-pipeline/tree/avif
an .avif file that is an image starts with ftypavif
whilst image sequences has another byte sequence,
I only added support for the image version for now.
Experimental implementation in glTF Transform, for testing purposes: # install
npm install --global @gltf-transform/cli@avif
# compress textures
gltf-transform avif input.glb output.glb Related: |
As FYI: three.js is planning to add support for EXT_texture_avif in our next release, r150. |
Out of curiosity, what is the motivation for including both WebP and AVIF as glTF extensions? Is there specific guidance on when an application should use WebP vs AVIF, and how they compare to BasisU? |
I'll copy my thoughts from this thread, they're probably more relevant here anyway —
I would like to find better comparisons on WebP vs. AVIF for graphics purposes, but my order of preference would be:
It isn't quite cut-and-dried: there are certainly cases where WebP outperforms AVIF. But I think that is the general shape of things. |
It feels a little odd to have two independent formats, AVIF and WebP, that seem to perform a similar function. This bloats the spec and results in increased complexity in the entire ecosystem, since now multiple formats of each type need to be supported. It makes sense to support one of AVIF or WebP but it feels odd to support both? Maybe the ship has sailed because WebP is already supported, and AVIF seems to compress a little better. |
WebP is not ratified though. |
My feeling is that the KHR_ prefix should represent extensions that Khronos believes are net-positive for the ecosystem, with a healthy respect for the increased complexity of supporting multiple similar alternatives. EXT_ extensions should represent only that "at least two vendors have chosen to implement this thing", without a value judgment from Khronos. Certainly I would not expect the entire ecosystem to implement all EXT_ extensions. In three.js we're trying to support all KHR_ extensions, but we've intentionally decided to implement some EXT_ extensions and not others, on a case by case basis. AVIF appears to generally outperform WebP, PNG, and JPEG. Compared to KTX2 there are pros and cons. For three.js I would like to offer all of those options. We can rename this to a THREE_ prefix if there are no other interested vendors. |
There's nothing specific to three.js here and It's reasonable to expect more vendors to support this extension over time, so let's keep it as EXT.
The extension spec should provide specific examples. |
@zeux I am interested in implementing EXT_texture_webp in Godot Engine, but I can't do the same with AVIF yet because Godot Engine does not support AVIF. It will take time before AVIF is a commonly enough adopted format, in the meantime WebP has been around for a decade, is more widely supported, and is still superior to PNG and JPG. I don't see the harm in having both available, if only WebP then we're holding back progress for devices that support AVIF (so that they can't reach their full potential), and if only AVIF then we are holding back progress for devices that don't yet support AVIF (so that they are still stuck using PNG or JPG). |
Since it's mentioned above – some signs of life for JPEG XL: https://webkit.org/blog/14205/news-from-wwdc23-webkit-features-in-safari-17-beta/#images |
Proposal:
There's also a practical angle here — users may not have the time or ability to tune compression settings and UV layouts for optimized KTX2 compression. Platforms hosting user-generated content may have difficulty generalizing KTX2 settings without a human in the loop. But I don't think those are concerns the spec needs to call out. I think it would also be fair to provide counter-examples. Content intended for immersive AR/VR applications should almost certainly use KTX2. The same is likely true for content intended for use in external 3D scenes where VRAM usage may be higher (or unknown). |
This extension adds support for .avif textures.
I was really hoping for jpeg xl to win the race, but google pulled it from chrome.
so the next best image format that is getting good support in browsers
https://caniuse.com/avif
is AVIF
This extension is a copy of the webp extension, but I've rewritten parts of the readme, and created a simple sample with and without png fallback.
I don't know if there are any special considerations we need to take regarding avif.
let me know if you would like me to rework anything.