The title says it all. I use a GrabPass for my shader and it works just fine in the editor, but the second I change for DX11 or I make an executable, the GrabPass dissapears with my gloss and my normals and everything, leaving a grayish texture instead of my shader.
Screen in editor :
http://imageshack.us/a/img850/2373/9xtq.jpg
Screen with DX11/Executable :
http://imageshack.us/a/img132/5568/pcoz.jpg
(The white spots are another material I put on the plane, which is not affected)
And here is my shader :
Shader "Water/CustomWaterShader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_BumpMap ("Normalmap", 2D) = "bump" {}
_BumpMap2 ("Normalmap", 2D) = "bump" {}
_Distortion ("Distortion", Range (75, 5)) = 40
}
SubShader {
Tags {"Queue"="Overlay" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 400
GrabPass{"_ScreenTex"}
Cull Off
CGPROGRAM
#pragma surface surf BlinnPhong alpha
sampler2D _BumpMap;
sampler2D _ScreenTex;
sampler2D _BumpMap2;
fixed4 _Color;
half _Shininess;
half _Distortion;
struct Input {
float2 uv_BumpMap;
float2 uv_BumpMap2;
float4 screenPos;
};
void surf (Input IN, inout SurfaceOutput o) {
float2 customUV;
customUV = float2((IN.screenPos.xy/IN.screenPos.w).xyxy);
#if SHADER_API_D3D9
if (customUV.y > 0)
customUV.y = 1.0f - customUV.y;
#endif
customUV = customUV + customUV * (UnpackNormal(tex2D(_BumpMap , IN.uv_BumpMap)/2 + tex2D(_BumpMap2 , IN.uv_BumpMap2)/2)/_Distortion);
fixed4 bg = tex2D(_ScreenTex,customUV);
o.Albedo = bg.rgb * _Color.rgb;
o.Alpha = 1;
o.Gloss = 2;
o.Specular = _Shininess;
o.Normal = UnpackNormal(tex2D(_BumpMap , IN.uv_BumpMap)/2 + tex2D(_BumpMap2 , IN.uv_BumpMap2)/2);
}
ENDCG
}
FallBack "Transparent/VertexLit"
}
Other things that might help :
-I have Unity Free
-I get these warnings on my shader :
Shader warning in 'Water/CustomWaterShader': Program 'vert_surf', incorrect number of arguments to numeric-type constructor (compiling for d3d11) at line 68
Shader warning in 'Water/CustomWaterShader': Program 'vert_surf', incorrect number of arguments to numeric-type constructor (compiling for d3d11_9x) at line 68
Oh and also, my shader seems to become vertex lit, which is pretty wierd.
– drak8888