-
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_accessor_additional_types #2395
base: main
Are you sure you want to change the base?
Conversation
As mentioned in the linked issue: I always thought that the omission of I'm a bit skeptical about Also, the question about which categories of accessors may contain which data types may be difficult to sort out, and I wonder whether it's possible to define this, once and for all, right from the beginning, or how to handle the case that some constraints should be relaxed here in the future... But beyond "It would nice to have this", I don't have strong opinions (or frankly: just not enough background knowledge) about any of these specific points.
There are some details about these procedures that are still waiting to be described more clearly. But roughly:
The exact meaning of being "ratified" is a bit beyond the scope of this comment (and again: my knowledge). But it may be worth mentioning that this does not mean that the name of the extension would then be changed (from |
Ah, interesting. I did not notice that. I thought it'd be the same concept as I know from Vulkan extensions, where ratified extensions get the KHR prefix. Then I guess it can stay as-is.
But, it is a built-in in nearly every GPU programming language, albeit through an extension or newer language version. GLSL, HLSL, Metal, all have it. A lot of GPUs also have dedicated fp16 ALUs, aside from all of them supporting fp16 storage. Yes, x86 or arm CPUs don't support fp16 natively but we're not rendering on the CPU. So, yeah, very weak counterargument. |
The formats included in this proposal have very different use cases and platform support so the functionality should be split into several smaller extensions along such lines. Allowing more component types for accessors is not enough to make them usable by vertex attributes as the latter are further restricted by the spec. For example, already-supported unsigned 32-bit integer accessors may be used only for indices. Now to the format-specific comments. Double-precision floatsThese could safely work in all cases where the spec allows single-precision floats. Proper support would require having the following extension spec language:
This could be one well defined extension. Given that GPU hardware support for 64-bit floats is far from universal, the extension should suggest fallback behavior such as converting data to single-precision on load and warning that such conversion is lossy. Half-precision floatsAlthough half-precision floats are well supported in graphics hardware and may provide noticeable computation performance improvements, their benefits for data storage are questionable. Due to the way floating-point encoding works, the precision distribution is non-uniform and is generally worse than of normalized shorts. Specifically, half-precision floats have only 15361 unique values in the All that said, there are reasonable use cases for half-precision floating-point attributes such as porting pre-existing data from other formats, supplying data for custom attributes, or having a unique model that has been confirmed to yield fewer artifacts when half-precision floats are used, e.g., with non-trivial texture tiling. Proper support would require having the following extension spec language:
This could be another well defined extension. IntegersglTF accessors currently have no distinction between pure and scaled integer attribute types, e.g., an unsigned non-normalized byte attribute accessor provides floating-point values in Proper support for 32-bit integer attributes would require having the following extension spec language:
This could be one more well defined extension. 64-bit IntegersGPU hardware support for 64-bit integers is very limited, e.g., not available on Apple and most Android devices, therefore including them would make the extension less adoptable. Besides, use cases for 64-bit per-vertex data seem to be quite exotic (GUIDs? Bitsets?) and could be covered by interleaving two 32-bit integer attributes anyway (or defining a separate extension). |
+1 for this extension. For |
The extension may also need to specify alignment rules for 64-bit types, e.g. for use with
|
Although ^ this is implicitly covered by the wording in the spec that says
it should definitely be emphasized in the extension specification. I could imagine that some/many/most glTF libraries are taking the "lazy" way and say "always align everything to 4 bytes", and these may have to be updated accordingly to handle this extension. |
Yes to INT, INT64 and DOUBLE component types ! |
Partially moving the proposal forward starting with double-precision floats as a Khronos extension in #2397. Other types are still being considered. |
Ah, interesting. I had my last final exam yesterday so I was kinda distracted by studying. I was going to split up this PR into 3 extensions, one float16, one float64, and one for integers, as you had suggested. Though if you're doing that "officially" now that'd also be great. I'm thinking perhaps I could repurpose this PR for the float16 extension first, since that is what I was originally going for myself. |
@spnda |
FWIW, half-precision floats seem to have much better support in general-purpose systems than before:
|
|5124|signed int|Signed, two’s complement|32| | ||
|5130|double|Signed|64| | ||
|5131|half float|Signed|16| | ||
|5135|unsigned long|Unsigned|64| |
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 Rust will also be adding support for half-precision 16-bit floats in the new |
Addresses #2216.
This PR adds a new extension,
EXT_accessor_additional_types
. This extension simply defines more valid accessor types, equivalent toGL_INT
,GL_UNSIGNED_INT64_ARB
,GL_HALF_FLOAT
, andGL_DOUBLE
, and doesn't allow their usage for meshes, animations, morph targets, ...However, this extension does also allow the use of half-precision floating point numbers for UV coordinates, as this is commonly used nowadays for reducing vertex memory cost, and is quite simple to implement. And this avoids the possible quantization errors that would otherwise occur with
KHR_mesh_quantization
.Open questions:
KHR_mesh_quantization
? Not sure on the procedure there.TEXCOORD
attributes be put into another question, something likeKHR_mesh_quantization_2
?I'd really like to see this properly considered by the glTF team, especially since half floats are quite important in the modern graphics world for various reasons. Also, assets using double-precision positions have existed for a while, and it is already supported by a lot of glTF tooling.