When I enable the material plugin, can I pass cubetextures into the material as an array?

Hello,I want to pass cubetextures into the material as an array when I enable the material plugin.

I found a PG with cubetextures an an array in custom materials,
PG:https://playground.babylonjs.com/#NJRT3#12

I want to follow this method to pass cubetextures into the material as an array when I enable the material plugin.But it’s always wrong, can someone help ?
Problematic PG:https://playground.babylonjs.com/#WGZLGJ#10531

In your PG you are calling setTexture but passing a texture array. It seems UniformBuffer does not expose a setTextureArray, but you can call setTextureArray directly on the underlying Effect. glTF Loader Demo | Babylon.js Playground (babylonjs.com)

I don’t know if it is a bad practice to operate on the underlying Effect directly though, and I’m also wondering if UniformBuffer should expose a setTextureArray. @sebavan?

1 Like

Yup it actually does not make a lot of sense to do it on the UBO… We should have the effect easily available in the bind/plugin.

cc @Evgeni_Popov ?

Yes, I think we should add setTextureArray in the UniformBuffer class. Here’s the PR:

2 Likes

Thank you very much for your help to solve my problem quickly and perfectly.

1 Like