I am trying to code a shader using the Free version of Unity. I would like the shader to make the surface of my object blend with what is behind it, camouflage in other words. I am trying to follow this tutorial which has the exact camo look I am going for:
Here is my shader code:
Shader "Custom/Camouflage" {
Properties {
_Texture ("Main Texture", 2D) = "white" {}
}
SubShader {
//Draw ourselves after all opaque geometry
Tags { "Queue" = "Transparent" }
//Grab the screen behind the object into _GrabTexture, using default values
GrabPass {}
//Render the object with the texture generated above
Pass {
SetTexture [_GrabTexture] { combine texture }
SetTexture [_GrabTexture] { combine previous +- previous }
SetTexture [_Texture] { combine previous +- texture }
SetTexture [_GrabTexture] { combine previous + previous }
}
}
}
Unfortunately though it is not working. Ive applied this shader to a simple sphere gameobject but it turns the “error pink” color. Could someone please let me know what I’m doing wrong. I’m not getting any errors but it just simply doesn’t look the same as in the video tutorial. I’m not sure if it’s because the tutorial is outdated.
was long time ago (with unity4), I don't know if I could explain that well. I added the main script to the answer
– Nerevar