Helo, i have problems to active SAOPass.
This is my code:
stats = new Stats();
renderPass = new THREE.RenderPass( scene, camera );
composer.addPass( renderPass );
saoPass = new THREE.SAOPass( scene, camera, true, true );
saoPass.params.output = parseInt( THREE.SAOPass.OUTPUT.Beauty );
saoPass.resolution.set(2048, 2048);
saoPass.renderToScreen = true;
saoPass.enabled = true;
composer.addPass( saoPass );
gui.addFolder('Oclusion Ambiental SAO')
gui.add( saoPass.params, 'output', {
'Beauty': THREE.SAOPass.OUTPUT.Beauty,
'Beauty+SAO': THREE.SAOPass.OUTPUT.Default,
'SAO': THREE.SAOPass.OUTPUT.SAO,
'Depth': THREE.SAOPass.OUTPUT.Depth,
'Normal': THREE.SAOPass.OUTPUT.Normal
} ).onChange( function ( value ) {
saoPass.params.output = parseInt( value );
} );
gui.add( saoPass.params, 'saoBias', - 1, 1 ).onChange(render);
gui.add( saoPass.params, 'saoIntensity', 0, 1 ).onChange(render);
gui.add( saoPass.params, 'saoScale', 0, 10 ).onChange(render);
gui.add( saoPass.params, 'saoKernelRadius', 1, 100 ).onChange(render);
gui.add( saoPass.params, 'saoMinResolution', 0, 1 ).onChange(render);
gui.add( saoPass.params, 'saoBlur' ).onChange(render);
gui.add( saoPass.params, 'saoBlurRadius', 0, 200 ).onChange(render);
gui.add( saoPass.params, 'saoBlurStdDev', 0.5, 150 ).onChange(render);
gui.add( saoPass.params, 'saoBlurDepthCutoff', 0.0, 0.1 ).onChange(render);
gui.open();
Then i have a render funtion:
function render(){
scene.background = background;
renderer.toneMappingExposure = params.exposure;
composer.render();
renderer.render( scene, camera );
}
With this code the SSAOPass not work. If i put the composer.render() in the animate function:
var animate = function () {requestAnimationFrame( animate );
stats.begin();
renderer.render( scene, camera );
composer.render();
stats.end();};
animate();
The code runs but the web goes very slow. Any idea?
Thanks.