@needle-tools/materialx 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "exports": {
@@ -193,6 +193,7 @@ function toThreeUniform(uniforms: any, type: string, value: any, name: string, l
193
193
  // Save the loading promise in the cache
194
194
  const promise = loaders.getTexture(texturePath).then(res => {
195
195
  if (res) {
196
+ res = res.clone(); // we need to clone the texture once to avoid colorSpace issues with other materials
196
197
  res.colorSpace = THREE.LinearSRGBColorSpace;
197
198
  setTextureParameters(res, name, uniforms);
198
199
  }
@@ -203,7 +203,7 @@ export class MaterialXMaterial extends ShaderMaterial {
203
203
  this.uniforms.u_envMatrix.value = identityMatrix;
204
204
  }
205
205
  if (this.uniforms.u_envRadiance) {
206
- this.uniforms.u_envRadiance.value = textures.radianceTexture || null;
206
+ this.uniforms.u_envRadiance.value = textures.radianceTexture;
207
207
  }
208
208
  if (this.uniforms.u_envRadianceMips) {
209
209
  this.uniforms.u_envRadianceMips.value = Math.trunc(Math.log2(Math.max(textures.radianceTexture?.source.data.width ?? 0, textures.radianceTexture?.source.data.height ?? 0))) + 1;