Babylon MIME types (DDS and others)

I recently discovered that if you try to serve your own .dds file on gh-pages it won’t work. I looked into it and it appears that gh-pages is using mime-db to serve as the lexicon of all known MIME types. I made a PR for .dds files here : Add the dds (DirectDrawSurface) extension to the list of known MIME types by the-simian · Pull Request #170 · jshttp/mime-db · GitHub

However, since the maintainers of Babylon are here, I wanted to ask if there’s any others that might need to be added to make Babylon more compatible with servers that use this list of known types.

Also, is .dds a compressible type (as in can you g-zip it?)

Thanks for this great library! If we get these types added to this db, it will really improve the ability to use Babylon in more places!

This is great ! thanks for letting us know, I guess that this might indeed help a few others.

This also helps the 3d web as a whole, GG !!!

1 Like

Oh another one I came across is, you serve .env files, right? As per this article: https://doc.babylonjs.com/how_to/use_hdr_environment

As the generated DDS files can be relatively large (32Mb for a 512px wide file), we introduced in Babylon a special way to pack your texture. Here are the steps to follow to create the .env files used in BabylonJS

I was able to find some other types - for instance .glb is already in that wiki.,

is there some official docs that also list the MIME type? I looked over the same MS docs with the DDS, and I didn’t see something for .env (could have missed it)

I did see one reference to MIME in relation to rawGIT:

using rawgit.com
You were able to use GitHub with a link generated by the RawGit site to ensure correct MIME type. Unfortunately this site has now closed.

Any existing links to files using RawGit can be updated using Raw Git to jsDelivr. Changes should be made to RawGit links before October 2019.

… but that’s it.

Another thing, is it might not be a bad idea to start a page in the docs with all the ‘special’ MIME types? I think the maintainer of mime-db would accept the Babylon docs themselves if it clearly mentioned the types. At the very least a disambiguation of all the various formats. Would you like help with this? I could get something started…

here’s what he wants to know on each entry:

source - where the mime type is defined. If not set, it’s probably a custom media type.
apache - Apache common media types
iana - IANA-defined media types
nginx - nginx media types

(so for source I’d just add a link to the right place)

extensions - known extensions associated with this mime type.

(.dds, .env, etc)

compressible - whether a file of this type can be gzipped.

(I actually need help here, like I’m not sure if a .dds can be? I’d think yes because its just a big image, right? but it has more to it than just that too)

charset - the default charset associated with this type, if any.

(I think this would not apply because these are images and things, right?)

Anyways, let me know if you want me to help round up replies in here and neatly format them into a docs-worthy page! I’ll even go hunt down examples if I can.

for glb gltf and basis ping @bghgary :slight_smile:

.babylon is json and defined by babylonjs. I guess charset is the same as JSON.

.env us custom to babylon and binary format

They could all be GZipped but I am not sure it would help on .env

I do really appreciate your help on this.

Oh good one! how could I have overlooked .babylon! :smile:

1 Like

I have this for .glb and .gltf:

GLTF
MIME: “model/gltf+json”
compressible: true,
extensions : [“gltf”]

GLB:
MIME “model/gltf-binary”
compressible: true
extensions": [“glb”]

2 Likes

yup it is more about .basis that I am unsure as it is really recent.

1 Like

The glTF/GLB mime types as well as the glTF-buffer types on IANA media types are from the KhronosGroup.

I suspect DDS/Basis will not be in the IANA media types as they are custom types and are not part of a standards consortium. The new KTX2 container format from KhronosGroup might be a better choice for this once it is all ready.


It looks like this is not ready, then? and it will likely be .ktx2 and not .basis.

What about the .env files, and .babylon? do you think it is ok to submit MIME types for those, so they can be served?

1 Like

It looks like this is not ready, then?

No, it’s not ready for consumption yet, but it is coming soon.

it will likely be .ktx2

I’m not sure what file extension we will end up with. I’m pushing for .ktx and not .ktx2 but the working group needs to agree on this.

What about the .env files, and .babylon ?

I don’t think they should be as they are not formats backed by a standards consortium.

alright, I’ll stop work here then.