我尝试实施后处理时遇到问题
const renderer = new THREE.WebGLRenderer()
renderer.setSize(sizes.width, sizes.height)
document.body.appendChild(renderer.domElement)
const composer = new EffectComposer(renderer)
var bloomEffect = new BloomEffect();
const effectPass = new EffectPass(camera, bloomEffect);
effectPass.renderToScreen = true;
composer.addPass(effectPass);
effectPass.renderToScreen = true
/* Controls */
var controls = new OrbitControls( camera, renderer.domElemen );
controls.maxDistance = 50;
controls.minDistance = 0;
/**
* Loop
*/
const loop = () => {
window.requestAnimationFrame(loop)
//camera.position.x = cursor.x * 3
//camera.position.y = - cursor.y * 3
camera.lookAt(new THREE.Vector3())
camera.updateMatrixWorld();
controls.update();
// Renderer
//renderer.render(scene, camera)
composer.render();
}
loop()
您可以在这里找到我的完整代码:https://pastebin.com/RPybJKfX
我尝试获得此结果https://vanruesc.github.io/postprocessing/public/demo/#bloom 或者如果您有其他解决方案(我想制造星云或类似的东西)
谢谢
答案 0 :(得分:1)
您错过了这一行
composer.addPass(new RenderPass(scene, camera));
您可以在此链接中确切地看到如何实现您所引用的示例: https://vanruesc.github.io/postprocessing/#usage