Is there a way to make gtao selective, I just want certain objects in my scene to have ao effect


I just want the floor to effect each other and have ao effect

Technically - it’s possible, you’d just need to modify the scene passed to AO pass, render the AO, then apply it over the original scene. But it’s not supported out of the box.

can you show me some code? thanks

There’s not that much you’d need to modify:

  1. Copy this entire file.
  2. Change this line into something like:
if ( object.isPoints || object.isLine || object.userData.contributeToAO === false ) object.visible = false;
  1. Set userData.contributeToAO to false for all objects you do not want to affect AO:
buildingMesh.userData.contributeToAO = false; // NOTE Building mesh will no longer create ambient occlusion, but keep in mind AO from other objects will still appear on it.
1 Like

Perhaps you could just render the floors you don’t want AO on, right after doing your main composer.render()?
smth like:

composer.render()
renderer.autoClearColor=renderer.autoClearDepth = false;
renderer.render( yourNonAOModel1 , camera)
renderer.render( yourNonAOModel2 , camera) ....
renderer.autoClearColor=renderer.autoClearDepth = true;

not works


this.composer.render();
if (this.shellObject) {
this.shellObject.visible = true;
}
this.renderer.autoClearColor=this.renderer.autoClearDepth = false;
this.renderer.render( this.Scene , this.camera)

  this.renderer.autoClearColor=this.renderer.autoClearDepth = true;

I didn’t mean re-render the whole scene… just to re-render the objects you don’t want AO on, so they render on top of the AO’ed scene? Hopefully the depth buffer is still intact after the post processing… and they will still clip properly with the rest of the scene…

Otherwise, maybe I don’t understand the question?