Support Blob and File as value types for backgroundImage and environmentImage
Currently, we detect HDR images by their file extension. This is great if you only ever use URLs to specify the image, but it falls apart for drag/drop (such as with Ricardo's demo here) and other workflows where the file extension is obscured by URL.createObjectURL.
There are a few ways to address this that might be worth discussing. However, I would recommend that for the user's benefit we should transparently support Blob and File as valid values for backgroundImage and environmentImage. Both of these values should give us enough information to detect an HDR image (mime-type and filename, respectively). This will allow users to directly assign these properties and not worry about the finer details required to accomplish what they are trying to do.
Note: a rough analog for this type of support is the srcObject property of the <video> element.
Any updates on supporting blobs as envrontment/sky image?
@trollcus It's still a good idea. Not a top priority at the moment. Any interest in contributing?
Understand it's not a priority, and an old issue, but just ran into this as well while implementing drag-and-drop-some-environment-onto-a-viewer.
I also found the fun hack in the editor that makes it work there 😀
(appending #.hdr to URL.createObjectURL to trick the loader into accepting it as HDR file)
- https://github.com/google/model-viewer/blob/1807c5eedf2b55e69f24dd0921fba8f53ecc2800/packages/space-opera/src/components/model_viewer_snippet/components/open_button.ts#L263C43-L265
but only for .hdr, not for .exr.