Hi folks,
My main question is in general: What is the best way to set multiple textures to multiple planes meshes and ANIMATE them, because setting multiple textures works good in several ways, like creating a loop and cloning the material, and set a texture to each cloned material for each plane mesh, but when animating and moving the planes, the animation is laggy and janky.
So with this problem of janky animation when setting textures in JavaScript, I tried to set a texture to each plane in the fragment shader using this code
The animation is smooth and works perfect, but I got this warning that I couldn’t get rid of
I load 3 textures and send them to the fragment shader, then according to “uCurrentItem” uniform value (which has 3 possible values), I set each texture to each plane.
You can solve your issue by loading all texture first and then setup your materials. If you don’t wait until textures are fully loaded, you perform the material.clone() operation too early. Cloning shader materials also clones their texture uniforms and you end up with cloned texture marked for upload without fully loaded data.
okay, I did that already but nothing displayed, i’ll see if maybe I’m missing something.
In general, I want to know if you want to create a slider of images or display several images and put them as textures to plane meshes, is this technique of fragment shader good and efficient, or it is better to be done with JavaScript, if so, how would you do it? note that displaying textures in planes meshes is not the problem, the problem is when animating and moving them they are not smooth, especially the first 2/3 transitions.