Search Unity

Post Rendering and Graphics.Blit Performance Cost

Discussion in 'iOS and tvOS' started by orphicsage, Oct 25, 2013.

  1. orphicsage

    orphicsage

    Joined:
    Jul 10, 2013
    Posts:
    5
    Hi there,

    A couple years ago I made a mobile game, and created my own blurring image effect. It significantly decreased performance by somewhere around 70%.

    Recently, I've worked on a few games that have used OnPostRendering, but did not necessarily use Graphics.Blit. I barely noticed any decrease in performance. This left me confused as to what is effecting performance? I recently created a basic OnPostRender script, using blit, and did not notice a significant increase in performance, using the profiler; However, with this test, I was not performing any complex shader operations, after I blit the screen.

    Is it Post Rendering or Graphics.Blit that is expensive? And how is expensive are exactly each one of these methods, if using on iOS 4s and above?

    Any additional information about these methods performance costs would be greatly appriciated! :D

    Thanks!
     
  2. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    Funny trick you can do here....

    Blitting has alot of overhead, however rendering the screen to a render texture does not. This means you can implement full screen effects without blitting.

    Render to a render texture, somehow draw the render texture full screen with a special shader on it. Then the performance hit is dependent only on the shader you are using on the render texture.

    Or what you can do is project the render texture onto surfaces, by using a vertex shader that sets up the uvs to be a projection from the camera. Then you can put shader effects on specific objects.

    Thats how I did the blur effect I showed here http://forum.unity3d.com/threads/188853-iOS7-Blur-effect-in-Unity
    Which I just blured it, but more could be done with it...
    Interestingly to when using a projected render texture like that to make transparent surfaces, the surface isn't really transparent, so it doesn't have overdraw
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Graphics.Blit should have same overhead with same shader. Do you have findings on that? I never actually use blit so I wouldn't know. But I do know that internally it just renders a quad with a shader of your choice. So is your information correct?