-
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
Referencing glb-stored buffer #828
Comments
I would prefer if a glb file is completely self-contained and cannot reference other URIs. This would make it much simpler for native clients to handle files on disk (just like a JPEG file) since they will not have to deal with the network stack or other file references. There are security implications with this as well since sandboxed applications will only be able to access the single file that is chosen by the user and not all the references. Sandboxed applications may not have access to the internet at all, depending on application permissions. In short, GLB will be the on-disk self-contained file while glTF will be for transmission across the web or other services. If we agree to that, then you can assume there is only one buffer. |
OK, let's evaluate such setup, too. We can:
|
The
While the point is valid and reasonable, I'm not sure whether this should be enforced by the spec. One could just say it's in the responsibility of the asset creator. Right now, external references are explicitly allowed for GLB (as mentioned in the README). In any case: The same arguments could be applied to embedded glTF. |
+1 for making
It's a question about glTF conformance. If we explicitly allow external references (buffers and images) in GLB format, all conformant clients must support them too. Otherwise, different conformance profiles/levels should be defined. |
Some requests
|
@lilleyse can you also review and chime in here since you are familiar with all our binary glTF export and import code. |
Although I see the appeal, if a glb is self-contained, it misses a really important use case: storing textures separately, which you do not want gzipped as part of the .glb. For specifics, see: https://github.com/KhronosGroup/glTF/tree/master/extensions/Khronos/KHR_binary_glTF#performance-results It also misses out on a number of other use cases like not loading buffers until the bounding volume is visible. |
A buffer without a uri seems ok to me as long as the spec is clear that only one of these can exist, and that it only applies when the model is a glb. Really any of the solutions proposed don't present a problem for our import/export. |
I think we are in agreement here:
Can we close this? |
Does it mean that desktop GLB viewer should support relative (to the asset's path) URIs or |
yes. This would be similar to say an obj pointing to other textures files on disk. |
There seems to be a misunderstanding here. But maybe it's on my side. The URIs in glTF will almost always be relative. An absolute URI makes virtually no sense, particularly, a What point am I missing here? |
@javagl @sbtron So, for the client conformance, I propose to require only relative URI support. Everything else would be app-specific anyway. There could be privacy/security concerns with URIs from user-provided or intentionally malicious assets. |
Can we enforce that the binary (non-external) buffer be the first buffer (i.e. index 0)? That would make implementation a bit easier. |
There could be a case with GLB container without internal buffer. So requirement would be like:
|
Probably OK, but can you explain how it makes implementation easier? |
I started typing this: But now that I think about it more:
Thoughts? |
If I'm following your concern, it is that the header fields define the embedded binary buffer, and the Is this problem to unique to desktops? Or mainly because we went from object properties to arrays for buffers? I am hesitant here because this is widely used in Cesium and we went through several iterations to get binary glTF "right." |
I would be against removal of
How about putting
|
Once more, I'm too blind to see what seems to be obvious for others - namely, why |
Yes. Boiling it down, that is the underlying issue.
No. I'm currently working on BabylonJS's glTF loader.
Yes, totally understand. I don't know the history of this, but I suspect the reason why buffer is necessary for the binary extension before is because it is an extension. The binary extension must follow the pattern of the core spec which requires a buffer to be there.
No argument there, but there are currently multiple ways to get the size of the binary buffer.
I agree it's not a good idea to rely on fileSize, so 3 is out, though loaders should verify that it matches header.length if possible. I don't see any reason why 2 can't work. Do we still need 1? |
My perspective on JSON validity is that it mustn't depend on external means. Additionally, we must require that only the first buffer from I'm not quite sure about assuming all after-header data to be just one buffer. |
Okay. I can see how this might be easier to handle if there is some shared code that validates the JSON by itself.
Isn't that what bufferViews are for, to split up the buffer into chunks if necessary? |
They are for internal glTF needs. We were thinking about additional external metadata, like asset's digital signature (which obviously couldn't be referred by bufferView). It's not on the radar now, but I'd avoid locking GLB format from possible extensions. |
Okay, sounds reasonable. |
@lexaknyazev this sounds good to me: #828 (comment) Is there anything else left to decide on for this issue? |
@pjcozzi |
For reference, it is proposed as
The value of moving |
For more uniform "chunk" definition, we could rename:
This would make GLB layout almost identical to aforementioned containers. |
Ah, I see, OK with me. As for the "chunk" rename I'll defer to whatever you think common practice is. |
Updated in #826 |
@lexaknyazev I was looking at Buffer's reference, and could not find explanation regarding why |
With deprecating
KHR_binary_glTF
and removing string-based IDs from the core spec, we need to find a proper way to refer to buffer, stored in.glb
file after JSON..glb
layout:glTF 1.0 way to reference "binary data":
With glTF 2.0 we can't use magic
"binary_glTF"
ID anymore. Also we can't assume that it's the only buffer used.Also, previous usage of DataURI isn't quite correct:
"data:,"
means "empty text/plain string" according to RFC.As one option, we could define a custom URI scheme like this (just possible example):
As another option, we could refine schema of
buffer
object.Make URI optional:
Or make URI nullable:
Or add new boolean field:
@pjcozzi @javagl
What do you think?
The text was updated successfully, but these errors were encountered: