Log in or register to post comments

Disregard target color?

May 22, 2013 - 12:50pm #1

I need to use grayscale camera effects in Unity but track a color target..........I got it working as grayscale but it's not tracking my targets anymore. Should I leave the camera in color and use a second camera to do the grayscale effect and not have the Qcar camera showing a background feed?

 

Thanks,

 

Disregard target color?

May 23, 2013 - 8:09am #7

Epic, thank you so much. Works like a charm :) 

Disregard target color?

May 22, 2013 - 6:12pm #6

I think that you should be able to simply replace the NegativeGrayScale shader on the NegativeGrayScale material. But a simpler approach, that will enable you to retain the touch warping, would be to revise the NegativeGrayScale shader to a normal grayscale shader by changing the function at line 46 to..

 

        void frag(Input IN, inout SurfaceOutput o) {
            half4 incoming = tex2D (_MainTex, IN.uv_MainTex);
            o.Albedo = ((incoming.r + incoming.g + incoming.b)/3);
            o.Alpha = incoming.a;
        }

* the 1 - (r + g + b )/3  operation is what switches the image to a negative.

Disregard target color?

May 22, 2013 - 3:35pm #5

Thanks David, I was looking at that and tried just swapping out the shader in the example with a plain grayscale one but it didn't work, maybe it was just the shader I tried.

 

I just need to put the shader on the plane it's using right? Maybe disable the invertedgrayscale script attached to it as well? (which is pretty neat honestly, the warping where you touch, just needs to be regular grayscale :) )

Disregard target color?

May 22, 2013 - 3:03pm #4

Check Unity Answer or their forum for some options - e.g. http://answers.unity3d.com/questions/31823/how-do-i-make-a-texture-turn-greyscael.html

 

Disregard target color?

May 22, 2013 - 1:57pm #3

Looks good but I need the normal grayscale and not inverted. Any simple way to do that? 

Disregard target color?

May 22, 2013 - 12:54pm #2

Take a look at our Unity Background Texture Access sample - https://developer.vuforia.com/resources/sample-apps/background-texture-access-sample-app

That demonstrates how to render the camera image to a texture, set up that texture as the scene background, and to apply effects using shaders.

Log in or register to post comments