Search Unity

Post processing effects using shaders

Discussion in 'Shaders' started by doridori, Jul 3, 2013.

  1. doridori

    doridori

    Joined:
    Jun 27, 2013
    Posts:
    4
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Pretty much all image effects require the ability to render to a texture, which is a Pro-only feature.
     
  3. doridori

    doridori

    Joined:
    Jun 27, 2013
    Posts:
    4
    Thanks for the reply. So can I not implement a custom shader without pro? I thought I read you can write custom shaders in free (blur for example) and the difference was that you could only not apply them to the whole rendered frame at the end of the frame proceeding. Is that wrong?
     
  4. BIG-BUG

    BIG-BUG

    Joined:
    Mar 29, 2009
    Posts:
    457
    No, it's right.
    You can implement a custom shader, however you have no access to already rendered pixels (which in Pro is available via RenderTextures, GrabPass or ImageEffects) which would be required for certain effects.
    With some tricks you might render an object in a way that it appears blurred however those effects can't be compared to what is possible in Unity Pro.
     
  5. doridori

    doridori

    Joined:
    Jun 27, 2013
    Posts:
    4
    Thanks for the reply, much appreciated.

    When your saying they cant be compared do you mean that trying to implement these effects on the render-pass will look rubbish (and I imagine will not be as simple to wrtie) compared to using pro and implemented on the already rendered pixels?

    Thanks again
     
  6. BIG-BUG

    BIG-BUG

    Joined:
    Mar 29, 2009
    Posts:
    457
    Certainly not as simple and not as fast and for most effects not the same look (doesn't have always to be that ugly if done right).
    For example a fake object blur could be achieved by rendering an object multiple times: first pass would be solid, then add semitransparent passes with extrusion along the normals. Or if you want to have a rotation blur for car wheels you would just rotate the semitransparent passes.
    A glow effect might be faked in a similar way, here you would use additive blending instead of regular alpha blending. Or you could add halo sprites in front of the object.
    It all depends on your creativity and what look you are trying to achieve. Also some "fake effects" are available in the asset store.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The reason for render textures is that you render the main scene to a texture, then use this texture as the basis for the shader. The shader then uses this texture blurred (via blit multitap usually), which is then rendered on a quad to the final camera with a useful blending such as add blend, and a threshold for how bright pixels need to be in order to qualify for bloom. This is your classic technique, so you need render textures to do it at any useful speed.

    You can't do this without render textures properly. You could probably every read n pixel from the back buffer and draw to a texture but it would look awful, and very low framerate. With render textures, you get to draw a camera to a texture, avoiding any sort of slow pixel operation.
     
    Last edited: Jul 4, 2013
  8. doridori

    doridori

    Joined:
    Jun 27, 2013
    Posts:
    4
    Hmmm, my post didnt seem to send...

    Thanks for the replys - its a shame as I cant afford the pro version at this moment in time so I will have to go with a different engine :(