旋转相机时,物体的一侧会闪烁

时间:2017-10-25 11:54:34

标签: three.js

有人可以解释为什么我的模型的一部分在添加材料画布材料和相机移动时会闪烁黑色吗?

这是在添加图片之前拍摄的照片:

enter image description here

在添加图像并旋转相机之后:

enter image description here

注意顶部的黑色标记。这与我可能使用的材料有关吗?以下是我如何应用它:

for(let i = 0; i < sidesModified.length; i++) {
  let sideName = sidesModified[i];
  let side = this.getSideInLayersObservable(view, sideName);

  let maxAnisotropy = (this.scene && this.scene['renderer']) ? this.scene['renderer'].getMaxAnisotropy() : 2;
  let canvasTexture = new THREE.CanvasTexture(ctx.canvas, THREE.UVMapping, this.scene.materials.wrapS, this.scene.materials.wrapT, THREE.LinearFilter, THREE.LinearMipMapLinearFilter, THREE.RGBAFormat, THREE.UnsignedByteType, maxAnisotropy);

  for(let j = 0; j < side.length; j++) {
    canvasTexture.wrapS = this.scene.materials.wrapS;
    canvasTexture.wrapT = this.scene.materials.wrapT;
    this._reverseSideIf(this.sceneName, view, sideName, canvasTexture);
    this._drawImageOnCtx(side, j, object, ctx);
  }

  let materialIndex = this.getMaterialIndexForBag(this.sceneName, view, sideName);
  let material = this._setupMaterial(canvasTexture);
  if(this.sceneName === 'two-d-scene') {
    if(view === 'outside') {
      this.selectedBag[0].children[materialIndex].material = material;
    } else {
      this.selectedBag[1].children[materialIndex].material = material;
    }
  } else {
    this.selectedBag.children[materialIndex].material = material
  }
  canvasTexture.needsUpdate = true;
}

0 个答案:

没有答案