SSAO and Particles Issue.

This has been discussed in UnityAnswers awhile ago, but no answer was given so I’ll ask here.

The SSAO in unity pro 3.3 is a little weird, it doesn’t ignore particles, because its under the TransparentFX section, it wont ignore it, therefore it will show the dark crease above the particles, to make it easier ill show you how it looks below.

I know the problem, I don’t know how to fix it, if someone can chime in and see how to fix the problem, I’d appreciate it.

Thanks for your time!

bump… im sure this is a problem for everyone else :S

this is to expect. SSAO as its offered by default is a post fx as such it renders after everything else, including after particles.

So theres no shader fix at all? Thats odd… I hope it gets fixed in the next update to ignore particles, It would be really good.

Any Ideas when this will be fixed, or how this can be fixed?

Set your particles to a separate camera and draw it after. It won’t even be slower as they use a separate draw call anyway.

It should work 100% fine.

I’m having this same issue and I also came to the conclusion that a second camera should be used, but that just adds additional problems, the second camera can’t be forward rendering because then your particles render over everything, so switch the next camera to Deferred, which has anti-aliasing issues.

On top of all that the SSAO doesn’t seem to take vertex manipulation (via vertex shaders) into account, can that be done? I’ve put the addshadow tag to my shader, but that just adds shadowing, I was hoping it could sort out the Z-Buffer too, but alas not.

Thanks people.

SSAO uses the _CameraDepthNormal texture to calculate ssao. This is created internally by unity. One way to fix your problem is to manually render your own depthnormal textures and throw that into the ssao shader. It still might be hard because you have to decide how particles render in your depth buffer.

You need to renderwithshader(RenderDepthShader, “RenderType”). Then for
In your shader you have to put in a section for
{“RenderType” = “TransparentFX”}
Then write into the zbuffer.

The problem with this is you might get an outline around your particles because they are part of the depth buffer.

Or use an image effect to render the particles to a seperate buffer and blend them back to the main buffer.

Old thread but reference for later:
Using a second camera works fine, i have yet to test performance, but here’s a 6 step configuration for anyone new to unity:

  1. Create a layer i.e. TransparentFX
  2. Add the particle system/effect/object you wish to render above SSAO to this layer
  3. Create a camera with depth higher than the main camera ( you probably want to move this inside the main camera to move with it )
  4. Deactivate your new layer ( TransparentFX ) from the main camera’s culling mask
  5. On the new camera ( FX Camera ) set the culling mask to nothing EXCEPT TransparentFX
  6. IMPORTANT: Set ‘Clear Flags’ to Don’t Clear, in the new camera

Ready :slight_smile:

Since this was bumped, I might as well go into detail why unity need to renovate the current system a little to allow for the design of Visual Templates.

A visual template gives all the required post fx and shaders (cool motion blur, bloom, dof, SSAO etc) in a manner where they efficiently play off each other in design like Cryengine or UDK. A visual template most likely needs a few hooks in the engine to pull off at a decent speed.

The current architecture of unity is inefficient and slow since you’re essentially stacking all the effects and doing multiple render passes when a lot can be combined for speed and visual quality. People tend to moan about how UDK looks better, or Cryengine looks better - even with cubes. Yes you can build the same look from scratch but the time spent will be months on it.

Having baseline visual templates allows unity to keep up with cryengine and udk default visuals with similar performance, a win for everyone really. You could do it stacking unity shaders and using workarounds, or making your own entire visual look from scratch, but that puts your development time on par with what you’d get if you used Cryengine or UDK anyway (in total) so unity isn’t winning anything here.

1 Like

briosh, it was helpful )
Long time had this issue, so thanks)

Bumping an old thread because this one is at the top of Google search results but has an outdated, complicated solution…and since the last post there is now a very simple solution:

From umauj at http://answers.unity3d.com/questions/212661/ugly-artefacts-with-ssao-and-particles.html

I’m facing same prolem in U5, I see the default Image effect already as the attribute [ImageEffectOpaque] but that did not work as expect. The second camera behaves strangely, it seems to ignore the depth and draws on top of everything even though it’s set to Dont 'Clear

I have exact same issues :frowning: