Home>

I'm making a horror game with Unity and trying to change the contrast of the images.
Site used: [Introduction to Unity Shader] Adjust contrast A post effect to be used

I was able to increase the contrast as in the site, but only the right half of the screen could change the contrast.
I want to apply it to the whole screen, but I don't know what code to change.
Please tell me how to understand. Please.

By the way, Unity uses a free one.

  • Answer # 1

    I ’m not sure, so I ’m sorry.

    float4 frag (v2f_img i): COLOR {
                        float4 c = tex2D (_MainTex, i.uv);
                        if (i.uv.x>0.5) {// It seems that the right half is specified here
                            c = 1/(1 + exp (-_ Contrast * (c-0.5)));
                        }
                        return c;
                    }

    The above source

    float4 frag (v2f_img i): COLOR {
                        float4 c = tex2D (_MainTex, i.uv);
                        c = 1/(1 + exp (-_ Contrast * (c-0.5)));
                        return c;
                    }


    I think you should change it to
    Because it is urgent and hurry up, we have not confirmed the operation, so it is not bad.

  • Answer # 2

    if (i.uv.x>0.5) {
       c = 1/(1 + exp (-_ Contrast * (c-0.5)));
    }

    Change the condition of this if statement, or delete the if statement and make only the contents (c = ...).