BokehPass结果不一致

时间:2018-01-28 20:26:28

标签: three.js

BokehPass给了我一些奇怪的结果。 FilmPass和BloomPass对此问题没有任何影响。代码:

var renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );


var scene = new THREE.Scene();
scene.background = new THREE.Color( 0xc3defc );
var camera = new THREE.PerspectiveCamera( 85, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.set(20,1,20);
camera.rotation.y = .8;
var light = new THREE.HemisphereLight( 0xffffff, 0x080820, 1 );
scene.add( light );

var composer = new THREE.EffectComposer( renderer );
var bokehPass = new THREE.BokehPass( scene, camera, {
    focus:  100.0,
    aperture:   0.00001,
    maxblur:    1.0,
    width: window.innerWidth,
    height: window.innerHeight
} );
bokehPass.renderToScreen = true;

composer.addPass( new THREE.RenderPass( scene, camera ) );
composer.addPass( new THREE.FilmPass( 0.3, 0, 0, false ) );
composer.addPass( new THREE.BloomPass( .2 ) );
composer.addPass( bokehPass );

renderer.autoClear = false;

console.log(composer);


var loader = new THREE.OBJLoader();
loader.load(
    'main1.obj',
    function ( object ) {

        scene.add( object );
    }
);


var animate = function () {
                requestAnimationFrame( animate );
                composer.render();
                camera.position.z -= 0.001;
};

animate();

图: https://i.imgur.com/8b79EvR.jpg 那些不是JPG文物。

这是光圈值为0.1,它变得更加疯狂: https://i.imgur.com/7xhsYJy.jpg

有什么线索在这里发生了什么?谢谢!

1 个答案:

答案 0 :(得分:0)

终于解决了!将相机的近夹子更改为0.01可解决此问题。在此之前,z缓冲区中的所有内容都是白色的,因此显然没有深度分辨率。现在低端的范围更广。