gpt4 book ai didi

javascript - 三.js : add BloomEffect from Post processing

转载 作者:行者123 更新时间:2023-12-03 00:20:57 32 4
gpt4 key购买 nike

当我尝试实现后处理时遇到问题

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或者如果你有其他解决方案来制作这个(我想制作星云或类似的东西)

谢谢

最佳答案

你错过了这行

composer.addPass(new RenderPass(场景,相机));

您可以在此链接中准确了解如何实现您所引用的示例: https://vanruesc.github.io/postprocessing/#usage

关于javascript - 三.js : add BloomEffect from Post processing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54314754/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com