Hello
I’m trying to write a shader that we need for our projects. The thing is, we have alot of messed-up geometry(flipped normals), and need to find a simple way to fix it.
Our solution would be a shader, that renders object in one pass as it is, and in second pass flip the culling and normals.
This is a what i came up so far:
Shader "Diffuse 2Sided" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Pass{
Cull Front
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input {
float2 uv_MainTex;
};
void vert (inout appdata_full v) {
v.normal = v.normal * -1;
}
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Pass{
Cull Back
SetTexture [_MainTex] {
combine texture * previous DOUBLE, texture * primary
}
}
}
Fallback "Diffuse"
}
I get this error
Shader error in ‘Diffuse 2Sided’:
Parse error: syntax error at line 12
Any ideas why I can’t seem to have both the “Pass” and “CGPROGRAM” in this shader?
Thanks in advance for help