Add shaders
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
Shader "Ciconia Studio/Effects/Highlight/Skinned Mesh (No Script)/Outline Transparent" {
|
||||
Properties {
|
||||
[Space(25)]_OutlineColor ("Outline Color", Color) = (1,1,1,1)
|
||||
_Outline ("Outline", Range(0, 0.1)) = 0.01
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue"="Transparent+1"
|
||||
"RenderType"="Opaque"
|
||||
}
|
||||
GrabPass{ }
|
||||
Pass {
|
||||
Name "Outline"
|
||||
Tags {
|
||||
}
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.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
|
||||
uniform float4 _OutlineColor;
|
||||
uniform float _Outline;
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
UNITY_FOG_COORDS(0)
|
||||
};
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
o.pos = UnityObjectToClipPos( float4(v.vertex.xyz + v.normal*_Outline,1) );
|
||||
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 );
|
||||
return fixed4(_OutlineColor.rgb,0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
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 _GrabTexture;
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 projPos : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
};
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
o.pos = UnityObjectToClipPos( v.vertex );
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
o.projPos = ComputeScreenPos (o.pos);
|
||||
COMPUTE_EYEDEPTH(o.projPos.z);
|
||||
return o;
|
||||
}
|
||||
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
||||
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
||||
float faceSign = ( facing >= 0 ? 1 : -1 );
|
||||
float2 sceneUVs = (i.projPos.xy / i.projPos.w);
|
||||
float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
|
||||
////// Lighting:
|
||||
float3 finalColor = tex2D( _GrabTexture, sceneUVs.rg).rgb;
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user