To achieve two-sided transparent no light only texture-colored surface shader.
Wrong wording: (resulting in exposure)
Shader "Custom/doublefacetransptexcolor" {
Properties {
_color ("Color", color) = (1,1,1,1)
_maintex ("Albedo (RGB)", 2D) = "White" {}
}
Subshader {
Tags {"Rendertype" = "Transparent"}
LOD 200
Cull OFF
Blend srcalpha Oneminussrcalpha//Alpha Blending
Cgprogram
Physically based standard lighting model, and enable shadows on all light types
#pragma surface surf Mytexcolor alpha:fade
Half4 Lightingmytexcolor (surfaceoutput s, Half3 lightdir, half atten) {
Half4 C;
C.rgb=s.albedo;
C.a=s.alpha;
return C;
}
Use Shader Model 3.0 target, to get nicer looking lighting
#pragma target 3.0
Sampler2d _maintex;
struct Input {
FLOAT2 Uv_maintex;
};
Fixed4 _color;
void Surf (Input in, InOut surfaceoutput o) {
Albedo comes from a texture tinted by color
Fixed4 C = tex2d (_maintex, In.uv_maintex) * _COLOR;
O.albedo = C.rgb;
O.alpha = C.A;
}
Endcg
}
FallBack "Diffuse"
}
The correct wording:
Shader "Custom/doublefacetransptexcolor" {
Properties {
_color ("Color", color) = (1,1,1,1)
_maintex ("Albedo (RGB)", 2D) = "White" {}
}
Subshader {
Tags {"Rendertype" = "Transparent" "renderqueue" = "Transparent"}
LOD 200
Cull OFF
Lighting OFF
Blend srcalpha Oneminussrcalpha//Alpha Blending
Cgprogram
Physically based standard lighting model, and enable shadows on all light types
#pragma surface surf Mytexcolor noforwardadd Alpha:fade
Half4 Lightingmytexcolor (surfaceoutput s, Half3 lightdir, half atten) {
Half4 C;
C.RGB=HALF3 (0,0,0);
C.a=s.alpha;
return C;
}
Use Shader Model 3.0 target, to get nicer looking lighting
#pragma target 3.0
Sampler2d _maintex;
struct Input {
FLOAT2 Uv_maintex;
};
Fixed4 _color;
void Surf (Input in, InOut surfaceoutput o) {
Albedo comes from a texture tinted by color
Fixed4 C = tex2d (_maintex, In.uv_maintex) * _COLOR;
O.emission = C.rgb;
O.albedo = Fixed3 (0,0,0);
O.alpha = C.A;
}
Endcg
}
FallBack "Diffuse"
}
Reference: http://answers.unity3d.com/questions/272749/how-to-write-unlit-surface-shader.html
Unity, unlit surface shader (Texcolor only surface shader)