2D Texture arrays?

Hi, I saw that Babylon supports WebGL2 and texture arrays, but I don’t see any related APIs. Is there any built-in way to make use of texture arrays, or is it necessary to write a custom shader?

Hello @fenomas

Here are some of the resources in our documentation including a demo.

you are going to need a custom shader. We have some resources on the forums for this too. :smiley: Uv3 not working properly for 2d texture array

Hi, I got pinged because my former question was linked.

I discovered your engine last year and was inspired to make my own. It uses 2d Texture arrays.

But anway…

From my experience you have to write a custom shader and set a custom attribute on the mesh.

You can check out what I did for DVE:

Texture Creator

Solid Mesh

Solid Material

Shader Builder

Some of the early releases have the shader in full if just want to copy it.

Thank you!

Thanks for the answers! So I guess it’s fair to say that Babylon doesn’t prevent you from using texture arrays, but it doesn’t really support them in any usual sense.

@msDestiny14 If I can ask a follow-up, if one is currently using StandardMaterial, does Babylon have any relatively painless way of changing to a custom shader that derives from StandardMaterial with only small changes? Or do you basically need to create a shader from scratch that copies over every StandardMaterial feature that you intend to use?

@lucas-divinestar Wow that looks great! I will definitely follow your development. Personally I’ve been trying to go as far as I can with my engine without deeply becoming a shader person, since that’s a pretty big swamp to wade into…

You can either use CustomMaterial instead of StandardMaterial if you want to reuse a StandardMaterial and add your custom code, or write a material plugin (new in 5.0 - see Customizing Materials: The Community Ninja Tale | by Babylon.js | Jan, 2022 | Medium for eg).

Thank you. Like I said if I did not see your engine I would of probably not tried to make mine. And yours was used by Mojang which is awesome.
And I am not sure if anyone is gonna answer your question but I can.

As far as I know you do have to re-implement the features from the standard material.
For instance babylopn’s lights and fog will no longer work.
But they provide ways to add them back in.

I just copied the fog shader they provided. But that was the only built in effect from the standard material I wanted to use.

Also I got the against of working with shaders. I am not really a shader person either and they can be very frustrating when debugging. Though I found the work did pay off.

There may be stuff in Babylon 5.0 that I am un-aware that could help though.