Merging should use the existing texture, not cloning it ( same for others parameters ), its counter intuitive and memory expensive. I find myself in the case I wanted to just add some fog uniforms & other common to my rawShader and it take me time to figure out my texture was cloning and thats why my shader wasnt working and my texture share between all my instance not updated..
If the user want to clone the texture then he should use UniformsUtils.clone(myUniforms) and then merging it, trying to hide this step can lead to some serious bugs.
I believe the intention is for you to merge the uniforms data structures and assign values afterward.
This is how it is done in the examples.
If you assign the texture a value prior to merging, the texture will be cloned and the
needsUpdate
flag will be set tofalse
. Obviously, that is not what you want.@Makio64
Sounds like one can use
Object.assign
(which is already polyfilled in the library)Knowing this, we could start deprecating
UniformsUtils.merge()
in favour ofObect.assign()
. I think this is better than changing the current behaviour ofUniformsUtils.merge()
.