BabylonJS Vram usage versus Unity

Babylon provides a very impressive toolset for working with compressed textures
https://doc.babylonjs.com/resources/multi-platform_compressed_textures

I have followed the methods and got all of it working, the best compression to use today is astc as it provides amazing results and has alot of flexibility, but it doesn’t work with DirectX, so for desktops we are left with dtxns, which aren’t as flexible and aren’t as good. I have converted all my textures to the dtx1 aka bc1 and the resulting folder is 245 megabytes for diffuse and normals. With fallback jpgs and astcs for the mobiles my simple project is now close to 400mb without lightmaps or pbr, which is unrealistic, meanwhile the same project folder in Unity with crunched etc2 and dtxns is less than 100mb.

So I have followed the path of crunching a bit further and it’s very impressive, yes it does need to be decompressed, but supposedly its very very quick to do so when its decompressed to dxtn since its made exactly for this purpose.

Unfortunately, whle making and uncompressing the crunched dds files is easy, it needs to be decompressed at runtime or during loading and I am simply not smart enough to pull something like this off.

I honestly think that this technology should be pursued and if its possible for Babylon team to add direct support for .crn files that would be a huge improvement for all of us.

Github page for Crunch can be found here
.

And here are the important snippets and my compression testing results:

or that : Google and Binomial Contribute Basis Universal Texture Format to Khronos’ glTF 3D Transmission Open Standard - The Khronos Group Inc

:slight_smile:

1 Like

Oh man I don’t know, the cruncher looks so magical, just compressed 365mbs worth of dtx1 textures to 57mbs in 2 minutes. And it works both for etc1 and etc2 and for dxtns, so why would we need anything else ?

I really need to get this into my project but I have no idea where to begin, is this even possible, what do you think ? Crunch is in written in C++, but says you can use emscripten ? Maybe I should hire some help or something, if only I were rich :upside_down_face:

It’s a shame that you’ve delete the first post content, 'could be helpful for others users later (even if we can click on the “edit” button to see the post history :wink: ) - and also you’re other posts overwritten with “solved”, this make informations very confused.

2 Likes

There was nothing in it, the issue that I had was solved. Takeaway is this: Using jpgs or pngs as textures expands exponentially in your Vram, even if the files themselves are very small. This was why Unity was using much less Vram than my Babylon scene. So now that I started using compressed .dds files my Vram usage is exactly the same as unity. But the file sizes are now huge and now I need Crunch in my life.

crn_to_dds

245 files uncrunched (converted from .crn to .dds) in under 10 seconds on a hard drive!

We will support basis ASAP :slight_smile:

1 Like

Great news ! Any ETA on this at all ? :grinning:

Asking @trevordev :slight_smile:

1 Like

Go trevor !!! :slight_smile:

1 Like

Got an initial PR here: .basis file support by TrevorDev · Pull Request #6387 · BabylonJS/Babylon.js · GitHub

More changes needed to improve supported formats but should have some live working examples up by early next week.

2 Likes

I am loving it !!!

This is extremely exciting and I am eager to see final results.

You guys are absolutely amazing !

2 Likes

Has anyone tried to encode a .basis texture thought?
For me It takes 3 minutes to convert a single 1024x1024 images at 0.5 bits/pixel

I gave up waiting for a 4k texture

Hmm…

This is not my point of view, as artist but also as hobbyist-level dev’ : I already tried to integrate compressed texture into my workflow (both personnal & pro projects) and for now it’s really painful to use, and so I still use jpg/png :sleepy:

When you’re in a project production, you will update every day your texture files. If you’re in team and have a hundred to handle, it’s impossible to generate all dxt/astc/pvrtc/… versions each time someone make a tweak in Photoshop. And even for a dev’ it’s not an easy workflow to understand, I let you imagine for an artist who is scared to see an hello world!.

As for the creation tool like exporters: I think BabylonJS should support and maintained official exporters, to make them similar about options & capabilities and smooth the workflow no matter what 3D modeler is used. In the same way, artists can only use these tools and can’t help to write any code, and exporters are the only door for them to get into the engine.

2 Likes

100% agree with Vinc3r

I think this will be solved in the future with the proposed GLTF/basis integration. You will create models in your 3d software and GLTF exporter will do everything for you.

It’s not entirely plausible to ask Babylon dev team to solve it for us at the moment, but they are already laying the groundwork for basis integration. And they will need to integrate this into the GLTF importer when google makes it available.

Yes but as a lead developer when I have to make a choice between 2 technologies I do exactly what @somerandomguy83 did : A/B testing with simple export. In this case Unity will always win :/.

We developed a tool (electron + PVRTexTool) to batch convert but unfortunately it’s still painfull for artists and scripters.

+1 for the dxtc direct export, at least Babylon will pass the A/B test :stuck_out_tongue:

@sebavan can you please tell me which other modules besides basis_transcoder.js and .wasm I need to load the .basis file ? I’m using the 4.1.0 alpha 2 engine ver and it’s not working

I tried both the loader and the new BABYLON.Texture() but no luck.