Hi,
before I start investigating this myself I wanted to ask if someone has already solved the problem with SSOA and that it misbehaves on scenes with transparent surfaces?
I guess a solution would be to use two cameras, one for opaque and one for transparent objects and only use SSOA on the former?! But I am still a little curious how to do it at all (without artifacts) and how to do it efficiently…
PS: probably not needed: the misbehavior is that SSOA shines “through” transparent objects and that is looking really ugly!
Burns
You can do it as you said. Make two cameras, set up the layers appropriately, and make the camera that renders transparent object to render after the one with SSAO (with the depth order). Parent the cameras together because I assume you want them to be in the same place.
Although you will then probably have problems with transparent things not being occluded by anything? I am not sure, I haven’t tried it yet.
Seems like something helpful is also discussed here: http://forum.unity3d.com/threads/62924-Edge-detection-as-image-effect./
Well the depth seems to be accessible but I am not sure if it is fast enough… What I would do right now is to use the two cameras, one for particles and one for all others and then enable their Depth textures… Now I could create a shader taking both rendered full screen scenes and their depth values. What this shader would do is simply:
- selecting the pixels depending on depth values, just like the graka usually would
- additionally it would have to blend the particles according to their alpha values
- render the final image as full screen quad using Blit()
But this sounds god damn expensive to me, even though SSOA is usually only for high-end systems…
Isn’t there a better way to do this?
Also I wonder if there isn’t a better way to “merge” these two camera rendertextures without comparing their depth values in a pixel shader?! This is something the graka should be able to do automatically?!
A little bit more insight here would be nice, since SSOA is pretty much useless without this capability. It just looks awful => means you can’t use it in any serious way => SSOA like it is would be useless… Why isn’t something like that builtin? Unity could do this much more efficient within the rendering pipeline…