javascript - THREE.js: combining smaa and ssao postprocessing -
i'm trying combine smaa , ssao in three.effectcomposer
this:
this.composer = new three.effectcomposer(this.renderer); // setup depth pass depthmaterial = new three.meshdepthmaterial(); depthmaterial.depthpacking = three.rgbadepthpacking; depthmaterial.blending = three.noblending; var pars = { minfilter: three.linearfilter, magfilter: three.linearfilter }; depthrendertarget = new three.webglrendertarget( window.innerwidth, window.innerheight, pars ); // setup ssao pass ssaopass = new three.shaderpass( three.ssaoshader ); ssaopass.rendertoscreen = true; ssaopass.uniforms[ "tdepth" ].value = depthrendertarget.texture; ssaopass.uniforms[ 'size' ].value.set( window.innerwidth, window.innerheight ); ssaopass.uniforms[ 'cameranear' ].value = this.camera.near; ssaopass.uniforms[ 'camerafar' ].value = this.camera.far; ssaopass.uniforms[ 'onlyao' ].value = false; ssaopass.uniforms[ 'aoclamp' ].value = .3; ssaopass.uniforms[ 'luminfluence' ].value = 1; this.ssaopass = ssaopass; this.depthrendertarget = depthrendertarget; smaapass = new three.smaapass( window.innerwidth, window.innerheight ); smaapass.rendertoscreen = true; this.composer.addpass(new three.renderpass(this.scene, this.camera)); this.composer.addpass(ssaopass); this.composer.addpass(smaapass);
but unfortunately smaapass gets applied. tried inverting order of composer.addpass
without success. wrong? thanks!
var renderpass = new three.renderpass( scene, camera ); this.composer = new three.effectcomposer(this.renderer); this.composer.addpass(renderpass); // setup depth pass depthmaterial = new three.meshdepthmaterial(); depthmaterial.depthpacking = three.rgbadepthpacking; depthmaterial.blending = three.noblending; var pars = { minfilter: three.linearfilter, magfilter: three.linearfilter, format: three.rgbaformat }; depthrendertarget = new three.webglrendertarget( window.innerwidth, window.innerheight, pars ); // setup ssao pass ssaopass = new three.shaderpass( three.ssaoshader ); ssaopass.uniforms[ "tdepth" ].value = depthrendertarget.texture; ssaopass.uniforms[ 'size' ].value.set( window.innerwidth, window.innerheight ); ssaopass.uniforms[ 'cameranear' ].value = this.camera.near; ssaopass.uniforms[ 'camerafar' ].value = this.camera.far; ssaopass.uniforms[ 'onlyao' ].value = false; ssaopass.uniforms[ 'aoclamp' ].value = .3; ssaopass.uniforms[ 'luminfluence' ].value = 1; ssaopass.rendertoscreen = false; // lviggiani edit smaapass = new three.smaapass( window.innerwidth, window.innerheight ); smaapass.rendertoscreen = true; this.composer.addpass(ssaopass); this.composer.addpass(smaapass);
i made renderpass
above , added renderpass
before setting ssao
. put rendertoscreen
@ bottom of setup instead @ top. removed this.depthrendertarger = depthrendertarger;
, unless have set somewhere else don't need that. added rgb format depthrendertarget
.
Comments
Post a Comment