You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Easy fix, will PR in the morning if this is indeed a bug and not intended.
To Reproduce
Create a unifrom object with a texture property
Clone the unifrom
Use cloned unifrom, the texture will appear black.
Code
// Worksmaterial.uniforms.u_map.value=texture;// Doesnt work (texture is black)constclonedUifroms=UniformsUtils.clone(material.uniforms);material.uniforms.u_map.value=clonedUifroms.u_map.value;// To fixmaterial.uniforms.u_map.value.needsUpdate=true;
Describe the bug
As explained by the docs, when a texture is cloned, the
needsUpdate
flag must be set to true. Else, the texture appears black.UnifromUtils.clone
and by extension,UnifromUtils.merge
, do not set this flag even though they clone Texture and other uniform types.three.js/src/renderers/shaders/UniformsUtils.js
Line 22 in f51dd8a
Easy fix, will PR in the morning if this is indeed a bug and not intended.
To Reproduce
Code
Live example
CodeSandbox
Expected behavior
The "To fix" line shouldn't be required,
UniformsUtils.clone
should setneedsUpdate
automatically.Platform:
The text was updated successfully, but these errors were encountered: