Log in or register to post comments

Camera feed color with PBR workflow and OpenGL 3

May 30, 2017 - 5:27pm #1

I have a AR project with Unity 5.6.1f1, Vuforia 6.2.10, with OpenGL 3 as we are using the PBR workflow.

Vuforia support for OpenGL 3 was a breeze as PBR really punch the visual quality of the 3D models, very happy with it.

A non critical question I want to ask is that when using linear space instead of gamma for the PBR workflow the AR camera feed (not the augmentation, the real background) gets more "white tinted" than when using the gamma color space which make it look less natural or weird. I know this is expected due to the switch to the linear space, however I was wondering if there are any options to render the camera feed in gamma space or apply a color correction to it (if it is not a heavy process for the device) so the camera feed looks more natural.



I am attaching two sample screenshots taken from the device using our app (with no augmentation) to explain the differences in color between both color spaces.


Image icon gamma.jpeg79.03 KB
Image icon linear.jpeg64.98 KB

Camera feed color with PBR workflow and OpenGL 3

April 21, 2018 - 8:20am #4

i wonder, how the result now, using that custom shader?

Camera feed color with PBR workflow and OpenGL 3

November 24, 2017 - 12:53am #3

It works like a charm.

I would like to add that starting at Vuforia 6.5, you have to do this by selecting the ARCamera, clicking the "Open Vuforia Configuration" button and dragging the shader to the "Video Background Shader" slot.

Thank you again!

Camera feed color with PBR workflow and OpenGL 3

July 4, 2017 - 5:26am #2

Yes, this is totally possible with a custom shader on the BackgroundPlane.

I copied the code from some place I can't remember unfortunately so I can't claim this shader as my own, but it works fine.


Shader "AddGamma" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    SubShader {



        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        sampler2D _MainTex;

        struct v2f {
            float4  pos : SV_POSITION;
            float2  uv : TEXCOORD0;

        float4 _MainTex_ST;

        v2f vert (appdata_base v)
            v2f o;
            o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
            o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
            return o;

        half4 frag(v2f i) : COLOR
            half4 c = tex2D (_MainTex, i.uv);
			c.rgb = pow(c.rgb, 2.2);
            return c;


    FallBack "Diffuse"
Log in or register to post comments