Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Three.js后处理不使用effectcomposer_Three.js - Fatal编程技术网

Three.js后处理不使用effectcomposer

Three.js后处理不使用effectcomposer,three.js,Three.js,未创建大纲。我也尝试了一个BloomFilter,它看起来就像我没有添加任何过滤器一样 这里可能有什么问题 // in global scope const clock = new THREE.Clock(); // in initialization this.composer = new EffectComposer(this.renderer); this.composer.addPass(new RenderPass(this.scene, this.camera.camera_obj

未创建大纲。我也尝试了一个BloomFilter,它看起来就像我没有添加任何过滤器一样

这里可能有什么问题

// in global scope
const clock = new THREE.Clock();

// in initialization
this.composer = new EffectComposer(this.renderer);
this.composer.addPass(new RenderPass(this.scene, this.camera.camera_object));
this.composer.addPass(new EffectPass(this.camera.camera_object, new OutlineEffect(this.renderer, this.camera.camera_object, {
  defaultThickness: 0.01,
  defaultColor: [0, 0, 0],
  defaultAlpha: 0.8,
  defaultKeepAlive: true
})));

// in render loop

this.composer.render(clock.getDelta());

如果没有完整的代码示例,很难看到错误。后处理效果需要以下条件:

  • 加载后处理库。在下面的示例中,我提供了完整的URL以获得效果
  • 创建效果传递。A
    new THREE.OutlinePass
    new THREE.UnrealBloomPass
    或类似内容
  • 使用
    composer.addPass([your_pass])
    添加效果
下面是一个使用
OutlinePass
UnrealBloomPass
的最小代码笔示例:

请注意,
OutlinePass
要求
selectedObjects
是一个包含您想要影响的对象的数组