Search Unity

In FastBloom(Bloom Optimized) shader, what's the difference between "Standard" and "Sgx" blur type?

Discussion in 'Shaders' started by bobozzz, Mar 29, 2017.

  1. bobozzz

    bobozzz

    Joined:
    May 27, 2015
    Posts:
    38
    This was post originally in the general graphics forum, I just realized that I should post in the shaders, so I will just post here again.

    When I use the FastBloom (Bloom Optimized) image effect, I noticed that there are two blur types, which are "standard" and "Sgx".

    When I toggle between them, there is no difference on rendering side. Then I check the shader, both of them are 7 * 7 gaussian blur. The way they do the for loop is different, but they all have 7 times texture reading, so there shouldn't be dramatic performance difference.

    Shader code from FastBloom (I will just copy the horizontal):
    standard:
    vert:
    frag:
    Sgx:
    vert:
    frag:
    Here is the curve4 both of them use:
    static const half4 curve4[7] = { half4(0.0205,0.0205,0.0205,0), half4(0.0855,0.0855,0.0855,0), half4(0.232,0.232,0.232,0), half4(0.324,0.324,0.324,1), half4(0.232,0.232,0.232,0), half4(0.0855,0.0855,0.0855,0), half4(0.0205,0.0205,0.0205,0) };

    If we set _Parameter.x to 2, and resolution to 1024 * 768, standard version samples:
    uv - 6/1024, uv - 4/1024, uv - 2/1024, uv, uv + 2/1024, uv + 4/1024, uv + 6/1024

    sgx version samples:
    uv, uv - 6/1024, uv + 6/1024, uv - 4/1024, uv + 4/1024, uv - 2/1024, uv + 2/1024

    The only difference to me are
    1. the sampling order is different
    2. standard shader calculate sampling uv in the fragment shader, but sgx calculate the sampling uv in the vertex shader
    3. sgx blur type saves some for loops

    I don't get what's the point to have these two blur types. They are pretty much same to meo_O

    Then I did some more research, so SGX is a GPUs series from PowerVR. It's used on newer versions of iPhone (starting with the iPhone 3GS).

    so I guess there should be something in the standard blur type that cannot be done on the SGX hardware, or there is something special in the SGX blur type that can only be done on the SGX hardware?