Shader "Ciconia Studio/Double Sided/Emissive/Diffuse" {
|
|
Properties {
|
|
_Color ("Diffuse Color", Color) = (1,1,1,1)
|
|
_MainTex ("Diffuse map", 2D) = "white" {}
|
|
_EmissiveIntensity ("Emissive Intensity", Range(0, 2)) = 1
|
|
}
|
|
SubShader {
|
|
Tags {
|
|
"RenderType"="Opaque"
|
|
}
|
|
Pass {
|
|
Name "FORWARD"
|
|
Tags {
|
|
"LightMode"="ForwardBase"
|
|
}
|
|
Cull Off
|
|
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
#pragma multi_compile_fwdbase_fullshadows
|
|
#pragma multi_compile_fog
|
|
#pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone ps4 psp2 n3ds wiiu
|
|
#pragma target 3.0
|
|
uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
|
|
uniform float4 _Color;
|
|
uniform float _EmissiveIntensity;
|
|
struct VertexInput {
|
|
float4 vertex : POSITION;
|
|
float2 texcoord0 : TEXCOORD0;
|
|
};
|
|
struct VertexOutput {
|
|
float4 pos : SV_POSITION;
|
|
float2 uv0 : TEXCOORD0;
|
|
UNITY_FOG_COORDS(1)
|
|
};
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput o = (VertexOutput)0;
|
|
o.uv0 = v.texcoord0;
|
|
o.pos = UnityObjectToClipPos( v.vertex );
|
|
UNITY_TRANSFER_FOG(o,o.pos);
|
|
return o;
|
|
}
|
|
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
|
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
|
float faceSign = ( facing >= 0 ? 1 : -1 );
|
|
////// Lighting:
|
|
////// Emissive:
|
|
float4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
|
|
float3 emissive = ((_MainTex_var.rgb*_Color.rgb)*_EmissiveIntensity);
|
|
float3 finalColor = emissive;
|
|
fixed4 finalRGBA = fixed4(finalColor,1);
|
|
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
|
|
return finalRGBA;
|
|
}
|
|
ENDCG
|
|
}
|
|
Pass {
|
|
Name "ShadowCaster"
|
|
Tags {
|
|
"LightMode"="ShadowCaster"
|
|
}
|
|
Offset 1, 1
|
|
Cull Off
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
#include "Lighting.cginc"
|
|
#pragma fragmentoption ARB_precision_hint_fastest
|
|
#pragma multi_compile_shadowcaster
|
|
#pragma multi_compile_fog
|
|
#pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone ps4 psp2 n3ds wiiu
|
|
#pragma target 3.0
|
|
struct VertexInput {
|
|
float4 vertex : POSITION;
|
|
};
|
|
struct VertexOutput {
|
|
V2F_SHADOW_CASTER;
|
|
};
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput o = (VertexOutput)0;
|
|
o.pos = UnityObjectToClipPos( v.vertex );
|
|
TRANSFER_SHADOW_CASTER(o)
|
|
return o;
|
|
}
|
|
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
|
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
|
float faceSign = ( facing >= 0 ? 1 : -1 );
|
|
SHADOW_CASTER_FRAGMENT(i)
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
FallBack "Diffuse"
|
|
}
|