Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Post Effects in Deferred, with Multiple Cameras

Discussion in 'Unity 5 Pre-order Beta' started by jamie-lowes, Dec 14, 2014.

  1. jamie-lowes

    jamie-lowes

    Joined:
    Jul 5, 2012
    Posts:
    47
    This is a screenshot from a Unity 4.x prototype for the game I'm working on...



    I can't get 5beta17 to do this!

    My game requires a depth of field effect, and I then need to draw transparent things after the DoF effect. I have one camera set to draw opaque objects and apply the DoF effect, then I have an identical camera set up to just draw the transparent parts.

    This doesn't work in Unity by default, it drops all effects when passing the image to the next camera, (if using deferred rendering). However, in 4.x and 5beta15 I could get this to work by adding a render target copy script to the first camera, (as explained in this thread: http://forum.unity3d.com/threads/de...-posts-ssao-bugged-ufps-onrenderimage.198632/).

    But this no longer works in beta17!

    Does anybody else do this kind of thing? Can anyone think of a solution?


    Thanks in advance.
     
  2. cefwyn

    cefwyn

    Joined:
    Jan 2, 2013
    Posts:
    15
    I've just hit this issue today trying to implement an FPS with seperate world and weapon cameras. Any post effects that don't require access to depth information seems to work fine but the instant I do SSAO, or edge detection, or DOF it becomes a case of either one camera or the other. I've wasted all day messing with ways to fix this and the closest thing I could get was when I placed a quad in the scene with a rendertarget as material albedo. In that instance it was able to apply the post process to both the scene and the render target except no matter what clear flag option I chose for the render target it always resulted in something that looked like the depth wasn't being cleared so there may be a bug there. From my experimenting though I could guess that the image effects will need to be rewritten to make use of commandbuffer and combine the two rendertargets manually which may also require a rewriting of the shaders unless there's an easy way to superimpose the one rendertarget over the other without clearing any depth information that shouldn't be cleared before passing it to the post effect shader.