0

I've been trying to add SSAO into my game, per this SSAO EXAMPLE

Unfortunately, my transparent trees now defected: enter image description here

Please advise on how to fix it.

Kromster
  • 7,181
  • 7
  • 63
  • 111
eldad87
  • 195
  • 1
  • 13

2 Answers2

0

This is not a defect, during the depth-Path, which you need to pass to the SSAO shader further on, transparency is not taken into account, thus your leave-defining planes get detected as planar geometry and get the appropriate outline. Concerning a solution, I cannot really help you. What you can do is hide all the transparent stuff before rendering the depth pass but then, the AO-pass gets multiplied over it, so you just trade in a visual problem against another one. To really solve this, i think you need an additional Three.MaskPass, see here:

Rendering multiple scenes, with only 1 using SSAO [Three.js]

Hope this helps.

Community
  • 1
  • 1
GuyGood
  • 1,377
  • 1
  • 9
  • 12
  • How can I hide the transparent stuff before rendering the depth pass? – eldad87 Nov 15 '13 at 17:55
  • object/mesh.visible = false but as i said, this will only "shift" the real problem... – GuyGood Nov 15 '13 at 21:36
  • Well, it didn't solved my Issue. if you have any other suggestion - please let me know. – eldad87 Nov 25 '13 at 23:03
  • well, as I said above, this will only shift the problem and you will need some kind of renderMask but i am not sure about how to achieve this. See the link i gave in my first answer. Sorry, cannot help any further – GuyGood Nov 26 '13 at 08:41
0

You could pass the texture into the normal/depth fragment shader and discard any fragments with an alpha < 0.5

Telkhine
  • 1
  • 1