Dark lines on object from SAO when adjusting camera angle

When I move the camera to the top of my scene, the AO looks great on my model. As I rotate the camera down, dark lines begin to appear on the model, increasing in quantity as the camera gets lower to the ground plane. Is this due to the AO being created using an orthographic camera?

I am using SAOPass.js and SAOShader.js. I have not changed any of the code in those files.

Video of issue

CODE…

///////////// PREP EFFECT COMPOSER /////////////

effectComposer = new THREE.EffectComposer( renderer );
effectComposer.setSize( renderContainerWidth * window.devicePixelRatio, renderContainerHeight * window.devicePixelRatio);

///////////// RENDER PASS /////////////

var renderPass = new THREE.RenderPass( scene, camera );
renderPass.enabled = false;
effectComposer.addPass( renderPass );

///////////// TAA /////////////

var taaRenderPass = new THREE.TAARenderPass( scene, camera );
taaRenderPass.unbiased = true;
taaRenderPass.sampleLevel = 2;
effectComposer.addPass( taaRenderPass );

///////////// COPY PASS /////////////

var copyPass = new THREE.ShaderPass( THREE.CopyShader );
effectComposer.addPass( copyPass );

///////////// SAO /////////////

var params = {
output: 0,
saoBias: 1,
saoIntensity: .5,
saoScale: 200,
saoKernelRadius: 50,
saoMinResolution: .0002,
saoBlur: true,
saoBlurRadius: 1.5,
saoBlurStdDev: 38,
saoBlurDepthCutoff: .0001
}

saoPass = new THREE.SAOPass( scene, camera, false, true, {x:256,y:256}) ;
for( var e in params ) {
if( e in saoPass.params )
saoPass.params[e] = params[e];
}
saoPass.saoMaterial.defines[‘NUM_SAMPLES’] = 64;

saoPass.renderToScreen = true;
effectComposer.addPass( saoPass );

I’ve never used the SAO effect, but that looks an awful lot like shadow acne. ThreeJS uses the bias property to add/subtract a bit of distance when determining whether a plane is in shadow. Maybe you could try tweaking the saoBias parameter in your params object for a similar behavior?

Hi Marquizzo. Thank you for your suggestion. Not sure why this worked, but I adjusted to scene camera far to 4,000 from 60,000 (the size of my scene) and the artifacts went away.

1 Like