Search Unity

Need help with custom sunshaft system.

Discussion in 'Image Effects' started by FirstTimeCreator, Jul 6, 2018.

  1. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    I am needing to prevent things from being hit by sunshafts.

    I am using a layered 4 camera system.

    I need the shafts to only hit objects on one camera. Currently, the sunshafts that come with unity work by using OnRenderImage which combines all of the camera's output into a single image and applies the FX to it.

    That does not work for my purposes so, I was looking for a way to intercept the render buffer for an individual camera, convert it to a render texture, apply the FX to it and then replace that camera's output with the updated version without applying the FX to all combined cameras.

    I realize there may be some performance cost to that however, I would like to try it and find out, if it is possible to do.

    What I want to know is am I chasing a ghost? Is it possible to do this? I have been looking for a while and figured I would ask, maybe save myself some time.

    Thanks,
    Johnny
    DeepLogicGames
     
  2. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Possible through the CommandBuffer?
     
  3. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Found a possible solution:
    https://forum.unity.com/threads/mul...fects-and-the-deferred-rendering-path.323174/

    However, performance impact may be scary esp on high resolution.. so, guess i will give it a try and see what happens. I just cant give up on sunshafts in my space sim.

    The problem is they were hitting distance stars in the background that are anywhere from 6 to 100 million meters away, they are emmisive so the sun of the solar system the player is currently in produces a shaft and it was hitting them as the ship passed by and other distance suns were clipping it.