To save memory, my materials share the same texture when they need the same ‘url’. There’s a shortcome that when I change someMaterial.map.repeat
, other materials will be affected too.
In Unity3D, I can set mainTextureScale
for every material. What should I do in Three.js? Pass the repeat value (or matrix about uv transform) by uniforms on my own?
Currently, modifying the material with onBeforeCompile
to add your own UV transforms seems to be the only way to share the same texture with different mapping coordinates.
However devs are already aware of this limitation and are looking for a possible solution to this and other problems regarding WebGL Texture re-usage.
Check out this issue: https://github.com/mrdoob/three.js/issues/17766
4 Likes