# RawTexture2DArray and Procedural Textures

**URL:** <https://forum.babylonjs.com/t/rawtexture2darray-and-procedural-textures/60299>\
**Category:** Questions\
**Created:** [August 29, 2025, 4:09pm UTC](https://forum.babylonjs.com/t/rawtexture2darray-and-procedural-textures/60299 "2025-08-29T16:09:24Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![knervous](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knervous/32/46952_2.png) [@knervous](https://forum.babylonjs.com/u/knervous)\
**Post date:** [September 1, 2025, 4:54am UTC](https://forum.babylonjs.com/t/rawtexture2darray-and-procedural-textures/60299/9 "2025-09-01T04:54:40Z")

</div>

So I was looking into storing multiple images in a 2d texture array awhile back for the use case of a compressed spritesheet.. Lo and behold compressed textures in rawtexture2darray aren’t supported yet and I started another thread about it here:

> [@Support for RawTexture2DArray with compression from basis textures](https://forum.babylonjs.com/t/support-for-rawtexture2darray-with-compression-from-basis-textures/58782):
>
> Hello, I am on a journey now optimizing for a web game I’m making, there are many steps to get entities scaling up and I’m trying to tick the boxes where it will count. My solution for entities en masse that share the same model but varying textures (a plate breastplate vs chain, a polar bear texture vs a brown bear) was using asset container + mesh instances + single ShaderMaterial + VAT + contiguous texture atlas via basisu with a 2darray texture type. I tried atlasing with uv scale and offse…

If you’re okay with doing some preprocessing with your images, this might be helpful. I ended up using basis encoding with a node script. Basis supported 2d texture arrays so it ends up with one file (one network call) to fetch all the images. There is a binary wrapper in Node with `npx basisu`. Here is the script I use to create atlases:

> <https://github.com/knervous/eqrequiem/blob/main/client/scripts/create-atlas.js>

And here is a lot of the work tied together to combine loading basis files in runtime and either completely decompressing to flat RGBA (worst case scenario) or using the available compression based on engine caps and uploading compressed textures to the GPU. Then you can upload as a sampler2DArray and do your work in the shader. There’s a lot more going on in this PG but I hoisted all the relevant code to the top, lmk if this is something that might fit your case.

> **[Babylon.js Playground](https://playground.babylonjs.com/?BabylonToolkit#T3QKRV%2356)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

_[View the full topic](https://forum.babylonjs.com/t/rawtexture2darray-and-procedural-textures/60299)._
