Hey Three JS Forum
I am totally new to Three JS and ran into an interesting problem When adding ssao to a scene with an imported mesh I get a strange effect where it seems like some meshes are transparent or the ssao effects are drawn even if they should not be visible (see Screenshot)
This is the view from below the room, and the ssao effects are drawn anyway…
This is a Fiddle I set up: https://jsfiddle.net/wdt4he0o/
Thank you for any help!
It seems some objects have flipped faces and SAOPass
has issues with such objects. This becomes obvious if you force your scene to render everything with THREE.FrontSide
. Screenshot without post-processing:
It would be preferable to fix such modeling issues in any event since none of the 3D objects require double sided rendering.
Besides, avoid doing this:
renderer.render( scene, camera );
composer.render();
WebGLRenderer.render()
is not required in this setup.
2 Likes
Thank you, I’ll look into it
I come from Babylon and had no problems with this, so far
Could you please tell me what exactly you did with the FrontSide attribute?
I just experienced another problem… Could the inverted normals also cause problems when dealing with shadow casting/receiving?
I tried this to implement lighting, but it does not seem to work: Edit fiddle - JSFiddle - Code Playground
please excuse the followup question
You have two typos in your code. Fixed version: Edit fiddle - JSFiddle - Code Playground
It should be receiveShadow
and shadowMap.enabled
.
I am so sorry! As I said, I am new to Three and I don’t have code correction yet…
Thank you so much for your patience and help!
2 Likes
In case someone, like me, cannot fix the mesh topology and needs to render both sides of the triangles you can do this which seems to work:
saoPass.normalMaterial.side = THREE.DoubleSide;
and the same can be done for the SsaoPass
1 Like