BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.1k stars 3.41k forks source link

Populate 2D texture array from image asset #13174

Open axeljaeger opened 1 year ago

axeljaeger commented 1 year ago

We only accept feature requests that are discussed on the BabylonJS forum

Is your feature request related to a problem? Please describe. WebGL supports TextureArrays. This is an indexable array of textures, widely used as a replacement for a texture atlas. In contrast to using one texture and use parts of it by using UV-coordinates, texture arrays allow:

Babylon JS added support for texture arrays using the RawTextureArray2D class. However, it only accepts a raw buffer to populate the content. This makes it hard to use for day to day usecases such as loading a texture array from an image file or using a canvas to prepare 2D content.

Describe the solution you'd like A simple way of populating a texture array from both a loaded Image and a canvas. In my current application, I have both usecases.

Discussion https://forum.babylonjs.com/t/populate-2d-texture-array-from-image-asset/35140/1

github-actions[bot] commented 6 months ago

This issue has been automatically staled because it has been inactive for more than 14 days. Please update to "unstale".

pandaGaume commented 3 months ago

FYI, this is what i've done in this demo. The only missing part is the same support for WebGPU. Note: the playground is break since V7.0, but this is only declarativ, the code is still valid and used into other demo such this mapping one.