ball 项目提交
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: baf1d09e18b500d41a714f6207ddda2d
|
||||
folderAsset: yes
|
||||
timeCreated: 1536402197
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
// Spine/Skeleton PMA Screen
|
||||
// - single color multiply tint
|
||||
// - unlit
|
||||
// - Premultiplied alpha Multiply blending
|
||||
// - No depth, no backface culling, no fog.
|
||||
// - ShadowCaster pass
|
||||
|
||||
Shader "Spine/Blend Modes/Skeleton PMA Additive" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _Color;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
v2f o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.uvAndAlpha.z = 0;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
float4 frag (v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53efa1d97f5d9f74285d4330cda14e36
|
||||
timeCreated: 1496446742
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
// Spine/Skeleton PMA Multiply
|
||||
// - single color multiply tint
|
||||
// - unlit
|
||||
// - Premultiplied alpha Multiply blending
|
||||
// - No depth, no backface culling, no fog.
|
||||
// - ShadowCaster pass
|
||||
|
||||
Shader "Spine/Blend Modes/Skeleton PMA Multiply" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend DstColor OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _Color;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
v2f o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.uvAndAlpha.z = 0;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
float4 frag (v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bdcdc7ee298e594a9c20c61d25c33b6
|
||||
timeCreated: 1496446742
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
// Spine/Skeleton PMA Screen
|
||||
// - single color multiply tint
|
||||
// - unlit
|
||||
// - Premultiplied alpha Multiply blending
|
||||
// - No depth, no backface culling, no fog.
|
||||
// - ShadowCaster pass
|
||||
|
||||
Shader "Spine/Blend Modes/Skeleton PMA Screen" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcColor
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _Color;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
v2f o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.uvAndAlpha.z = 0;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
float4 frag (v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e8caa36c07aacf4ab270da00784e4d9
|
||||
timeCreated: 1496448787
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 511f90ee1fe01c146836d5ed23f2e70f
|
||||
folderAsset: yes
|
||||
timeCreated: 1564083752
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#ifndef SKELETON_LIT_COMMON_SHADOW_INCLUDED
|
||||
#define SKELETON_LIT_COMMON_SHADOW_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
v2f vertShadow(appdata_base v, float4 vertexColor : COLOR) {
|
||||
v2f o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.uvAndAlpha.z = 0;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed SHADOW_CUTOFF;
|
||||
|
||||
float4 fragShadow (v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - SHADOW_CUTOFF);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
|
||||
#endif
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7297b25c81d2494e8e73b742e3c7345
|
||||
timeCreated: 1564083752
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
#ifndef SKELETON_LIT_COMMON_INCLUDED
|
||||
#define SKELETON_LIT_COMMON_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
// ES2.0/WebGL/3DS can not do loops with non-constant-expression iteration counts :(
|
||||
#if defined(SHADER_API_GLES)
|
||||
#define LIGHT_LOOP_LIMIT 8
|
||||
#elif defined(SHADER_API_N3DS)
|
||||
#define LIGHT_LOOP_LIMIT 4
|
||||
#else
|
||||
#define LIGHT_LOOP_LIMIT unity_VertexLightParams.x
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// Alpha Clipping
|
||||
//
|
||||
|
||||
#if defined(_ALPHA_CLIP)
|
||||
uniform fixed _Cutoff;
|
||||
#define ALPHA_CLIP(pixel, color) clip((pixel.a * color.a) - _Cutoff);
|
||||
#else
|
||||
#define ALPHA_CLIP(pixel, color)
|
||||
#endif
|
||||
|
||||
half3 computeLighting (int idx, half3 dirToLight, half3 eyeNormal, half4 diffuseColor, half atten) {
|
||||
half NdotL = max(dot(eyeNormal, dirToLight), 0.0);
|
||||
// diffuse
|
||||
half3 color = NdotL * diffuseColor.rgb * unity_LightColor[idx].rgb;
|
||||
return color * atten;
|
||||
}
|
||||
|
||||
half3 computeOneLight (int idx, float3 eyePosition, half3 eyeNormal, half4 diffuseColor) {
|
||||
float3 dirToLight = unity_LightPosition[idx].xyz;
|
||||
half att = 1.0;
|
||||
|
||||
#if defined(POINT) || defined(SPOT)
|
||||
dirToLight -= eyePosition * unity_LightPosition[idx].w;
|
||||
|
||||
// distance attenuation
|
||||
float distSqr = dot(dirToLight, dirToLight);
|
||||
att /= (1.0 + unity_LightAtten[idx].z * distSqr);
|
||||
if (unity_LightPosition[idx].w != 0 && distSqr > unity_LightAtten[idx].w) att = 0.0; // set to 0 if outside of range
|
||||
distSqr = max(distSqr, 0.000001); // don't produce NaNs if some vertex position overlaps with the light
|
||||
dirToLight *= rsqrt(distSqr);
|
||||
#if defined(SPOT)
|
||||
|
||||
// spot angle attenuation
|
||||
half rho = max(dot(dirToLight, unity_SpotDirection[idx].xyz), 0.0);
|
||||
half spotAtt = (rho - unity_LightAtten[idx].x) * unity_LightAtten[idx].y;
|
||||
att *= saturate(spotAtt);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
att *= 0.5; // passed in light colors are 2x brighter than what used to be in FFP
|
||||
return min (computeLighting (idx, dirToLight, eyeNormal, diffuseColor, att), 1.0);
|
||||
}
|
||||
|
||||
int4 unity_VertexLightParams; // x: light count, y: zero, z: one (y/z needed by d3d9 vs loop instruction)
|
||||
|
||||
struct appdata {
|
||||
float3 pos : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
half4 color : COLOR;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
fixed4 color : COLOR0;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 pos : SV_POSITION;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
VertexOutput vert (appdata v) {
|
||||
VertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
half4 color = v.color;
|
||||
float3 eyePos = UnityObjectToViewPos(float4(v.pos, 1)).xyz; //mul(UNITY_MATRIX_MV, float4(v.pos,1)).xyz;
|
||||
half3 fixedNormal = half3(0,0,-1);
|
||||
half3 eyeNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, fixedNormal));
|
||||
//half3 eyeNormal = half3(0,0,1);
|
||||
|
||||
// Lights
|
||||
half3 lcolor = half4(0,0,0,1).rgb + color.rgb * glstate_lightmodel_ambient.rgb;
|
||||
for (int il = 0; il < LIGHT_LOOP_LIMIT; ++il) {
|
||||
lcolor += computeOneLight(il, eyePos, eyeNormal, color);
|
||||
}
|
||||
|
||||
color.rgb = lcolor.rgb;
|
||||
o.color = saturate(color);
|
||||
o.uv0 = v.uv0;
|
||||
o.pos = UnityObjectToClipPos(v.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag (VertexOutput i) : SV_Target {
|
||||
fixed4 tex = tex2D(_MainTex, i.uv0);
|
||||
ALPHA_CLIP(tex, i.color);
|
||||
|
||||
fixed4 col;
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
col.rgb = tex * i.color * tex.a;
|
||||
#else
|
||||
col.rgb = tex * i.color;
|
||||
#endif
|
||||
|
||||
col *= 2;
|
||||
col.a = tex.a * i.color.a;
|
||||
return col;
|
||||
}
|
||||
|
||||
#endif
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70c77c02aabd5e44f94aab48dd0be7b2
|
||||
timeCreated: 1564083752
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8c87a44b93daed4383ca2ca5dfb3c43
|
||||
folderAsset: yes
|
||||
timeCreated: 1573827942
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a7bd28c2cf2e41499693d9f8f9e2e1a
|
||||
folderAsset: yes
|
||||
timeCreated: 1573829102
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Additive"
|
||||
|
||||
Shader "Spine/Outline/Blend Modes/Skeleton PMA Additive" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Additive/NORMAL"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Additive/CASTER"
|
||||
}
|
||||
FallBack "Spine/Blend Modes/Skeleton PMA Additive"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0299ffae826705448b6c80ccc6a53b75
|
||||
timeCreated: 1573829476
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Multiply"
|
||||
|
||||
Shader "Spine/Outline/Blend Modes/Skeleton PMA Multiply" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend DstColor OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Multiply/NORMAL"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Multiply/CASTER"
|
||||
}
|
||||
FallBack "Spine/Blend Modes/Skeleton PMA Multiply"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b3566a937643b8498d1ec6df5880b77
|
||||
timeCreated: 1573829476
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Screen"
|
||||
|
||||
Shader "Spine/Outline/Blend Modes/Skeleton PMA Screen" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcColor
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Screen/NORMAL"
|
||||
|
||||
UsePass "Spine/Blend Modes/Skeleton PMA Screen/CASTER"
|
||||
}
|
||||
FallBack "Spine/Blend Modes/Skeleton PMA Screen"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e61a8d94e453ff641a7e39c4b11cac95
|
||||
timeCreated: 1573829476
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 329bda94bce571446a1a149b53ccf45c
|
||||
folderAsset: yes
|
||||
timeCreated: 1574096529
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
#ifndef SPINE_OUTLINE_PASS_INCLUDED
|
||||
#define SPINE_OUTLINE_PASS_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
#include "UnityUI.cginc"
|
||||
#endif
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
float _OutlineWidth;
|
||||
float4 _OutlineColor;
|
||||
float4 _MainTex_TexelSize;
|
||||
float _ThresholdEnd;
|
||||
float _OutlineSmoothness;
|
||||
float _OutlineMipLevel;
|
||||
int _OutlineReferenceTexWidth;
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
float4 _ClipRect;
|
||||
#endif
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float vertexColorAlpha : COLOR;
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
#endif
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
|
||||
VertexOutput vertOutlineGraphic(VertexInput v) {
|
||||
VertexOutput o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.worldPosition = v.vertex;
|
||||
o.pos = UnityObjectToClipPos(o.worldPosition);
|
||||
o.uv = v.uv;
|
||||
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
o.pos.xy += (_ScreenParams.zw - 1.0) * float2(-1, 1);
|
||||
#endif
|
||||
|
||||
o.vertexColorAlpha = v.vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
#else // !SKELETON_GRAPHIC
|
||||
|
||||
VertexOutput vertOutline(VertexInput v) {
|
||||
VertexOutput o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColorAlpha = v.vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
#endif
|
||||
|
||||
float4 fragOutline(VertexOutput i) : SV_Target {
|
||||
|
||||
float4 texColor = fixed4(0,0,0,0);
|
||||
|
||||
float outlineWidthCompensated = _OutlineWidth / (_OutlineReferenceTexWidth * _MainTex_TexelSize.x);
|
||||
float xOffset = _MainTex_TexelSize.x * outlineWidthCompensated;
|
||||
float yOffset = _MainTex_TexelSize.y * outlineWidthCompensated;
|
||||
float xOffsetDiagonal = _MainTex_TexelSize.x * outlineWidthCompensated * 0.7;
|
||||
float yOffsetDiagonal = _MainTex_TexelSize.y * outlineWidthCompensated * 0.7;
|
||||
|
||||
float pixelCenter = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
float4 uvCenterWithLod = float4(i.uv, 0, _OutlineMipLevel);
|
||||
float pixelTop = tex2Dlod(_MainTex, uvCenterWithLod + float4(0, yOffset, 0, 0)).a;
|
||||
float pixelBottom = tex2Dlod(_MainTex, uvCenterWithLod + float4(0, -yOffset, 0, 0)).a;
|
||||
float pixelLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffset, 0, 0, 0)).a;
|
||||
float pixelRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffset, 0, 0, 0)).a;
|
||||
#if _USE8NEIGHBOURHOOD_ON
|
||||
float numSamples = 8;
|
||||
float pixelTopLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelTopRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelBottomLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelBottomRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
|
||||
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight +
|
||||
pixelTopLeft + pixelTopRight + pixelBottomLeft + pixelBottomRight)
|
||||
* i.vertexColorAlpha / numSamples;
|
||||
#else // 4 neighbourhood
|
||||
float numSamples = 1;
|
||||
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight) * i.vertexColorAlpha / numSamples;
|
||||
#endif
|
||||
|
||||
float thresholdStart = _ThresholdEnd * (1.0 - _OutlineSmoothness);
|
||||
float outlineAlpha = saturate((average - thresholdStart) / (_ThresholdEnd - thresholdStart)) - pixelCenter;
|
||||
texColor.rgba = lerp(texColor, _OutlineColor, outlineAlpha);
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
return texColor;
|
||||
}
|
||||
|
||||
#endif // SPINE_OUTLINE_PASS_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ec781e799f97504c8a418e168759f70
|
||||
timeCreated: 1574096529
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e8ed065898e65f4d9303492725fb912
|
||||
folderAsset: yes
|
||||
timeCreated: 1573829873
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// Outline shader variant of "Spine/SkeletonGraphic"
|
||||
|
||||
Shader "Spine/Outline/SkeletonGraphic"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 0
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
[HideInInspector] _Stencil ("Stencil ID", Float) = 0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
[HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass {
|
||||
Name "Outline"
|
||||
CGPROGRAM
|
||||
#pragma vertex vertOutlineGraphic
|
||||
#pragma fragment fragOutline
|
||||
#define SKELETON_GRAPHIC
|
||||
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
|
||||
#include "../CGIncludes/Spine-Outline-Pass.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
UsePass "Spine/SkeletonGraphic/NORMAL"
|
||||
}
|
||||
FallBack "Spine/SkeletonGraphic"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f5d14d2a7fedb84998c50eb96c8b748
|
||||
timeCreated: 1573829873
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
// Outline shader variant of "Spine/SkeletonGraphic Tint Black"
|
||||
|
||||
Shader "Spine/Outline/SkeletonGraphic Tint Black"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 0
|
||||
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
[HideInInspector] _Stencil ("Stencil ID", Float) = 0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
[HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
UsePass "Spine/Outline/SkeletonGraphic/OUTLINE"
|
||||
|
||||
UsePass "Spine/SkeletonGraphic Tint Black/NORMAL"
|
||||
}
|
||||
FallBack "Spine/SkeletonGraphic Tint Black"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d55d64dd09c46af40a319933a62fa1b2
|
||||
timeCreated: 1573830121
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// Outline shader variant of "Spine/Skeleton Fill"
|
||||
|
||||
Shader "Spine/Outline/Skeleton Fill" {
|
||||
Properties {
|
||||
_FillColor ("FillColor", Color) = (1,1,1,1)
|
||||
_FillPhase ("FillPhase", Range(0, 1)) = 0
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Skeleton Fill/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton Fill/CASTER"
|
||||
}
|
||||
FallBack "Spine/Skeleton Fill"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e158cbe58baa093438feb3d691f3daba
|
||||
timeCreated: 1573817434
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// Outline shader variant of "Spine/Skeleton Lit"
|
||||
|
||||
Shader "Spine/Outline/Skeleton Lit" {
|
||||
Properties {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Skeleton Lit/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton Lit/CASTER"
|
||||
}
|
||||
FallBack "Spine/Skeleton Lit"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10fab3f69a099be4391fe8a1ad880c65
|
||||
timeCreated: 1573828963
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// Outline shader variant of "Spine/Skeleton Lit ZWrite"
|
||||
|
||||
Shader "Spine/Outline/Skeleton Lit ZWrite" {
|
||||
Properties {
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Skeleton Lit ZWrite/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton Lit ZWrite/CASTER"
|
||||
}
|
||||
FallBack "Spine/Skeleton Lit ZWrite"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 756be4f2f738f6c4583bb1c90e16bf0b
|
||||
timeCreated: 1573828964
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// Outline shader variant of "Spine/Skeleton"
|
||||
|
||||
Shader "Spine/Outline/Skeleton" {
|
||||
Properties {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Outline"
|
||||
CGPROGRAM
|
||||
#pragma vertex vertOutline
|
||||
#pragma fragment fragOutline
|
||||
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
|
||||
#include "CGIncludes/Spine-Outline-Pass.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
UsePass "Spine/Skeleton/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton/CASTER"
|
||||
}
|
||||
FallBack "Spine/Skeleton"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28b5cf4804845fe4b868531fd0bb81d5
|
||||
timeCreated: 1573817434
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Outline shader variant of "Spine/Skeleton Tint"
|
||||
|
||||
Shader "Spine/Outline/Skeleton Tint" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Skeleton Tint/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton Tint/CASTER"
|
||||
}
|
||||
FallBack "Spine/Skeleton Tint"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f1fdc166fed03649835949d3b79cba3
|
||||
timeCreated: 1573817434
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// Outline shader variant of "Spine/Skeleton Tint Black"
|
||||
|
||||
Shader "Spine/Outline/Skeleton Tint Black" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Skeleton Tint Black/NORMAL"
|
||||
|
||||
UsePass "Spine/Skeleton Tint Black/CASTER"
|
||||
}
|
||||
FallBack "Spine/Special/Skeleton Grayscale"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49cf725a1e40e7742be92917f83946c3
|
||||
timeCreated: 1573828963
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// Outline shader variant of "Spine/Special/Skeleton Grayscale"
|
||||
|
||||
Shader "Spine/Outline/Special/Skeleton Grayscale" {
|
||||
Properties {
|
||||
_GrayPhase ("Phase", Range(0, 1)) = 1
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Special/Skeleton Grayscale/NORMAL"
|
||||
|
||||
UsePass "Spine/Special/Skeleton Grayscale/CASTER"
|
||||
}
|
||||
FallBack "Spine/Special/Skeleton Grayscale"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d3e1518ae643a749b086bc7972893d2
|
||||
timeCreated: 1573828963
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 615182d5e489bf3478299e5bbf15dc23
|
||||
folderAsset: yes
|
||||
timeCreated: 1573830740
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
// Outline shader variant of "Spine/Sprite/Pixel Lit"
|
||||
|
||||
Shader "Spine/Outline/Sprite/Pixel Lit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
||||
|
||||
_EmissionColor("Color", Color) = (0,0,0,0)
|
||||
_EmissionMap("Emission", 2D) = "white" {}
|
||||
_EmissionPower("Emission Power", Float) = 2.0
|
||||
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
|
||||
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMap("Metallic", 2D) = "white" {}
|
||||
|
||||
_DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {}
|
||||
|
||||
_FixedNormal ("Fixed Normal", Vector) = (0,0,1,1)
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.5
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
_CustomRenderQueue ("Custom Render Queue", Float) = 0.0
|
||||
|
||||
_OverlayColor ("Overlay Color", Color) = (0,0,0,0)
|
||||
_Hue("Hue", Range(-0.5,0.5)) = 0.0
|
||||
_Saturation("Saturation", Range(0,2)) = 1.0
|
||||
_Brightness("Brightness", Range(0,2)) = 1.0
|
||||
|
||||
_RimPower("Rim Power", Float) = 2.0
|
||||
_RimColor ("Rim Color", Color) = (1,1,1,1)
|
||||
|
||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
|
||||
LOD 200
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Sprite/Pixel Lit/FORWARD"
|
||||
|
||||
UsePass "Spine/Sprite/Pixel Lit/FORWARD_DELTA"
|
||||
|
||||
UsePass "Spine/Sprite/Pixel Lit/SHADOWCASTER"
|
||||
}
|
||||
|
||||
FallBack "Spine/Sprite/Pixel Lit"
|
||||
CustomEditor "SpineSpriteShaderGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a27d4b27c8ecd9840a03558ccc5ad8a3
|
||||
timeCreated: 1573830741
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// Outline shader variant of "Spine/Sprite/Unlit"
|
||||
|
||||
Shader "Spine/Outline/Sprite/Unlit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
||||
|
||||
_ZWrite ("Depth Write", Float) = 0.0
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
_CustomRenderQueue ("Custom Render Queue", Float) = 0.0
|
||||
|
||||
_OverlayColor ("Overlay Color", Color) = (0,0,0,0)
|
||||
_Hue("Hue", Range(-0.5,0.5)) = 0.0
|
||||
_Saturation("Saturation", Range(0,2)) = 1.0
|
||||
_Brightness("Brightness", Range(0,2)) = 1.0
|
||||
|
||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Sprite/Unlit/NORMAL"
|
||||
|
||||
UsePass "Spine/Sprite/Unlit/SHADOWCASTER"
|
||||
}
|
||||
FallBack "Spine/Sprite/Unlit"
|
||||
CustomEditor "SpineSpriteShaderGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 276c07e3bdd5719458187a5823e9d96a
|
||||
timeCreated: 1573830740
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
// Outline shader variant of "Spine/Sprite/Vertex Lit"
|
||||
|
||||
Shader "Spine/Outline/Sprite/Vertex Lit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
||||
|
||||
_EmissionColor("Color", Color) = (0,0,0,0)
|
||||
_EmissionMap("Emission", 2D) = "white" {}
|
||||
_EmissionPower("Emission Power", Float) = 2.0
|
||||
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
|
||||
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMap("Metallic", 2D) = "white" {}
|
||||
|
||||
_DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {}
|
||||
|
||||
_FixedNormal ("Fixed Normal", Vector) = (0,0,1,1)
|
||||
_ZWrite ("Depth Write", Float) = 0.0
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
_CustomRenderQueue ("Custom Render Queue", Float) = 0.0
|
||||
|
||||
_OverlayColor ("Overlay Color", Color) = (0,0,0,0)
|
||||
_Hue("Hue", Range(-0.5,0.5)) = 0.0
|
||||
_Saturation("Saturation", Range(0,2)) = 1.0
|
||||
_Brightness("Brightness", Range(0,2)) = 1.0
|
||||
|
||||
_RimPower("Rim Power", Float) = 2.0
|
||||
_RimColor ("Rim Color", Color) = (1,1,1,1)
|
||||
|
||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
|
||||
LOD 150
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
UsePass "Spine/Outline/Skeleton/OUTLINE"
|
||||
|
||||
UsePass "Spine/Sprite/Vertex Lit/VERTEX"
|
||||
|
||||
UsePass "Spine/Sprite/Vertex Lit/SHADOWCASTER"
|
||||
}
|
||||
|
||||
FallBack "Spine/Sprite/Vertex Lit"
|
||||
CustomEditor "SpineSpriteShaderGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30ef5dd318033004588a6481c092416a
|
||||
timeCreated: 1573830740
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a42d52714848d64f8ff99dddb93500e
|
||||
folderAsset: yes
|
||||
timeCreated: 1563289150
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
// This is a premultiply-alpha adaptation of the built-in Unity shader "UI/Default" to allow Unity UI stencil masking.
|
||||
|
||||
Shader "Spine/SkeletonGraphic Tint Black"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 0
|
||||
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
[HideInInspector] _Stencil ("Stencil ID", Float) = 0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
[HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma shader_feature _ _CANVAS_GROUP_COMPATIBLE
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float4 worldPosition : TEXCOORD3;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _Black;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
|
||||
VertexOutput vert (VertexInput IN) {
|
||||
VertexOutput OUT;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
|
||||
OUT.worldPosition = IN.vertex;
|
||||
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
OUT.color = IN.color * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
OUT.uv1 = IN.uv1;
|
||||
OUT.uv2 = IN.uv2;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag (VertexOutput IN) : SV_Target
|
||||
{
|
||||
half4 texColor = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
texColor *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (texColor.a - 0.001);
|
||||
#endif
|
||||
|
||||
half4 color = (texColor * IN.color) + float4(((1-texColor.rgb) * (_Black.rgb + float3(IN.uv1.r, IN.uv1.g, IN.uv2.r)) * texColor.a * _Color.a * IN.color.a), 0);
|
||||
#ifdef _CANVAS_GROUP_COMPATIBLE
|
||||
// CanvasGroup alpha sets vertex color alpha, but does not premultiply it to rgb components.
|
||||
color.rgb *= IN.color.a;
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f64c7bc238bb2c246b8ca1912b2b6b9c
|
||||
timeCreated: 1455080068
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// This is a premultiply-alpha adaptation of the built-in Unity shader "UI/Default" in Unity 5.6.2 to allow Unity UI stencil masking.
|
||||
|
||||
Shader "Spine/SkeletonGraphic"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 0
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
[HideInInspector] _Stencil ("Stencil ID", Float) = 0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
[HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma shader_feature _ _CANVAS_GROUP_COMPATIBLE
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
|
||||
VertexOutput vert (VertexInput IN) {
|
||||
VertexOutput OUT;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
|
||||
OUT.worldPosition = IN.vertex;
|
||||
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0) * float2(-1,1);
|
||||
#endif
|
||||
|
||||
OUT.color = IN.color * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag (VertexOutput IN) : SV_Target
|
||||
{
|
||||
half4 texColor = tex2D(_MainTex, IN.texcoord);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
half4 color = (texColor + _TextureSampleAdd) * IN.color;
|
||||
#ifdef _CANVAS_GROUP_COMPATIBLE
|
||||
// CanvasGroup alpha sets vertex color alpha, but does not premultiply it to rgb components.
|
||||
color.rgb *= IN.color.a;
|
||||
#endif
|
||||
|
||||
color *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa95b0fb6983c0f40a152e6f9aa82bfb
|
||||
timeCreated: 1455080068
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,126 @@
|
||||
// - Unlit
|
||||
// - Premultiplied Alpha Blending (Optional straight alpha input)
|
||||
// - Double-sided, no depth
|
||||
|
||||
Shader "Spine/Skeleton Fill" {
|
||||
Properties {
|
||||
_FillColor ("FillColor", Color) = (1,1,1,1)
|
||||
_FillPhase ("FillPhase", Range(0, 1)) = 0
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
float4 _FillColor;
|
||||
float _FillPhase;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 rawColor = tex2D(_MainTex,i.uv);
|
||||
float finalAlpha = (rawColor.a * i.vertexColor.a);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
rawColor.rgb *= rawColor.a;
|
||||
#endif
|
||||
|
||||
float3 finalColor = lerp((rawColor.rgb * i.vertexColor.rgb), (_FillColor.rgb * finalAlpha), _FillPhase); // make sure to PMA _FillColor.
|
||||
return fixed4(finalColor, finalAlpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
fixed _Cutoff;
|
||||
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
VertexOutput o;
|
||||
o.uvAndAlpha = v.texcoord;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45495790b394f894a967dbf44489b57b
|
||||
timeCreated: 1492385797
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// - Vertex Lit + ShadowCaster
|
||||
// - Premultiplied Alpha Blending (Optional straight alpha input)
|
||||
// - Double-sided, ZWrite
|
||||
|
||||
Shader "Spine/Skeleton Lit ZWrite" {
|
||||
Properties {
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
Tags { "LightMode"="Vertex" "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
|
||||
ZWrite On
|
||||
Cull Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#define _ALPHA_CLIP
|
||||
#pragma multi_compile __ POINT SPOT
|
||||
#include "CGIncludes/Spine-Skeleton-Lit-Common.cginc"
|
||||
ENDCG
|
||||
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
Fog { Mode Off }
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertShadow
|
||||
#pragma fragment fragShadow
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
|
||||
#define SHADOW_CUTOFF _ShadowAlphaCutoff
|
||||
#include "CGIncludes/Spine-Skeleton-Lit-Common-Shadow.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fde05abf1f7be4b4da1caf8c8de1823a
|
||||
timeCreated: 1564082883
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
// - Vertex Lit + ShadowCaster
|
||||
// - Premultiplied Alpha Blending (Optional straight alpha input)
|
||||
// - Double-sided, no depth
|
||||
|
||||
Shader "Spine/Skeleton Lit" {
|
||||
Properties {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
Tags { "LightMode"="Vertex" "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile __ POINT SPOT
|
||||
#include "CGIncludes/Spine-Skeleton-Lit-Common.cginc"
|
||||
ENDCG
|
||||
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
Fog { Mode Off }
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertShadow
|
||||
#pragma fragment fragShadow
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
|
||||
#define SHADOW_CUTOFF _Cutoff
|
||||
#include "CGIncludes/Spine-Skeleton-Lit-Common-Shadow.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd83c75f51f5e23498ae22ffcdfe92c3
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,128 @@
|
||||
// Spine/Skeleton Tint
|
||||
// - Two color tint
|
||||
// - unlit
|
||||
// - Premultiplied alpha blending (Optional straight alpha input)
|
||||
// - No depth, no backface culling, no fog.
|
||||
|
||||
Shader "Spine/Skeleton Tint" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
float4 _Color;
|
||||
float4 _Black;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * _Black.rgb * texColor.a*_Color.a*i.vertexColor.a), 0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
fixed _Cutoff;
|
||||
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
VertexOutput o;
|
||||
o.uvAndAlpha = v.texcoord;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 522f03282fd79be47b306e2ef4b593fd
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
// Spine/Skeleton Tint Black
|
||||
// - Two color tint
|
||||
// - UV2 and UV3 as Black Tint color.
|
||||
// - Final black tint is (UV black data and _Black/"Black Point")
|
||||
// - unlit
|
||||
// - Premultiplied alpha blending (optional straight alpha input)
|
||||
// - No depth, no backface culling, no fog.
|
||||
|
||||
Shader "Spine/Skeleton Tint Black" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
float4 _Color;
|
||||
float4 _Black;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex); // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
||||
o.uv1 = v.uv1;
|
||||
o.uv2 = v.uv2;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * (_Black.rgb + float3(i.uv1.r, i.uv1.g, i.uv2.r)) * texColor.a*_Color.a*i.vertexColor.a), 0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
fixed _Cutoff;
|
||||
|
||||
struct v2f {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
v2f o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.uvAndAlpha = v.texcoord;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deee23ab4aa38564ead2ac05e112c169
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,118 @@
|
||||
Shader "Spine/Skeleton" {
|
||||
Properties {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
return (texColor * i.vertexColor);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
fixed _Cutoff;
|
||||
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
VertexOutput o;
|
||||
o.uvAndAlpha = v.texcoord;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e8a610c9e01c3648bac42585e5fc676
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
// - Unlit
|
||||
// - Premultiplied Alpha Blending (Optional straight alpha input)
|
||||
// - Double-sided, no depth
|
||||
|
||||
Shader "Spine/Special/Skeleton Grayscale" {
|
||||
Properties {
|
||||
_GrayPhase ("Phase", Range(0, 1)) = 1
|
||||
[NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Lighting Off
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Normal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
float _GrayPhase;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
o.uv = v.uv;
|
||||
o.vertexColor = v.vertexColor;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
float4 rawColor = tex2D(_MainTex,i.uv);
|
||||
float finalAlpha = (rawColor.a * i.vertexColor.a);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
rawColor.rgb *= rawColor.a;
|
||||
#endif
|
||||
|
||||
rawColor.rgb *= i.vertexColor.rgb;
|
||||
|
||||
float3 finalColor = lerp(rawColor.rgb, dot(rawColor.rgb, float3(0.3, 0.59, 0.11)), _GrayPhase);
|
||||
return fixed4(finalColor, finalAlpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Caster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
Fog { Mode Off }
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
fixed _Cutoff;
|
||||
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 uvAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) {
|
||||
VertexOutput o;
|
||||
o.uvAndAlpha = v.texcoord;
|
||||
o.uvAndAlpha.a = vertexColor.a;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : SV_Target {
|
||||
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
|
||||
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea7e7c05f36541b4bb280f98ebda8ba1
|
||||
timeCreated: 1492385797
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a831a8ed72a588a48b2fb892e7f37371
|
||||
folderAsset: yes
|
||||
timeCreated: 1479419399
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b6fb48f295cd8248a7566315212a3c2
|
||||
folderAsset: yes
|
||||
timeCreated: 1494092464
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#ifndef SHADER_MATHS_INCLUDED
|
||||
#define SHADER_MATHS_INCLUDED
|
||||
|
||||
#if defined(USE_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(USE_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Maths functions
|
||||
//
|
||||
|
||||
inline half3 safeNormalize(half3 inVec)
|
||||
{
|
||||
half dp3 = max(0.001f, dot(inVec, inVec));
|
||||
return inVec * rsqrt(dp3);
|
||||
}
|
||||
|
||||
inline float dotClamped(float3 a, float3 b)
|
||||
{
|
||||
#if (SHADER_TARGET < 30 || defined(SHADER_API_PS3))
|
||||
return saturate(dot(a, b));
|
||||
#else
|
||||
return max(0.0h, dot(a, b));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float oneDividedBy(float value)
|
||||
{
|
||||
//Catches NANs
|
||||
float sign_value = sign(value);
|
||||
float sign_value_squared = sign_value*sign_value;
|
||||
return sign_value_squared / ( value + sign_value_squared - 1.0);
|
||||
}
|
||||
|
||||
inline half pow5 (half x)
|
||||
{
|
||||
return x*x*x*x*x;
|
||||
}
|
||||
|
||||
inline float4 quat_from_axis_angle(float3 axis, float angleRadians)
|
||||
{
|
||||
float4 qr;
|
||||
float half_angle = (angleRadians * 0.5);
|
||||
qr.x = axis.x * sin(half_angle);
|
||||
qr.y = axis.y * sin(half_angle);
|
||||
qr.z = axis.z * sin(half_angle);
|
||||
qr.w = cos(half_angle);
|
||||
return qr;
|
||||
}
|
||||
|
||||
inline float3 rotate_vertex_position(float3 position, float3 axis, float angleRadians)
|
||||
{
|
||||
float4 q = quat_from_axis_angle(axis, angleRadians);
|
||||
float3 v = position.xyz;
|
||||
return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);
|
||||
}
|
||||
|
||||
float3 EncodeFloatRGB(float value)
|
||||
{
|
||||
const float max24int = 256*256*256-1;
|
||||
float3 decomp = floor( value * float3( max24int/(256*256), max24int/256, max24int ) ) / 255.0;
|
||||
decomp.z -= decomp.y * 256.0;
|
||||
decomp.y -= decomp.x * 256.0;
|
||||
return decomp;
|
||||
}
|
||||
|
||||
float DecodeFloatRGB(float3 decomp)
|
||||
{
|
||||
return dot( decomp.xyz, float3( 255.0/256, 255.0/(256*256), 255.0/(256*256*256) ) );
|
||||
}
|
||||
|
||||
#endif // SHADER_MATHS_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1de23de2025abe4a84ff2edd3f24491
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+423
@@ -0,0 +1,423 @@
|
||||
// Upgrade NOTE: upgraded instancing buffer 'PerDrawSprite' to new syntax.
|
||||
|
||||
// Upgrade NOTE: upgraded instancing buffer 'PerDrawSprite' to new syntax.
|
||||
|
||||
#ifndef SHADER_SHARED_INCLUDED
|
||||
#define SHADER_SHARED_INCLUDED
|
||||
|
||||
#if defined(USE_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(USE_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_INSTANCING_ENABLED
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(PerDrawSprite)
|
||||
// SpriteRenderer.Color while Non-Batched/Instanced.
|
||||
fixed4 unity_SpriteRendererColorArray[UNITY_INSTANCED_ARRAY_SIZE];
|
||||
// this could be smaller but that's how bit each entry is regardless of type
|
||||
float4 unity_SpriteFlipArray[UNITY_INSTANCED_ARRAY_SIZE];
|
||||
UNITY_INSTANCING_BUFFER_END(PerDrawSprite)
|
||||
|
||||
#define _RendererColor unity_SpriteRendererColorArray[unity_InstanceID]
|
||||
#define _Flip unity_SpriteFlipArray[unity_InstanceID]
|
||||
|
||||
#endif // instancing
|
||||
|
||||
CBUFFER_START(UnityPerDrawSprite)
|
||||
#ifndef UNITY_INSTANCING_ENABLED
|
||||
fixed4 _RendererColor;
|
||||
float4 _Flip;
|
||||
#endif
|
||||
float _EnableExternalAlpha;
|
||||
CBUFFER_END
|
||||
|
||||
////////////////////////////////////////
|
||||
// Space functions
|
||||
//
|
||||
|
||||
inline float4 calculateWorldPos(float4 vertex)
|
||||
{
|
||||
return mul(unity_ObjectToWorld, vertex);
|
||||
}
|
||||
|
||||
#if defined(USE_LWRP) || defined(USE_URP)
|
||||
// snaps post-transformed position to screen pixels
|
||||
inline float4 UnityPixelSnap(float4 pos)
|
||||
{
|
||||
float2 hpc = _ScreenParams.xy * 0.5f;
|
||||
#if SHADER_API_PSSL
|
||||
// sdk 4.5 splits round into v_floor_f32(x+0.5) ... sdk 5.0 uses v_rndne_f32, for compatabilty we use the 4.5 version
|
||||
float2 temp = ((pos.xy / pos.w) * hpc) + float2(0.5f, 0.5f);
|
||||
float2 pixelPos = float2(__v_floor_f32(temp.x), __v_floor_f32(temp.y));
|
||||
#else
|
||||
float2 pixelPos = round((pos.xy / pos.w) * hpc);
|
||||
#endif
|
||||
pos.xy = pixelPos / hpc * pos.w;
|
||||
return pos;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline float4 calculateLocalPos(float4 vertex)
|
||||
{
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
#ifdef UNITY_INSTANCING_ENABLED
|
||||
vertex.xy *= _Flip.xy;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LWRP) || defined(USE_URP)
|
||||
float4 pos = TransformObjectToHClip(vertex.xyz);
|
||||
#else
|
||||
float4 pos = UnityObjectToClipPos(vertex);
|
||||
#endif
|
||||
|
||||
#ifdef PIXELSNAP_ON
|
||||
pos = UnityPixelSnap(pos);
|
||||
#endif
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
inline half3 calculateWorldNormal(float3 normal)
|
||||
{
|
||||
#if defined(USE_LWRP) || defined(USE_URP)
|
||||
return TransformObjectToWorldNormal(normal);
|
||||
#else
|
||||
return UnityObjectToWorldNormal(normal);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Normal map functions
|
||||
//
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
|
||||
uniform sampler2D _BumpMap;
|
||||
uniform half _BumpScale;
|
||||
|
||||
half3 UnpackScaleNormal(half4 packednormal, half bumpScale)
|
||||
{
|
||||
#if defined(UNITY_NO_DXT5nm)
|
||||
return packednormal.xyz * 2 - 1;
|
||||
#else
|
||||
half3 normal;
|
||||
normal.xy = (packednormal.wy * 2 - 1);
|
||||
// Note: we allow scaled normals in LWRP since we might be using fewer instructions.
|
||||
#if (SHADER_TARGET >= 30) || defined(USE_LWRP) || defined(USE_URP)
|
||||
// SM2.0: instruction count limitation
|
||||
// SM2.0: normal scaler is not supported
|
||||
normal.xy *= bumpScale;
|
||||
#endif
|
||||
normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
|
||||
return normal;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline half3 calculateWorldTangent(float4 tangent)
|
||||
{
|
||||
#if defined(USE_LWRP) || defined(USE_URP)
|
||||
return TransformObjectToWorldDir(tangent.xyz);
|
||||
#else
|
||||
return UnityObjectToWorldDir(tangent);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half3 calculateWorldBinormal(half3 normalWorld, half3 tangentWorld, float tangentSign)
|
||||
{
|
||||
//When calculating the binormal we have to flip it when the mesh is scaled negatively.
|
||||
//Normally this would just be unity_WorldTransformParams.w but this isn't set correctly by Unity for its SpriteRenderer meshes so get from objectToWorld matrix scale instead.
|
||||
half worldTransformSign = sign(unity_ObjectToWorld[0][0] * unity_ObjectToWorld[1][1] * unity_ObjectToWorld[2][2]);
|
||||
half sign = tangentSign * worldTransformSign;
|
||||
return cross(normalWorld, tangentWorld) * sign;
|
||||
}
|
||||
|
||||
inline half3 calculateNormalFromBumpMap(float2 texUV, half3 tangentWorld, half3 binormalWorld, half3 normalWorld)
|
||||
{
|
||||
half3 localNormal = UnpackScaleNormal(tex2D(_BumpMap, texUV), _BumpScale);
|
||||
half3x3 rotation = half3x3(tangentWorld, binormalWorld, normalWorld);
|
||||
half3 normal = normalize(mul(localNormal, rotation));
|
||||
return normal;
|
||||
}
|
||||
|
||||
#endif // _NORMALMAP
|
||||
|
||||
////////////////////////////////////////
|
||||
// Blending functions
|
||||
//
|
||||
|
||||
inline fixed4 prepareLitPixelForOutput(fixed4 finalPixel, fixed4 color) : SV_Target
|
||||
{
|
||||
#if defined(_ALPHABLEND_ON)
|
||||
//Normal Alpha
|
||||
finalPixel.rgb *= finalPixel.a;
|
||||
#elif defined(_ALPHAPREMULTIPLY_ON)
|
||||
//Pre multiplied alpha
|
||||
finalPixel.rgb *= color.a;
|
||||
#elif defined(_MULTIPLYBLEND)
|
||||
//Multiply
|
||||
finalPixel = lerp(fixed4(1,1,1,1), finalPixel, finalPixel.a);
|
||||
#elif defined(_MULTIPLYBLEND_X2)
|
||||
//Multiply x2
|
||||
finalPixel.rgb *= 2.0f;
|
||||
finalPixel = lerp(fixed4(0.5f,0.5f,0.5f,0.5f), finalPixel, finalPixel.a);
|
||||
#elif defined(_ADDITIVEBLEND)
|
||||
//Additive
|
||||
finalPixel *= 2.0f;
|
||||
finalPixel.rgb *= color.a;
|
||||
#elif defined(_ADDITIVEBLEND_SOFT)
|
||||
//Additive soft
|
||||
finalPixel.rgb *= finalPixel.a;
|
||||
#else
|
||||
//Opaque
|
||||
finalPixel.a = 1;
|
||||
#endif
|
||||
return finalPixel;
|
||||
}
|
||||
|
||||
inline fixed4 calculateLitPixel(fixed4 texureColor, fixed4 color, fixed3 lighting) : SV_Target
|
||||
{
|
||||
fixed4 finalPixel = texureColor * color * fixed4(lighting, 1);
|
||||
finalPixel = prepareLitPixelForOutput(finalPixel, color);
|
||||
return finalPixel;
|
||||
}
|
||||
|
||||
inline fixed4 calculateLitPixel(fixed4 texureColor, fixed3 lighting) : SV_Target
|
||||
{
|
||||
// note: we let the optimizer work, removed duplicate code.
|
||||
return calculateLitPixel(texureColor, fixed4(1, 1, 1, 1), lighting);
|
||||
}
|
||||
|
||||
inline fixed4 calculateAdditiveLitPixel(fixed4 texureColor, fixed4 color, fixed3 lighting) : SV_Target
|
||||
{
|
||||
fixed4 finalPixel;
|
||||
|
||||
#if defined(_ALPHABLEND_ON) || defined(_MULTIPLYBLEND) || defined(_MULTIPLYBLEND_X2) || defined(_ADDITIVEBLEND) || defined(_ADDITIVEBLEND_SOFT)
|
||||
//Normal Alpha, Additive and Multiply modes
|
||||
finalPixel.rgb = (texureColor.rgb * lighting * color.rgb) * (texureColor.a * color.a);
|
||||
finalPixel.a = 1.0;
|
||||
#elif defined(_ALPHAPREMULTIPLY_ON)
|
||||
//Pre multiplied alpha
|
||||
finalPixel.rgb = texureColor.rgb * lighting * color.rgb * color.a;
|
||||
finalPixel.a = 1.0;
|
||||
#else
|
||||
//Opaque
|
||||
finalPixel.rgb = texureColor.rgb * lighting * color.rgb;
|
||||
finalPixel.a = 1.0;
|
||||
#endif
|
||||
|
||||
return finalPixel;
|
||||
}
|
||||
|
||||
inline fixed4 calculateAdditiveLitPixel(fixed4 texureColor, fixed3 lighting) : SV_Target
|
||||
{
|
||||
fixed4 finalPixel;
|
||||
|
||||
#if defined(_ALPHABLEND_ON) || defined(_MULTIPLYBLEND) || defined(_MULTIPLYBLEND_X2) || defined(_ADDITIVEBLEND) || defined(_ADDITIVEBLEND_SOFT)
|
||||
//Normal Alpha, Additive and Multiply modes
|
||||
finalPixel.rgb = (texureColor.rgb * lighting) * texureColor.a;
|
||||
finalPixel.a = 1.0;
|
||||
#else
|
||||
//Pre multiplied alpha and Opaque
|
||||
finalPixel.rgb = texureColor.rgb * lighting;
|
||||
finalPixel.a = 1.0;
|
||||
#endif
|
||||
|
||||
return finalPixel;
|
||||
}
|
||||
|
||||
inline fixed4 calculatePixel(fixed4 texureColor, fixed4 color) : SV_Target
|
||||
{
|
||||
// note: we let the optimizer work, removed duplicate code.
|
||||
return calculateLitPixel(texureColor, color, fixed3(1, 1, 1));
|
||||
}
|
||||
|
||||
inline fixed4 calculatePixel(fixed4 texureColor) : SV_Target
|
||||
{
|
||||
// note: we let the optimizer work, removed duplicate code.
|
||||
return calculateLitPixel(texureColor, fixed4(1, 1, 1, 1), fixed3(1, 1, 1));
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Alpha Clipping
|
||||
//
|
||||
|
||||
#if defined(_ALPHA_CLIP)
|
||||
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
#define ALPHA_CLIP(pixel, color) clip((pixel.a * color.a) - _Cutoff);
|
||||
|
||||
#else
|
||||
|
||||
#define ALPHA_CLIP(pixel, color)
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Color functions
|
||||
//
|
||||
|
||||
uniform fixed4 _Color;
|
||||
|
||||
inline fixed4 calculateVertexColor(fixed4 color)
|
||||
{
|
||||
return color * _Color;
|
||||
}
|
||||
|
||||
#if defined(_COLOR_ADJUST)
|
||||
|
||||
uniform float _Hue;
|
||||
uniform float _Saturation;
|
||||
uniform float _Brightness;
|
||||
uniform fixed4 _OverlayColor;
|
||||
|
||||
float3 rgb2hsv(float3 c)
|
||||
{
|
||||
float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
|
||||
float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
float3 hsv2rgb(float3 c)
|
||||
{
|
||||
c = float3(c.x, clamp(c.yz, 0.0, 1.0));
|
||||
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
inline fixed4 adjustColor(fixed4 color)
|
||||
{
|
||||
float3 hsv = rgb2hsv(color.rgb);
|
||||
|
||||
hsv.x += _Hue;
|
||||
hsv.y *= _Saturation;
|
||||
hsv.z *= _Brightness;
|
||||
|
||||
color.rgb = hsv2rgb(hsv);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
#define COLORISE(pixel) pixel.rgb = lerp(pixel.rgb, _OverlayColor.rgb, _OverlayColor.a * pixel.a);
|
||||
#define COLORISE_ADDITIVE(pixel) pixel.rgb = ((1.0-_OverlayColor.a) * pixel.rgb);
|
||||
|
||||
#else // !_COLOR_ADJUST
|
||||
|
||||
#define COLORISE(pixel)
|
||||
#define COLORISE_ADDITIVE(pixel)
|
||||
|
||||
#endif // !_COLOR_ADJUST
|
||||
|
||||
////////////////////////////////////////
|
||||
// Fog
|
||||
//
|
||||
|
||||
#if defined(_FOG) && (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2))
|
||||
|
||||
inline fixed4 applyFog(fixed4 pixel, float fogCoordOrFactorAtLWRP)
|
||||
{
|
||||
#if defined(_ADDITIVEBLEND) || defined(_ADDITIVEBLEND_SOFT)
|
||||
//In additive mode blend from clear to black based on luminance
|
||||
float luminance = pixel.r * 0.3 + pixel.g * 0.59 + pixel.b * 0.11;
|
||||
fixed4 fogColor = lerp(fixed4(0,0,0,0), fixed4(0,0,0,1), luminance);
|
||||
#elif defined(_MULTIPLYBLEND)
|
||||
//In multiplied mode fade to white based on inverse luminance
|
||||
float luminance = pixel.r * 0.3 + pixel.g * 0.59 + pixel.b * 0.11;
|
||||
fixed4 fogColor = lerp(fixed4(1,1,1,1), fixed4(0,0,0,0), luminance);
|
||||
#elif defined(_MULTIPLYBLEND_X2)
|
||||
//In multipliedx2 mode fade to grey based on inverse luminance
|
||||
float luminance = pixel.r * 0.3 + pixel.g * 0.59 + pixel.b * 0.11;
|
||||
fixed4 fogColor = lerp(fixed4(0.5f,0.5f,0.5f,0.5f), fixed4(0,0,0,0), luminance);
|
||||
#elif defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)
|
||||
//In alpha blended modes blend to fog color based on pixel alpha
|
||||
fixed4 fogColor = lerp(fixed4(0,0,0,0), unity_FogColor, pixel.a);
|
||||
#else
|
||||
//In opaque mode just return fog color;
|
||||
fixed4 fogColor = unity_FogColor;
|
||||
#endif
|
||||
|
||||
#if defined(USE_LWRP) || defined(USE_URP)
|
||||
pixel.rgb = MixFogColor(pixel.rgb, fogColor.rgb, fogCoordOrFactorAtLWRP);
|
||||
#else
|
||||
UNITY_APPLY_FOG_COLOR(fogCoordOrFactorAtLWRP, pixel, fogColor);
|
||||
#endif
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
#define APPLY_FOG(pixel, input) pixel = applyFog(pixel, input.fogCoord);
|
||||
#define APPLY_FOG_LWRP(pixel, fogFactor) pixel = applyFog(pixel, fogFactor);
|
||||
|
||||
#define APPLY_FOG_ADDITIVE(pixel, input) \
|
||||
UNITY_APPLY_FOG_COLOR(input.fogCoord, pixel.rgb, fixed4(0,0,0,0)); // fog towards black in additive pass
|
||||
|
||||
#else
|
||||
|
||||
#define APPLY_FOG(pixel, input)
|
||||
#define APPLY_FOG_LWRP(pixel, fogFactor)
|
||||
#define APPLY_FOG_ADDITIVE(pixel, input)
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Texture functions
|
||||
//
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
|
||||
#if ETC1_EXTERNAL_ALPHA
|
||||
//External alpha texture for ETC1 compression
|
||||
uniform sampler2D _AlphaTex;
|
||||
#endif //ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#if _TEXTURE_BLEND
|
||||
uniform sampler2D _BlendTex;
|
||||
uniform float _BlendAmount;
|
||||
|
||||
inline fixed4 calculateBlendedTexturePixel(float2 texcoord)
|
||||
{
|
||||
return (1.0-_BlendAmount) * tex2D(_MainTex, texcoord) + _BlendAmount * tex2D(_BlendTex, texcoord);
|
||||
}
|
||||
#endif // _TEXTURE_BLEND
|
||||
|
||||
inline fixed4 calculateTexturePixel(float2 texcoord)
|
||||
{
|
||||
fixed4 pixel;
|
||||
|
||||
#if _TEXTURE_BLEND
|
||||
pixel = calculateBlendedTexturePixel(texcoord);
|
||||
#else
|
||||
pixel = tex2D(_MainTex, texcoord);
|
||||
#endif // !_TEXTURE_BLEND
|
||||
|
||||
#if ETC1_EXTERNAL_ALPHA
|
||||
fixed4 alpha = tex2D (_AlphaTex, texcoord);
|
||||
pixel.a = lerp (pixel.a, alpha.r, _EnableExternalAlpha);
|
||||
#endif
|
||||
|
||||
#if defined(_COLOR_ADJUST)
|
||||
pixel = adjustColor(pixel);
|
||||
#endif // _COLOR_ADJUST
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
uniform fixed4 _MainTex_ST;
|
||||
|
||||
inline float2 calculateTextureCoord(float4 texcoord)
|
||||
{
|
||||
return TRANSFORM_TEX(texcoord, _MainTex);
|
||||
}
|
||||
|
||||
#endif // SHADER_SHARED_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c18c5cab567666f4d8c5b2bd4e61390b
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
#ifndef SPRITE_LIGHTING_INCLUDED
|
||||
#define SPRITE_LIGHTING_INCLUDED
|
||||
|
||||
//Check for using mesh normals
|
||||
#if !defined(_FIXED_NORMALS_VIEWSPACE) && !defined(_FIXED_NORMALS_VIEWSPACE_BACKFACE) && !defined(_FIXED_NORMALS_MODELSPACE) && !defined(_FIXED_NORMALS_MODELSPACE_BACKFACE)
|
||||
#define MESH_NORMALS
|
||||
#endif
|
||||
|
||||
//Check for fixing backfacing tangents
|
||||
#if defined(_FIXED_NORMALS_VIEWSPACE_BACKFACE) || defined(_FIXED_NORMALS_MODELSPACE_BACKFACE)
|
||||
#define FIXED_NORMALS_BACKFACE_RENDERING
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex structs
|
||||
//
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
#if defined(MESH_NORMALS)
|
||||
float3 normal : NORMAL;
|
||||
#endif // _FIXED_NORMALS
|
||||
#if defined(_NORMALMAP)
|
||||
float4 tangent : TANGENT;
|
||||
#endif // _NORMALMAP
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Normal functions
|
||||
//
|
||||
|
||||
uniform float4 _FixedNormal = float4(0, 0, 1, 1);
|
||||
|
||||
inline float3 getFixedNormal()
|
||||
{
|
||||
return _FixedNormal.xyz;
|
||||
}
|
||||
|
||||
inline float calculateBackfacingSign(float3 worldPos)
|
||||
{
|
||||
//If we're using fixed normals and mesh is facing away from camera, flip tangentSign
|
||||
//Unity uses a left handed coordinate system so camera always looks down the negative z axis
|
||||
float3 cameraForward = float3(0,0,-1);
|
||||
float3 meshWorldForward = mul((float3x3)unity_ObjectToWorld, cameraForward);
|
||||
float3 toCamera = _WorldSpaceCameraPos - worldPos;
|
||||
return sign(dot(toCamera, meshWorldForward));
|
||||
}
|
||||
|
||||
inline half3 calculateSpriteWorldNormal(VertexInput vertex, float backFaceSign)
|
||||
{
|
||||
#if defined(MESH_NORMALS)
|
||||
|
||||
return calculateWorldNormal(vertex.normal);
|
||||
|
||||
#else // !MESH_NORMALS
|
||||
|
||||
float3 normal = getFixedNormal();
|
||||
|
||||
#if defined(_FIXED_NORMALS_VIEWSPACE) || defined(_FIXED_NORMALS_VIEWSPACE_BACKFACE)
|
||||
//View space fixed normal
|
||||
//Rotate fixed normal by inverse view matrix to convert the fixed normal into world space
|
||||
float3x3 invView = transpose((float3x3)UNITY_MATRIX_V);
|
||||
return normalize(mul(invView, normal));
|
||||
#else
|
||||
//Model space fixed normal.
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
//If back face rendering is enabled and the sprite is facing away from the camera (ie we're rendering the backface) then need to flip the normal
|
||||
normal *= backFaceSign;
|
||||
#endif
|
||||
return calculateWorldNormal(normal);
|
||||
#endif
|
||||
|
||||
#endif // !MESH_NORMALS
|
||||
}
|
||||
|
||||
inline half3 calculateSpriteViewNormal(VertexInput vertex, float backFaceSign)
|
||||
{
|
||||
#if defined(MESH_NORMALS)
|
||||
|
||||
return normalize(mul((float3x3)UNITY_MATRIX_IT_MV, vertex.normal));
|
||||
|
||||
#else // !MESH_NORMALS
|
||||
|
||||
float3 normal = getFixedNormal();
|
||||
|
||||
#if defined(_FIXED_NORMALS_VIEWSPACE) || defined(_FIXED_NORMALS_VIEWSPACE_BACKFACE)
|
||||
//View space fixed normal
|
||||
return normal;
|
||||
#else
|
||||
//Model space fixed normal
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
//If back face rendering is enabled and the sprite is facing away from the camera (ie we're rendering the backface) then need to flip the normal
|
||||
normal *= backFaceSign;
|
||||
#endif
|
||||
return normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
#endif
|
||||
|
||||
#endif // !MESH_NORMALS
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Normal map functions
|
||||
//
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
|
||||
inline half3 calculateSpriteWorldBinormal(VertexInput vertex, half3 normalWorld, half3 tangentWorld, float backFaceSign)
|
||||
{
|
||||
float tangentSign = vertex.tangent.w;
|
||||
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
tangentSign *= backFaceSign;
|
||||
#endif
|
||||
|
||||
return calculateWorldBinormal(normalWorld, tangentWorld, tangentSign);
|
||||
}
|
||||
|
||||
#endif // _NORMALMAP
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// Diffuse ramp functions
|
||||
//
|
||||
|
||||
//Disable for softer, more traditional diffuse ramping
|
||||
#define HARD_DIFFUSE_RAMP
|
||||
|
||||
uniform sampler2D _DiffuseRamp;
|
||||
|
||||
inline fixed3 calculateDiffuseRamp(float ramp)
|
||||
{
|
||||
return tex2D(_DiffuseRamp, float2(ramp, ramp)).rgb;
|
||||
}
|
||||
|
||||
inline fixed3 calculateRampedDiffuse(fixed3 lightColor, float attenuation, float angleDot)
|
||||
{
|
||||
float d = angleDot * 0.5 + 0.5;
|
||||
#if defined(HARD_DIFFUSE_RAMP)
|
||||
half3 ramp = calculateDiffuseRamp(d * attenuation * 2);
|
||||
return lightColor * ramp;
|
||||
#else
|
||||
half3 ramp = calculateDiffuseRamp(d);
|
||||
return lightColor * ramp * (attenuation * 2);
|
||||
#endif
|
||||
}
|
||||
#endif // _DIFFUSE_RAMP
|
||||
|
||||
////////////////////////////////////////
|
||||
// Rim Lighting functions
|
||||
//
|
||||
|
||||
#ifdef _RIM_LIGHTING
|
||||
|
||||
uniform float _RimPower;
|
||||
uniform fixed4 _RimColor;
|
||||
|
||||
inline fixed3 applyRimLighting(fixed3 posWorld, fixed3 normalWorld, fixed4 pixel) : SV_Target
|
||||
{
|
||||
fixed3 viewDir = normalize(_WorldSpaceCameraPos - posWorld);
|
||||
float invDot = 1.0 - saturate(dot(normalWorld, viewDir));
|
||||
float rimPower = pow(invDot, _RimPower);
|
||||
float rim = saturate(rimPower * _RimColor.a);
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
rim = calculateDiffuseRamp(rim).r;
|
||||
#endif
|
||||
|
||||
return lerp(pixel.rgb, _RimColor.xyz * pixel.a, rim);
|
||||
}
|
||||
|
||||
#endif //_RIM_LIGHTING
|
||||
|
||||
////////////////////////////////////////
|
||||
// Emission functions
|
||||
//
|
||||
|
||||
#ifdef _EMISSION
|
||||
|
||||
uniform sampler2D _EmissionMap;
|
||||
uniform fixed4 _EmissionColor;
|
||||
uniform float _EmissionPower;
|
||||
|
||||
|
||||
#define APPLY_EMISSION(diffuse, uv) diffuse += tex2D(_EmissionMap, uv).rgb * _EmissionColor.rgb * _EmissionPower;
|
||||
#define APPLY_EMISSION_SPECULAR(pixel, uv) pixel.rgb += (tex2D(_EmissionMap, uv).rgb * _EmissionColor.rgb * _EmissionPower) * pixel.a;
|
||||
|
||||
#else //!_EMISSION
|
||||
|
||||
#define APPLY_EMISSION(diffuse, uv)
|
||||
#define APPLY_EMISSION_SPECULAR(pixel, uv)
|
||||
|
||||
#endif //!_EMISSION
|
||||
|
||||
#endif // SPRITE_LIGHTING_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cfb891658099ca4bb0c9544c08e60f9
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
#ifndef SPRITE_PIXEL_LIGHTING_INCLUDED
|
||||
#define SPRITE_PIXEL_LIGHTING_INCLUDED
|
||||
|
||||
#include "ShaderShared.cginc"
|
||||
#include "SpriteLighting.cginc"
|
||||
#include "SpriteSpecular.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Defines
|
||||
//
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex output struct
|
||||
//
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
#define _VERTEX_LIGHTING_INDEX TEXCOORD5
|
||||
#define _LIGHT_COORD_INDEX_0 6
|
||||
#define _LIGHT_COORD_INDEX_1 7
|
||||
#define _FOG_COORD_INDEX 8
|
||||
#else
|
||||
#define _VERTEX_LIGHTING_INDEX TEXCOORD3
|
||||
#define _LIGHT_COORD_INDEX_0 4
|
||||
#define _LIGHT_COORD_INDEX_1 5
|
||||
#define _FOG_COORD_INDEX 6
|
||||
#endif // _NORMALMAP
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
half3 normalWorld : TEXCOORD2;
|
||||
#if defined(_NORMALMAP)
|
||||
half3 tangentWorld : TEXCOORD3;
|
||||
half3 binormalWorld : TEXCOORD4;
|
||||
#endif // _NORMALMAP
|
||||
fixed3 vertexLighting : _VERTEX_LIGHTING_INDEX;
|
||||
LIGHTING_COORDS(_LIGHT_COORD_INDEX_0, _LIGHT_COORD_INDEX_1)
|
||||
#if defined(_FOG)
|
||||
UNITY_FOG_COORDS(_FOG_COORD_INDEX)
|
||||
#endif // _FOG
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Light calculations
|
||||
//
|
||||
|
||||
uniform fixed4 _LightColor0;
|
||||
|
||||
inline fixed3 calculateLightDiffuse(VertexOutput input, float3 normalWorld, inout fixed4 albedo)
|
||||
{
|
||||
//For directional lights _WorldSpaceLightPos0.w is set to zero
|
||||
float3 lightWorldDirection = normalize(_WorldSpaceLightPos0.xyz - input.posWorld.xyz * _WorldSpaceLightPos0.w);
|
||||
|
||||
float attenuation = LIGHT_ATTENUATION(input);
|
||||
float angleDot = max(0, dot(normalWorld, lightWorldDirection));
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
fixed3 lightDiffuse = calculateRampedDiffuse(_LightColor0.rgb, attenuation, angleDot);
|
||||
#else
|
||||
fixed3 lightDiffuse = _LightColor0.rgb * (attenuation * angleDot);
|
||||
#endif // _DIFFUSE_RAMP
|
||||
|
||||
return lightDiffuse;
|
||||
}
|
||||
|
||||
inline float3 calculateNormalWorld(VertexOutput input)
|
||||
{
|
||||
#if defined(_NORMALMAP)
|
||||
return calculateNormalFromBumpMap(input.texcoord, input.tangentWorld, input.binormalWorld, input.normalWorld);
|
||||
#else
|
||||
return input.normalWorld;
|
||||
#endif
|
||||
}
|
||||
|
||||
fixed3 calculateVertexLighting(float3 posWorld, float3 normalWorld)
|
||||
{
|
||||
fixed3 vertexLighting = fixed3(0,0,0);
|
||||
|
||||
#ifdef VERTEXLIGHT_ON
|
||||
//Get approximated illumination from non-important point lights
|
||||
vertexLighting = Shade4PointLights ( unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
|
||||
unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
|
||||
unity_4LightAtten0, posWorld, normalWorld) * 0.5;
|
||||
#endif
|
||||
|
||||
return vertexLighting;
|
||||
}
|
||||
|
||||
fixed3 calculateAmbientLight(half3 normalWorld)
|
||||
{
|
||||
#if defined(_SPHERICAL_HARMONICS)
|
||||
fixed3 ambient = ShadeSH9(half4(normalWorld, 1.0));
|
||||
#else
|
||||
fixed3 ambient = unity_AmbientSky.rgb;
|
||||
#endif
|
||||
return ambient;
|
||||
}
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
||||
fixed4 calculateSpecularLight(SpecularCommonData s, float3 viewDir, float3 normal, float3 lightDir, float3 lightColor, half3 ambient)
|
||||
{
|
||||
SpecularLightData data = calculatePhysicsBasedSpecularLight (s.specColor, s.oneMinusReflectivity, s.smoothness, normal, viewDir, lightDir, lightColor, ambient, unity_IndirectSpecColor.rgb);
|
||||
fixed4 pixel = calculateLitPixel(fixed4(s.diffColor, s.alpha), data.lighting);
|
||||
pixel.rgb += data.specular * s.alpha;
|
||||
return pixel;
|
||||
}
|
||||
|
||||
fixed4 calculateSpecularLightAdditive(SpecularCommonData s, float3 viewDir, float3 normal, float3 lightDir, float3 lightColor)
|
||||
{
|
||||
SpecularLightData data = calculatePhysicsBasedSpecularLight (s.specColor, s.oneMinusReflectivity, s.smoothness, normal, viewDir, lightDir, lightColor, half3(0,0,0), half3(0,0,0));
|
||||
fixed4 pixel = calculateAdditiveLitPixel(fixed4(s.diffColor, s.alpha), data.lighting);
|
||||
pixel.rgb += data.specular * s.alpha;
|
||||
return pixel;
|
||||
}
|
||||
|
||||
#endif //SPECULAR
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex program
|
||||
//
|
||||
|
||||
VertexOutput vert(VertexInput v)
|
||||
{
|
||||
VertexOutput output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
output.pos = calculateLocalPos(v.vertex);
|
||||
output.color = calculateVertexColor(v.color);
|
||||
output.texcoord = calculateTextureCoord(v.texcoord);
|
||||
output.posWorld = calculateWorldPos(v.vertex);
|
||||
|
||||
float backFaceSign = 1;
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
backFaceSign = calculateBackfacingSign(output.posWorld.xyz);
|
||||
#endif
|
||||
|
||||
output.normalWorld = calculateSpriteWorldNormal(v, backFaceSign);
|
||||
output.vertexLighting = calculateVertexLighting(output.posWorld, output.normalWorld);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
output.tangentWorld = calculateWorldTangent(v.tangent);
|
||||
output.binormalWorld = calculateSpriteWorldBinormal(v, output.normalWorld, output.tangentWorld, backFaceSign);
|
||||
#endif
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(output)
|
||||
|
||||
#if defined(_FOG)
|
||||
UNITY_TRANSFER_FOG(output,output.pos);
|
||||
#endif // _FOG
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Fragment programs
|
||||
//
|
||||
|
||||
fixed4 fragBase(VertexOutput input) : SV_Target
|
||||
{
|
||||
fixed4 texureColor = calculateTexturePixel(input.texcoord);
|
||||
ALPHA_CLIP(texureColor, input.color)
|
||||
|
||||
//Get normal direction
|
||||
fixed3 normalWorld = calculateNormalWorld(input);
|
||||
|
||||
//Get Ambient diffuse
|
||||
fixed3 ambient = calculateAmbientLight(normalWorld);
|
||||
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
||||
//For directional lights _WorldSpaceLightPos0.w is set to zero
|
||||
float3 lightWorldDirection = normalize(_WorldSpaceLightPos0.xyz - input.posWorld.xyz * _WorldSpaceLightPos0.w);
|
||||
float attenuation = LIGHT_ATTENUATION(input);
|
||||
|
||||
//Returns pixel lit by light, texture color should inlcluded alpha
|
||||
half3 viewDir = normalize(_WorldSpaceCameraPos - input.posWorld.xyz);
|
||||
fixed4 pixel = calculateSpecularLight(getSpecularData(input.texcoord.xy, texureColor, input.color), viewDir, normalWorld, lightWorldDirection, _LightColor0.rgb * attenuation, ambient + input.vertexLighting);
|
||||
|
||||
APPLY_EMISSION_SPECULAR(pixel, input.texcoord)
|
||||
|
||||
#else
|
||||
|
||||
//Get primary pixel light diffuse
|
||||
fixed3 diffuse = calculateLightDiffuse(input, normalWorld, texureColor);
|
||||
|
||||
//Combine along with vertex lighting for the base lighting pass
|
||||
fixed3 lighting = ambient + diffuse + input.vertexLighting;
|
||||
|
||||
APPLY_EMISSION(lighting, input.texcoord)
|
||||
|
||||
fixed4 pixel = calculateLitPixel(texureColor, input.color, lighting);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_RIM_LIGHTING)
|
||||
pixel.rgb = applyRimLighting(input.posWorld, normalWorld, pixel);
|
||||
#endif
|
||||
|
||||
COLORISE(pixel)
|
||||
APPLY_FOG(pixel, input)
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
fixed4 fragAdd(VertexOutput input) : SV_Target
|
||||
{
|
||||
fixed4 texureColor = calculateTexturePixel(input.texcoord);
|
||||
|
||||
#if defined(_COLOR_ADJUST)
|
||||
texureColor = adjustColor(texureColor);
|
||||
#endif // _COLOR_ADJUST
|
||||
|
||||
ALPHA_CLIP(texureColor, input.color)
|
||||
|
||||
//Get normal direction
|
||||
fixed3 normalWorld = calculateNormalWorld(input);
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
||||
//For directional lights _WorldSpaceLightPos0.w is set to zero
|
||||
float3 lightWorldDirection = normalize(_WorldSpaceLightPos0.xyz - input.posWorld.xyz * _WorldSpaceLightPos0.w);
|
||||
float attenuation = LIGHT_ATTENUATION(input);
|
||||
|
||||
half3 viewDir = normalize(_WorldSpaceCameraPos - input.posWorld.xyz);
|
||||
fixed4 pixel = calculateSpecularLightAdditive(getSpecularData(input.texcoord.xy, texureColor, input.color), viewDir, normalWorld, lightWorldDirection, _LightColor0.rgb * attenuation);
|
||||
|
||||
#else
|
||||
|
||||
//Get light diffuse
|
||||
fixed3 lighting = calculateLightDiffuse(input, normalWorld, texureColor);
|
||||
fixed4 pixel = calculateAdditiveLitPixel(texureColor, input.color, lighting);
|
||||
|
||||
#endif
|
||||
|
||||
COLORISE_ADDITIVE(pixel)
|
||||
APPLY_FOG_ADDITIVE(pixel, input)
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
|
||||
#endif // SPRITE_PIXEL_LIGHTING_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ffc57e05c42ec748838bea0a3aff9f9
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#ifndef SPRITE_SHADOWS_INCLUDED
|
||||
#define SPRITE_SHADOWS_INCLUDED
|
||||
|
||||
#include "ShaderShared.cginc"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex structs
|
||||
//
|
||||
|
||||
struct vertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct vertexOutput
|
||||
{
|
||||
V2F_SHADOW_CASTER;
|
||||
float4 texcoordAndAlpha : TEXCOORD1;
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex program
|
||||
//
|
||||
|
||||
vertexOutput vert(vertexInput v, float4 vertexColor : COLOR)
|
||||
{
|
||||
vertexOutput o;
|
||||
TRANSFER_SHADOW_CASTER(o)
|
||||
o.texcoordAndAlpha.xy = calculateTextureCoord(v.texcoord);
|
||||
o.texcoordAndAlpha.z = 0;
|
||||
o.texcoordAndAlpha.a = vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Fragment program
|
||||
//
|
||||
|
||||
|
||||
uniform fixed _ShadowAlphaCutoff;
|
||||
|
||||
fixed4 frag(vertexOutput IN) : SV_Target
|
||||
{
|
||||
fixed4 texureColor = calculateTexturePixel(IN.texcoordAndAlpha.xy);
|
||||
clip(texureColor.a * IN.texcoordAndAlpha.a - _ShadowAlphaCutoff);
|
||||
|
||||
SHADOW_CASTER_FRAGMENT(IN)
|
||||
}
|
||||
|
||||
#endif // SPRITE_SHADOWS_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7dbdfb1f55ee26459284220ad6d5bc4
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
#ifndef SPRITE_SPECULAR_INCLUDED
|
||||
#define SPRITE_SPECULAR_INCLUDED
|
||||
|
||||
#include "ShaderMaths.cginc"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Specular functions
|
||||
//
|
||||
|
||||
#if defined(_SPECULAR) || defined(_SPECULAR_GLOSSMAP)
|
||||
|
||||
#define SPECULAR
|
||||
|
||||
|
||||
//ALL THESE FUNCTIONS ARE TAKEN AND ADAPTED FROM UNITY'S OWN PHYSICS BASED STANDARD SHADER
|
||||
|
||||
uniform float _Metallic;
|
||||
uniform float _Glossiness;
|
||||
uniform float _GlossMapScale;
|
||||
uniform sampler2D _MetallicGlossMap;
|
||||
|
||||
struct SpecularLightData
|
||||
{
|
||||
half3 lighting;
|
||||
half3 specular;
|
||||
};
|
||||
|
||||
struct SpecularCommonData
|
||||
{
|
||||
half3 diffColor, specColor;
|
||||
// Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
|
||||
// Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
|
||||
half oneMinusReflectivity, smoothness;
|
||||
half alpha;
|
||||
};
|
||||
|
||||
inline half2 getMetallicGloss(float2 uv)
|
||||
{
|
||||
half2 mg;
|
||||
|
||||
#ifdef _SPECULAR_GLOSSMAP
|
||||
mg = tex2D(_MetallicGlossMap, uv).ra;
|
||||
mg.g *= _GlossMapScale;
|
||||
#else
|
||||
mg.r = _Metallic;
|
||||
mg.g = _Glossiness;
|
||||
#endif
|
||||
|
||||
return mg;
|
||||
}
|
||||
|
||||
inline half getOneMinusReflectivityFromMetallic(half metallic)
|
||||
{
|
||||
// We'll need oneMinusReflectivity, so
|
||||
// 1-reflectivity = 1-lerp(dielectricSpec, 1, metallic) = lerp(1-dielectricSpec, 0, metallic)
|
||||
// store (1-dielectricSpec) in unity_ColorSpaceDielectricSpec.a, then
|
||||
// 1-reflectivity = lerp(alpha, 0, metallic) = alpha + metallic*(0 - alpha) =
|
||||
// = alpha - metallic * alpha
|
||||
half oneMinusDielectricSpec = unity_ColorSpaceDielectricSpec.a;
|
||||
return oneMinusDielectricSpec - metallic * oneMinusDielectricSpec;
|
||||
}
|
||||
|
||||
inline SpecularCommonData getSpecularData(float2 uv, half4 texureColor, fixed4 color)
|
||||
{
|
||||
half2 metallicGloss = getMetallicGloss(uv);
|
||||
half metallic = metallicGloss.x;
|
||||
half smoothness = metallicGloss.y; // this is 1 minus the square root of real roughness m.
|
||||
|
||||
fixed4 albedo = calculatePixel(texureColor, color);
|
||||
|
||||
half3 specColor = lerp (unity_ColorSpaceDielectricSpec.rgb, albedo, metallic);
|
||||
half oneMinusReflectivity = getOneMinusReflectivityFromMetallic(metallic);
|
||||
half3 diffColor = albedo * oneMinusReflectivity;
|
||||
|
||||
SpecularCommonData o = (SpecularCommonData)0;
|
||||
o.diffColor = diffColor;
|
||||
o.specColor = specColor;
|
||||
o.oneMinusReflectivity = oneMinusReflectivity;
|
||||
o.smoothness = smoothness;
|
||||
|
||||
#if defined(_ALPHAPREMULTIPLY_ON) && (SHADER_TARGET >= 30)
|
||||
// Reflectivity 'removes' from the rest of components, including Transparency
|
||||
// outAlpha = 1-(1-alpha)*(1-reflectivity) = 1-(oneMinusReflectivity - alpha*oneMinusReflectivity) =
|
||||
// = 1-oneMinusReflectivity + alpha*oneMinusReflectivity
|
||||
//o.alpha = 1-oneMinusReflectivity + albedo.a*oneMinusReflectivity;
|
||||
o.alpha = albedo.a;
|
||||
#else
|
||||
o.alpha = albedo.a;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
inline half SmoothnessToPerceptualRoughness(half smoothness)
|
||||
{
|
||||
return (1 - smoothness);
|
||||
}
|
||||
|
||||
inline half PerceptualRoughnessToRoughness(half perceptualRoughness)
|
||||
{
|
||||
return perceptualRoughness * perceptualRoughness;
|
||||
}
|
||||
|
||||
// Ref: http://jcgt.org/published/0003/02/03/paper.pdf
|
||||
inline half SmithJointGGXVisibilityTerm (half NdotL, half NdotV, half roughness)
|
||||
{
|
||||
#if 0
|
||||
// Original formulation:
|
||||
// lambda_v = (-1 + sqrt(a2 * (1 - NdotL2) / NdotL2 + 1)) * 0.5f;
|
||||
// lambda_l = (-1 + sqrt(a2 * (1 - NdotV2) / NdotV2 + 1)) * 0.5f;
|
||||
// G = 1 / (1 + lambda_v + lambda_l);
|
||||
|
||||
// Reorder code to be more optimal
|
||||
half a = roughness;
|
||||
half a2 = a * a;
|
||||
|
||||
half lambdaV = NdotL * sqrt((-NdotV * a2 + NdotV) * NdotV + a2);
|
||||
half lambdaL = NdotV * sqrt((-NdotL * a2 + NdotL) * NdotL + a2);
|
||||
|
||||
// Simplify visibility term: (2.0f * NdotL * NdotV) / ((4.0f * NdotL * NdotV) * (lambda_v + lambda_l + 1e-5f));
|
||||
return 0.5f / (lambdaV + lambdaL + 1e-5f); // This function is not intended to be running on Mobile,
|
||||
// therefore epsilon is smaller than can be represented by half
|
||||
#else
|
||||
// Approximation of the above formulation (simplify the sqrt, not mathematically correct but close enough)
|
||||
half a = roughness;
|
||||
half lambdaV = NdotL * (NdotV * (1 - a) + a);
|
||||
half lambdaL = NdotV * (NdotL * (1 - a) + a);
|
||||
|
||||
return 0.5f / (lambdaV + lambdaL + 1e-5f);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half GGXTerm (half NdotH, half roughness)
|
||||
{
|
||||
half a2 = roughness * roughness;
|
||||
half d = (NdotH * a2 - NdotH) * NdotH + 1.0f; // 2 mad
|
||||
return UNITY_INV_PI * a2 / (d * d + 1e-7f); // This function is not intended to be running on Mobile,
|
||||
// therefore epsilon is smaller than what can be represented by half
|
||||
}
|
||||
|
||||
inline half3 FresnelTerm (half3 F0, half cosA)
|
||||
{
|
||||
half t = pow5 (1 - cosA); // ala Schlick interpoliation
|
||||
return F0 + (1-F0) * t;
|
||||
}
|
||||
|
||||
inline half3 FresnelLerp (half3 F0, half F90, half cosA)
|
||||
{
|
||||
half t = pow5 (1 - cosA); // ala Schlick interpoliation
|
||||
return lerp (F0, F90, t);
|
||||
}
|
||||
|
||||
// Note: Disney diffuse must be multiply by diffuseAlbedo / PI. This is done outside of this function.
|
||||
inline half DisneyDiffuse(half NdotV, half NdotL, half LdotH, half perceptualRoughness)
|
||||
{
|
||||
half fd90 = 0.5 + 2 * LdotH * LdotH * perceptualRoughness;
|
||||
// Two schlick fresnel term
|
||||
half lightScatter = (1 + (fd90 - 1) * pow5(1 - NdotL));
|
||||
half viewScatter = (1 + (fd90 - 1) * pow5(1 - NdotV));
|
||||
|
||||
return lightScatter * viewScatter;
|
||||
}
|
||||
|
||||
// Main Physically Based BRDF
|
||||
// Derived from Disney work and based on Torrance-Sparrow micro-facet model
|
||||
//
|
||||
// BRDF = kD / pi + kS * (D * V * F) / 4
|
||||
// I = BRDF * NdotL
|
||||
//
|
||||
// * NDF (depending on UNITY_BRDF_GGX):
|
||||
// a) Normalized BlinnPhong
|
||||
// b) GGX
|
||||
// * Smith for Visiblity term
|
||||
// * Schlick approximation for Fresnel
|
||||
SpecularLightData calculatePhysicsBasedSpecularLight(half3 specColor, half oneMinusReflectivity, half smoothness, half3 normal, half3 viewDir, half3 lightdir, half3 lightColor, half3 indirectDiffuse, half3 indirectSpecular)
|
||||
{
|
||||
half perceptualRoughness = SmoothnessToPerceptualRoughness (smoothness);
|
||||
half3 halfDir = safeNormalize (lightdir + viewDir);
|
||||
|
||||
// NdotV should not be negative for visible pixels, but it can happen due to perspective projection and normal mapping
|
||||
// In this case normal should be modified to become valid (i.e facing camera) and not cause weird artifacts.
|
||||
// but this operation adds few ALU and users may not want it. Alternative is to simply take the abs of NdotV (less correct but works too).
|
||||
// Following define allow to control this. Set it to 0 if ALU is critical on your platform.
|
||||
// This correction is interesting for GGX with SmithJoint visibility function because artifacts are more visible in this case due to highlight edge of rough surface
|
||||
// Edit: Disable this code by default for now as it is not compatible with two sided lighting used in SpeedTree.
|
||||
#define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
|
||||
|
||||
#if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
|
||||
// The amount we shift the normal toward the view vector is defined by the dot product.
|
||||
half shiftAmount = dot(normal, viewDir);
|
||||
normal = shiftAmount < 0.0f ? normal + viewDir * (-shiftAmount + 1e-5f) : normal;
|
||||
// A re-normalization should be applied here but as the shift is small we don't do it to save ALU.
|
||||
//normal = normalize(normal);
|
||||
|
||||
half nv = saturate(dot(normal, viewDir)); // TODO: this saturate should no be necessary here
|
||||
#else
|
||||
half nv = abs(dot(normal, viewDir)); // This abs allow to limit artifact
|
||||
#endif
|
||||
|
||||
half nl = saturate(dot(normal, lightdir));
|
||||
half nh = saturate(dot(normal, halfDir));
|
||||
|
||||
half lv = saturate(dot(lightdir, viewDir));
|
||||
half lh = saturate(dot(lightdir, halfDir));
|
||||
|
||||
// Diffuse term
|
||||
half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
|
||||
|
||||
// Specular term
|
||||
// HACK: theoretically we should divide diffuseTerm by Pi and not multiply specularTerm!
|
||||
// BUT 1) that will make shader look significantly darker than Legacy ones
|
||||
// and 2) on engine side "Non-important" lights have to be divided by Pi too in cases when they are injected into ambient SH
|
||||
half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
|
||||
half V = SmithJointGGXVisibilityTerm (nl, nv, roughness);
|
||||
half D = GGXTerm (nh, roughness);
|
||||
|
||||
half specularTerm = V*D * UNITY_PI; // Torrance-Sparrow model, Fresnel is applied later
|
||||
|
||||
# ifdef UNITY_COLORSPACE_GAMMA
|
||||
specularTerm = sqrt(max(1e-4h, specularTerm));
|
||||
# endif
|
||||
|
||||
// specularTerm * nl can be NaN on Metal in some cases, use max() to make sure it's a sane value
|
||||
specularTerm = max(0, specularTerm * nl);
|
||||
|
||||
// surfaceReduction = Int D(NdotH) * NdotH * Id(NdotL>0) dH = 1/(roughness^2+1)
|
||||
half surfaceReduction;
|
||||
# ifdef UNITY_COLORSPACE_GAMMA
|
||||
surfaceReduction = 1.0 - 0.28f * roughness * perceptualRoughness; // 1-0.28*x^3 as approximation for (1/(x^4+1))^(1/2.2) on the domain [0;1]
|
||||
# else
|
||||
surfaceReduction = 1.0 / (roughness*roughness + 1.0); // fade \in [0.5;1]
|
||||
# endif
|
||||
|
||||
// To provide true Lambert lighting, we need to be able to kill specular completely.
|
||||
specularTerm *= any(specColor) ? 1.0 : 0.0;
|
||||
|
||||
half grazingTerm = saturate(smoothness + (1-oneMinusReflectivity));
|
||||
|
||||
SpecularLightData outData = (SpecularLightData)0;
|
||||
outData.lighting = indirectDiffuse + lightColor * diffuseTerm;
|
||||
outData.specular = (specularTerm * lightColor * FresnelTerm (specColor, lh)) + (surfaceReduction * indirectSpecular * FresnelLerp (specColor, grazingTerm, nv));
|
||||
return outData;
|
||||
}
|
||||
|
||||
#endif // _SPECULAR && _SPECULAR_GLOSSMAP
|
||||
|
||||
#endif // SPRITE_SPECULAR_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f195336fc94457241a37a0aa85923681
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#ifndef SPRITE_UNLIT_INCLUDED
|
||||
#define SPRITE_UNLIT_INCLUDED
|
||||
|
||||
#include "ShaderShared.cginc"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex structs
|
||||
//
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
#if defined(_FOG)
|
||||
UNITY_FOG_COORDS(1)
|
||||
#endif // _FOG
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex program
|
||||
//
|
||||
|
||||
VertexOutput vert(VertexInput input)
|
||||
{
|
||||
VertexOutput output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
output.pos = calculateLocalPos(input.vertex);
|
||||
output.texcoord = calculateTextureCoord(input.texcoord);
|
||||
output.color = calculateVertexColor(input.color);
|
||||
|
||||
#if defined(_FOG)
|
||||
UNITY_TRANSFER_FOG(output,output.pos);
|
||||
#endif // _FOG
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Fragment program
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
fixed4 frag(VertexOutput input) : SV_Target
|
||||
{
|
||||
fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
|
||||
ALPHA_CLIP(texureColor, input.color)
|
||||
|
||||
fixed4 pixel = calculatePixel(texureColor, input.color);
|
||||
|
||||
COLORISE(pixel)
|
||||
APPLY_FOG(pixel, input)
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
#endif // SPRITE_UNLIT_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 072e7b07ec7fb1346a9dcd3bcbbb7111
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+473
@@ -0,0 +1,473 @@
|
||||
#ifndef SPRITE_VERTEX_LIGHTING_INCLUDED
|
||||
#define SPRITE_VERTEX_LIGHTING_INCLUDED
|
||||
|
||||
#include "ShaderShared.cginc"
|
||||
#include "SpriteLighting.cginc"
|
||||
#include "SpriteSpecular.cginc"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Defines
|
||||
//
|
||||
|
||||
//Define to use spot lights (more expensive)
|
||||
#define SPOT_LIGHTS
|
||||
|
||||
//Have to process lighting per pixel if using normal maps or a diffuse ramp or rim lighting or specular
|
||||
#if defined(_NORMALMAP) || defined(_DIFFUSE_RAMP) || defined(_RIM_LIGHTING) || defined(SPECULAR)
|
||||
#define PER_PIXEL_LIGHTING
|
||||
#endif
|
||||
|
||||
//Turn off bump mapping and diffuse ramping on older shader models as they dont support needed number of outputs
|
||||
#if defined(PER_PIXEL_LIGHTING) && (SHADER_TARGET < 30)
|
||||
#undef PER_PIXEL_LIGHTING
|
||||
#undef _NORMALMAP
|
||||
#undef _DIFFUSE_RAMP
|
||||
#undef _RIM_LIGHTING
|
||||
#endif
|
||||
|
||||
//In D3D9 only have a max of 9 TEXCOORD so can't have diffuse ramping or fog or rim lighting if processing lights per pixel
|
||||
#if defined(SHADER_API_D3D9) && defined(PER_PIXEL_LIGHTING)
|
||||
#if defined(_NORMALMAP)
|
||||
#undef _DIFFUSE_RAMP
|
||||
#undef _FOG
|
||||
#undef _RIM_LIGHTING
|
||||
#elif defined(_DIFFUSE_RAMP)
|
||||
#undef _FOG
|
||||
#undef _RIM_LIGHTING
|
||||
#elif defined(_RIM_LIGHTING)
|
||||
#undef _FOG
|
||||
#undef _DIFFUSE_RAMP
|
||||
#else
|
||||
#undef _DIFFUSE_RAMP
|
||||
#undef _RIM_LIGHTING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
#if defined(_NORMALMAP) && defined(_DIFFUSE_RAMP)
|
||||
#define ATTENUATIONS TEXCOORD9
|
||||
#if defined(_RIM_LIGHTING)
|
||||
#define _POS_WORLD_INDEX TEXCOORD10
|
||||
#define _FOG_COORD_INDEX 11
|
||||
#else
|
||||
#define _FOG_COORD_INDEX 10
|
||||
#endif
|
||||
#elif defined(_NORMALMAP) != defined(_DIFFUSE_RAMP)
|
||||
#define ATTENUATIONS TEXCOORD8
|
||||
#if defined(_RIM_LIGHTING)
|
||||
#define _POS_WORLD_INDEX TEXCOORD9
|
||||
#define _FOG_COORD_INDEX 10
|
||||
#else
|
||||
#define _FOG_COORD_INDEX 9
|
||||
#endif
|
||||
#else //!_DIFFUSE_RAMP && !_NORMALMAP
|
||||
#if defined(_RIM_LIGHTING)
|
||||
#define _POS_WORLD_INDEX TEXCOORD8
|
||||
#define _FOG_COORD_INDEX 9
|
||||
#else
|
||||
#define _FOG_COORD_INDEX 8
|
||||
#endif
|
||||
#endif
|
||||
#else //!PER_PIXEL_LIGHTING
|
||||
#define _FOG_COORD_INDEX 2
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex output struct
|
||||
//
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float3 texcoord : TEXCOORD0;
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
|
||||
half4 VertexLightInfo0 : TEXCOORD1;
|
||||
half4 VertexLightInfo1 : TEXCOORD2;
|
||||
half4 VertexLightInfo2 : TEXCOORD3;
|
||||
half4 VertexLightInfo3 : TEXCOORD4;
|
||||
half4 VertexLightInfo4 : TEXCOORD5;
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
half4 normalWorld : TEXCOORD6;
|
||||
half4 tangentWorld : TEXCOORD7;
|
||||
half4 binormalWorld : TEXCOORD8;
|
||||
#else
|
||||
half3 normalWorld : TEXCOORD6;
|
||||
half3 VertexLightInfo5 : TEXCOORD7;
|
||||
#endif
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
half4 LightAttenuations : ATTENUATIONS;
|
||||
#endif
|
||||
#if defined(_RIM_LIGHTING)
|
||||
float4 posWorld : _POS_WORLD_INDEX;
|
||||
#endif
|
||||
|
||||
#else //!PER_PIXEL_LIGHTING
|
||||
|
||||
half3 FullLighting : TEXCOORD1;
|
||||
|
||||
#endif // !PER_PIXEL_LIGHTING
|
||||
|
||||
#if defined(_FOG)
|
||||
UNITY_FOG_COORDS(_FOG_COORD_INDEX)
|
||||
#endif // _FOG
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Light calculations
|
||||
//
|
||||
|
||||
struct VertexLightInfo
|
||||
{
|
||||
half3 lightDirection;
|
||||
fixed3 lightColor;
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
float attenuation;
|
||||
#endif // _DIFFUSE_RAMP
|
||||
};
|
||||
|
||||
inline VertexLightInfo getVertexLightAttenuatedInfo(int index, float3 viewPos)
|
||||
{
|
||||
VertexLightInfo lightInfo;
|
||||
|
||||
//For directional lights unity_LightPosition.w is set to zero
|
||||
lightInfo.lightDirection = unity_LightPosition[index].xyz - viewPos.xyz * unity_LightPosition[index].w;
|
||||
float lengthSq = dot(lightInfo.lightDirection, lightInfo.lightDirection);
|
||||
|
||||
// don't produce NaNs if some vertex position overlaps with the light
|
||||
lengthSq = max(lengthSq, 0.000001);
|
||||
|
||||
lightInfo.lightDirection *= rsqrt(lengthSq);
|
||||
|
||||
float attenuation = 1.0 / (1.0 + lengthSq * unity_LightAtten[index].z);
|
||||
|
||||
#if defined(SPOT_LIGHTS)
|
||||
//Spot light attenuation - for non-spot lights unity_LightAtten.x is set to -1 and y is set to 1
|
||||
{
|
||||
float rho = max (0, dot(lightInfo.lightDirection, unity_SpotDirection[index].xyz));
|
||||
float spotAtt = (rho - unity_LightAtten[index].x) * unity_LightAtten[index].y;
|
||||
attenuation *= saturate(spotAtt);
|
||||
}
|
||||
#endif // SPOT_LIGHTS
|
||||
|
||||
//If using a diffuse ramp texture then need to pass through the lights attenuation, otherwise premultiply the light color with it
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
lightInfo.lightColor = unity_LightColor[index].rgb;
|
||||
lightInfo.attenuation = attenuation;
|
||||
#else
|
||||
lightInfo.lightColor = unity_LightColor[index].rgb * attenuation;
|
||||
#endif // _DIFFUSE_RAMP
|
||||
|
||||
return lightInfo;
|
||||
}
|
||||
|
||||
//Magic constants used to tweak ambient to approximate pixel shader spherical harmonics
|
||||
static const fixed3 worldUp = fixed3(0, 1, 0);
|
||||
static const float skyGroundDotMul = 2.5;
|
||||
static const float minEquatorMix = 0.5;
|
||||
static const float equatorColorBlur = 0.33;
|
||||
|
||||
fixed3 calculateAmbientLight(half3 normalWorld)
|
||||
{
|
||||
#if defined(_SPHERICAL_HARMONICS)
|
||||
float upDot = dot(normalWorld, worldUp);
|
||||
|
||||
//Fade between a flat lerp from sky to ground and a 3 way lerp based on how bright the equator light is.
|
||||
//This simulates how directional lights get blurred using spherical harmonics
|
||||
|
||||
//Work out color from ground and sky, ignoring equator
|
||||
float adjustedDot = upDot * skyGroundDotMul;
|
||||
fixed3 skyGroundColor = lerp(unity_AmbientGround, unity_AmbientSky, saturate((adjustedDot + 1.0) * 0.5));
|
||||
|
||||
//Work out equator lights brightness
|
||||
float equatorBright = saturate(dot(unity_AmbientEquator.rgb, unity_AmbientEquator.rgb));
|
||||
|
||||
//Blur equator color with sky and ground colors based on how bright it is.
|
||||
fixed3 equatorBlurredColor = lerp(unity_AmbientEquator, saturate(unity_AmbientEquator + unity_AmbientGround + unity_AmbientSky), equatorBright * equatorColorBlur);
|
||||
|
||||
//Work out 3 way lerp inc equator light
|
||||
fixed3 equatorColor = lerp(equatorBlurredColor, unity_AmbientGround, -upDot) * step(upDot, 0) + lerp(equatorBlurredColor, unity_AmbientSky, upDot) * step(0, upDot);
|
||||
|
||||
//Mix the two colors together based on how bright the equator light is
|
||||
return lerp(skyGroundColor, equatorColor, saturate(equatorBright + minEquatorMix));
|
||||
|
||||
#else // !_SPHERICAL_HARMONICS
|
||||
|
||||
//Flat ambient is just the sky color
|
||||
return unity_AmbientSky.rgb;
|
||||
|
||||
#endif // !_SPHERICAL_HARMONICS
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Light Packing Functions
|
||||
//
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
|
||||
inline fixed3 calculateLightDiffuse(fixed3 lightColor, half3 viewNormal, half3 lightViewDir, float attenuation)
|
||||
{
|
||||
float angleDot = max(0, dot(viewNormal, lightViewDir));
|
||||
fixed3 lightDiffuse = calculateRampedDiffuse(lightColor, attenuation, angleDot);
|
||||
return lightDiffuse;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline fixed3 calculateLightDiffuse(fixed3 attenuatedLightColor, half3 viewNormal, half3 lightViewDir)
|
||||
{
|
||||
float angleDot = max(0, dot(viewNormal, lightViewDir));
|
||||
fixed3 lightDiffuse = attenuatedLightColor * angleDot;
|
||||
|
||||
return lightDiffuse;
|
||||
}
|
||||
|
||||
#endif // _NORMALMAP
|
||||
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
|
||||
#define VERTEX_LIGHT_0_DIR VertexLightInfo0.xyz
|
||||
#define VERTEX_LIGHT_0_R VertexLightInfo4.x
|
||||
#define VERTEX_LIGHT_0_G VertexLightInfo4.y
|
||||
#define VERTEX_LIGHT_0_B VertexLightInfo4.z
|
||||
|
||||
#define VERTEX_LIGHT_1_DIR VertexLightInfo1.xyz
|
||||
#define VERTEX_LIGHT_1_R VertexLightInfo0.w
|
||||
#define VERTEX_LIGHT_1_G VertexLightInfo1.w
|
||||
#define VERTEX_LIGHT_1_B VertexLightInfo2.w
|
||||
|
||||
#define VERTEX_LIGHT_2_DIR VertexLightInfo2.xyz
|
||||
#define VERTEX_LIGHT_2_R VertexLightInfo3.w
|
||||
#define VERTEX_LIGHT_2_G VertexLightInfo4.w
|
||||
#define VERTEX_LIGHT_2_B texcoord.z
|
||||
|
||||
#define VERTEX_LIGHT_3_DIR VertexLightInfo3.xyz
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
#define VERTEX_LIGHT_3_R normalWorld.w
|
||||
#define VERTEX_LIGHT_3_G tangentWorld.w
|
||||
#define VERTEX_LIGHT_3_B binormalWorld.w
|
||||
#else
|
||||
#define VERTEX_LIGHT_3_R VertexLightInfo5.x
|
||||
#define VERTEX_LIGHT_3_G VertexLightInfo5.y
|
||||
#define VERTEX_LIGHT_3_B VertexLightInfo5.z
|
||||
#endif
|
||||
|
||||
#if defined(_DIFFUSE_RAMP)
|
||||
|
||||
#define LIGHT_DIFFUSE_ATTEN_0 LightAttenuations.x
|
||||
#define LIGHT_DIFFUSE_ATTEN_1 LightAttenuations.y
|
||||
#define LIGHT_DIFFUSE_ATTEN_2 LightAttenuations.z
|
||||
#define LIGHT_DIFFUSE_ATTEN_3 LightAttenuations.w
|
||||
|
||||
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo) \
|
||||
{ \
|
||||
output.LIGHT_DIFFUSE_ATTEN_##index = lightInfo.attenuation; \
|
||||
}
|
||||
|
||||
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||
{ \
|
||||
diffuse += calculateLightDiffuse(lightColor, viewNormal, lightViewDir, input.LIGHT_DIFFUSE_ATTEN_##index); \
|
||||
}
|
||||
#else
|
||||
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo)
|
||||
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||
{ \
|
||||
diffuse += calculateLightDiffuse(lightColor, viewNormal, lightViewDir); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PACK_VERTEX_LIGHT(index, output, viewPos) \
|
||||
{ \
|
||||
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos); \
|
||||
output.VERTEX_LIGHT_##index##_DIR = lightInfo.lightDirection; \
|
||||
output.VERTEX_LIGHT_##index##_R = lightInfo.lightColor.r; \
|
||||
output.VERTEX_LIGHT_##index##_G = lightInfo.lightColor.g; \
|
||||
output.VERTEX_LIGHT_##index##_B = lightInfo.lightColor.b; \
|
||||
PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo); \
|
||||
}
|
||||
|
||||
#define ADD_VERTEX_LIGHT(index, input, viewNormal, diffuse) \
|
||||
{ \
|
||||
half3 lightViewDir = input.VERTEX_LIGHT_##index##_DIR; \
|
||||
fixed3 lightColor = fixed3(input.VERTEX_LIGHT_##index##_R, input.VERTEX_LIGHT_##index##_G, input.VERTEX_LIGHT_##index##_B); \
|
||||
ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||
}
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
||||
#define ADD_VERTEX_LIGHT_SPEC(index, input, viewNormal, specData, combinedLightData, indirectDiffuse, indirectSpecular) \
|
||||
{ \
|
||||
half3 lightViewDir = input.VERTEX_LIGHT_##index##_DIR; \
|
||||
fixed3 lightColor = fixed3(input.VERTEX_LIGHT_##index##_R, input.VERTEX_LIGHT_##index##_G, input.VERTEX_LIGHT_##index##_B); \
|
||||
SpecularLightData lightData = calculatePhysicsBasedSpecularLight(specData.specColor, specData.oneMinusReflectivity, specData.smoothness, viewNormal, fixed3(0,0,1), lightViewDir, lightColor, indirectDiffuse, indirectSpecular); \
|
||||
combinedLightData.lighting += lightData.lighting; \
|
||||
combinedLightData.specular += lightData.specular; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else //!PER_PIXEL_LIGHTING
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex Only Functions
|
||||
//
|
||||
|
||||
inline fixed3 calculateLightDiffuse(int index, float3 viewPos, half3 viewNormal)
|
||||
{
|
||||
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos);
|
||||
float angleDot = max(0, dot(viewNormal, lightInfo.lightDirection));
|
||||
return lightInfo.lightColor * angleDot;
|
||||
}
|
||||
|
||||
#endif // !PER_PIXEL_LIGHTING
|
||||
|
||||
////////////////////////////////////////
|
||||
// Vertex program
|
||||
//
|
||||
|
||||
VertexOutput vert(VertexInput input)
|
||||
{
|
||||
VertexOutput output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
output.pos = calculateLocalPos(input.vertex);
|
||||
output.color = calculateVertexColor(input.color);
|
||||
output.texcoord = float3(calculateTextureCoord(input.texcoord), 0);
|
||||
|
||||
float3 viewPos = UnityObjectToViewPos(input.vertex); //float3 viewPos = mul(UNITY_MATRIX_MV, input.vertex); //
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING) || defined(_RIM_LIGHTING)
|
||||
float4 powWorld = calculateWorldPos(input.vertex);
|
||||
#endif
|
||||
|
||||
float backFaceSign = 1;
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
backFaceSign = calculateBackfacingSign(powWorld.xyz);
|
||||
#endif
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
|
||||
#if defined(_RIM_LIGHTING)
|
||||
output.posWorld = powWorld;
|
||||
#endif
|
||||
|
||||
PACK_VERTEX_LIGHT(0, output, viewPos)
|
||||
PACK_VERTEX_LIGHT(1, output, viewPos)
|
||||
PACK_VERTEX_LIGHT(2, output, viewPos)
|
||||
PACK_VERTEX_LIGHT(3, output, viewPos)
|
||||
|
||||
output.normalWorld.xyz = calculateSpriteWorldNormal(input, backFaceSign);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
output.tangentWorld.xyz = calculateWorldTangent(input.tangent);
|
||||
output.binormalWorld.xyz = calculateSpriteWorldBinormal(input, output.normalWorld, output.tangentWorld, backFaceSign);
|
||||
#endif
|
||||
|
||||
#else // !PER_PIXEL_LIGHTING
|
||||
|
||||
//Just pack full lighting
|
||||
float3 viewNormal = calculateSpriteViewNormal(input, backFaceSign);
|
||||
//Get Ambient diffuse
|
||||
float3 normalWorld = calculateSpriteWorldNormal(input, backFaceSign);
|
||||
fixed3 ambient = calculateAmbientLight(normalWorld);
|
||||
|
||||
fixed3 diffuse = calculateLightDiffuse(0, viewPos, viewNormal);
|
||||
diffuse += calculateLightDiffuse(1, viewPos, viewNormal);
|
||||
diffuse += calculateLightDiffuse(2, viewPos, viewNormal);
|
||||
diffuse += calculateLightDiffuse(3, viewPos, viewNormal);
|
||||
|
||||
output.FullLighting = ambient + diffuse;
|
||||
|
||||
#endif // !PER_PIXEL_LIGHTING
|
||||
|
||||
#if defined(_FOG)
|
||||
UNITY_TRANSFER_FOG(output, output.pos);
|
||||
#endif // _FOG
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Fragment program
|
||||
//
|
||||
|
||||
fixed4 frag(VertexOutput input) : SV_Target
|
||||
{
|
||||
fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
|
||||
ALPHA_CLIP(texureColor, input.color)
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
half3 normalWorld = calculateNormalFromBumpMap(input.texcoord.xy, input.tangentWorld.xyz, input.binormalWorld.xyz, input.normalWorld.xyz);
|
||||
#else
|
||||
half3 normalWorld = input.normalWorld.xyz;
|
||||
#endif
|
||||
|
||||
//Get Ambient diffuse
|
||||
fixed3 ambient = calculateAmbientLight(normalWorld);
|
||||
|
||||
half3 normalView = normalize(mul((float3x3)UNITY_MATRIX_V, normalWorld));
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
||||
SpecularCommonData specData = getSpecularData(input.texcoord.xy, texureColor, input.color);
|
||||
|
||||
SpecularLightData combinedLightData = (SpecularLightData)0;
|
||||
ADD_VERTEX_LIGHT_SPEC(0, input, normalView, specData, combinedLightData, ambient, unity_IndirectSpecColor.rgb)
|
||||
ADD_VERTEX_LIGHT_SPEC(1, input, normalView, specData, combinedLightData, fixed3(0,0,0), fixed3(0,0,0))
|
||||
ADD_VERTEX_LIGHT_SPEC(2, input, normalView, specData, combinedLightData, fixed3(0,0,0), fixed3(0,0,0))
|
||||
ADD_VERTEX_LIGHT_SPEC(3, input, normalView, specData, combinedLightData, fixed3(0,0,0), fixed3(0,0,0))
|
||||
|
||||
fixed4 pixel = calculateLitPixel(fixed4(specData.diffColor, specData.alpha), combinedLightData.lighting);
|
||||
pixel.rgb += combinedLightData.specular * specData.alpha;
|
||||
|
||||
APPLY_EMISSION_SPECULAR(pixel, input.texcoord)
|
||||
|
||||
#else
|
||||
|
||||
//Find vertex light diffuse
|
||||
fixed3 diffuse = fixed3(0,0,0);
|
||||
|
||||
//Add each vertex light to diffuse
|
||||
ADD_VERTEX_LIGHT(0, input, normalView, diffuse)
|
||||
ADD_VERTEX_LIGHT(1, input, normalView, diffuse)
|
||||
ADD_VERTEX_LIGHT(2, input, normalView, diffuse)
|
||||
ADD_VERTEX_LIGHT(3, input, normalView, diffuse)
|
||||
|
||||
fixed3 lighting = ambient + diffuse;
|
||||
|
||||
APPLY_EMISSION(lighting, input.texcoord.xy)
|
||||
|
||||
fixed4 pixel = calculateLitPixel(texureColor, input.color, lighting);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_RIM_LIGHTING)
|
||||
pixel.rgb = applyRimLighting(input.posWorld, normalWorld, pixel);
|
||||
#endif
|
||||
|
||||
#else // !PER_PIXEL_LIGHTING
|
||||
|
||||
APPLY_EMISSION(input.FullLighting, input.texcoord.xy)
|
||||
|
||||
fixed4 pixel = calculateLitPixel(texureColor, input.color, input.FullLighting);
|
||||
|
||||
#endif // !PER_PIXEL_LIGHTING
|
||||
|
||||
COLORISE(pixel)
|
||||
APPLY_FOG(pixel, input)
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
#endif // SPRITE_VERTEX_LIGHTING_INCLUDED
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c739dcf9dbcab944898d0b796e11afb9
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+522
@@ -0,0 +1,522 @@
|
||||
Shader "Hidden/Sprite-CameraDepthNormalsTexture" {
|
||||
|
||||
// Use this shader to render a DepthNormals texture for a camera with correct sprite normals (using camera.RenderWithShader with replacement tag "RenderType")
|
||||
|
||||
Properties {
|
||||
_MainTex ("", 2D) = "white" {}
|
||||
_Cutoff ("", Float) = 0.5
|
||||
_Color ("", Color) = (1,1,1,1)
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Sprite" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _FixedNormal;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteViewSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/SpriteLighting.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.nz.xyz = getFixedNormal();
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteModelSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/SpriteLighting.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
float3 worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
float3 normal = getFixedNormal();
|
||||
//Only do this if backface is enabled :/
|
||||
normal *= calculateBackfacingSign(worldPos.xyz);
|
||||
//
|
||||
o.nz.xyz = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TransparentCutout" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _MainTex_ST;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
uniform fixed4 _Color;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a*_Color.a - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBark" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertBark(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeLeaf" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertLeaf(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeOpaque" "DisableBatching"="True" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeTransparentCutout" "DisableBatching"="True" }
|
||||
Pass {
|
||||
Cull Back
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
Cull Front
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = -COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert (appdata_tree_billboard v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainBillboardTree(v.vertex, v.texcoord1.xy, v.texcoord.y);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.x = v.texcoord.x;
|
||||
o.uv.y = v.texcoord.y > 0;
|
||||
o.nz.xyz = float3(0,0,1);
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - 0.001 );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="GrassBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassBillboardVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Grass" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4794ea6b2d07cc546ba97a809b5f9ada
|
||||
timeCreated: 1494092583
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+518
@@ -0,0 +1,518 @@
|
||||
Shader "Hidden/Sprite-CameraDepthTexture" {
|
||||
|
||||
// Use this shader to render a Depth texture for a camera with soft edged Sprites (using camera.RenderWithShader with replacement tag "RenderType")
|
||||
// Note the depth is encoded into the pixels RGB not the full RGBA (alpha is needed for blending)
|
||||
|
||||
Properties {
|
||||
_MainTex ("", 2D) = "white" {}
|
||||
_Cutoff ("", Float) = 0.5
|
||||
_Color ("", Color) = (1,1,1,1)
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Sprite" }
|
||||
Pass {
|
||||
Cull Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), alpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteViewSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), alpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteModelSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), alpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TransparentCutout" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _MainTex_ST;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
uniform fixed4 _Color;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a*_Color.a - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBark" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertBark(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeLeaf" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertLeaf(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeOpaque" "DisableBatching"="True" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeTransparentCutout" "DisableBatching"="True" }
|
||||
Pass {
|
||||
Cull Back
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
Cull Front
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert (appdata_tree_billboard v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainBillboardTree(v.vertex, v.texcoord1.xy, v.texcoord.y);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.x = v.texcoord.x;
|
||||
o.uv.y = v.texcoord.y > 0;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - 0.001 );
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="GrassBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassBillboardVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Grass" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderMaths.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float depth : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.depth = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return fixed4(EncodeFloatRGB (i.depth), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f768a57e040cc48489ad8c7392a31154
|
||||
timeCreated: 1494092586
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+522
@@ -0,0 +1,522 @@
|
||||
Shader "Hidden/Sprite-CameraNormalsTexture" {
|
||||
|
||||
// Use this shader to render a Normals texture for a camera with correct sprite normals (using camera.RenderWithShader with replacement tag "RenderType")
|
||||
|
||||
Properties {
|
||||
_MainTex ("", 2D) = "white" {}
|
||||
_Cutoff ("", Float) = 0.5
|
||||
_Color ("", Color) = (1,1,1,1)
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Sprite" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _FixedNormal;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteViewSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/SpriteLighting.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
o.nz.xyz = getFixedNormal();
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="SpriteModelSpaceFixedNormal" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/ShaderShared.cginc"
|
||||
#include "CGIncludes/SpriteLighting.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = calculateTextureCoord(v.texcoord);
|
||||
float3 worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
float3 normal = getFixedNormal();
|
||||
//Only do this if backface is enabled :/
|
||||
normal *= calculateBackfacingSign(worldPos.xyz);
|
||||
//
|
||||
o.nz.xyz = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = calculateTexturePixel(i.uv );
|
||||
float alpha = texcol.a*_Color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TransparentCutout" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _MainTex_ST;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
uniform fixed4 _Color;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a*_Color.a - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBark" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertBark(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeLeaf" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertLeaf(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeOpaque" "DisableBatching"="True" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeTransparentCutout" "DisableBatching"="True" }
|
||||
Pass {
|
||||
Cull Back
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
Cull Front
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = -COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert (appdata_tree_billboard v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainBillboardTree(v.vertex, v.texcoord1.xy, v.texcoord.y);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.x = v.texcoord.x;
|
||||
o.uv.y = v.texcoord.y > 0;
|
||||
o.nz.xyz = float3(0,0,1);
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - 0.001 );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="GrassBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassBillboardVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Grass" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return i.nz;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 537141eca02c6df4bb8b4f77567e9de2
|
||||
timeCreated: 1494092584
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
Contributed by ToddRivers
|
||||
|
||||
# Unity Sprite Shaders
|
||||
An Uber Shader specialised for rendering Sprites in Unity.
|
||||
Even though it's designed for Sprites it can be used for a whole range of uses. It supports a wide range of optional shader features that won't effect performance unless they are used.
|
||||
It also supports per-pixel effects such as normal maps and diffuse ramping whilst using Vertex Lit rendering.
|
||||
|
||||
### Lighting
|
||||
The shaders support lighting using both Forward Rendering and Vertex Lit Rendering.
|
||||
Forward rendering is more accurate but is slower and crucially means the sprite has to write to depth using alpha clipping to avoid overdraw.
|
||||
Vertex lit means all lighting can be done in one pass meaning full alpha can be used.
|
||||
|
||||
### Normal Mapping
|
||||
Normals maps are supported in both lighting modes (in Vertex Lit rendering data for normal mapping is packed into texture channels and then processed per pixel).
|
||||
|
||||
### Blend Modes
|
||||
Easily switch between blend modes including pre-multiplied alpha, additive, multiply etc.
|
||||
|
||||
### Rim Lighting
|
||||
Camera-space rim lighting is supported in both lighting modes.
|
||||
|
||||
### Diffuse Ramp
|
||||
A ramp texture is optionally supported for toon shading effects.
|
||||
|
||||
### Shadows
|
||||
Shadows are supported using alpha clipping.
|
||||
|
||||
### Gradient based Ambient lighting
|
||||
Both lighting modes support using a gradient for ambient light. In Vertex Lit mode the Spherical Harmonics is approximated from the ground, equator and sky colors.
|
||||
|
||||
### Emission Map
|
||||
An optional emission map is supported.
|
||||
|
||||
### Camera Space Normals
|
||||
As sprites are 2d their normals will always be constant. The shaders allow you to define a fixed normal in camera space rather than pass through mesh normals.
|
||||
This not only saves vertex throughput but means lighting looks less 'flat' for rendering sprites with a perspective camera.
|
||||
|
||||
### Color Adjustment
|
||||
The shaders allow optional adjustment of hue / saturation and brightness as well as applying a solid color overlay effect for flashing a sprite to a solid color (eg. for damage effects).
|
||||
|
||||
### Fog
|
||||
Fog is optionally supported
|
||||
|
||||
|
||||
## To Use
|
||||
On your object's material click the drop down for shader and select Spine\Sprite\Pixel Lit, Vertex Lit or Unlit.
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cecd0ea162097a94c89a97af6baf0a66
|
||||
timeCreated: 1479457854
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+446
@@ -0,0 +1,446 @@
|
||||
Shader "Hidden/Internal-SpriteDepthNormalsTexture" {
|
||||
|
||||
// Use this shader to render a DepthNormals texture for a camera with correct sprite normals (using camera.RenderWithShader)
|
||||
|
||||
Properties {
|
||||
_MainTex ("", 2D) = "white" {}
|
||||
_Cutoff ("", Float) = 0.5
|
||||
_Color ("", Color) = (1,1,1,1)
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Sprite" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform float4 _FixedNormal;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.nz.xyz = _FixedNormal.xyz;
|
||||
#if UNITY_REVERSED_Z
|
||||
o.nz.z = -o.nz.z;
|
||||
#endif
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
uniform fixed4 _Color;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a*_Color.a - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TransparentCutout" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
uniform float4 _MainTex_ST;
|
||||
v2f vert( appdata_base v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
uniform fixed4 _Color;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a*_Color.a - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBark" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertBark(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeLeaf" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "UnityBuiltin3xTreeLibrary.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert( appdata_full v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TreeVertLeaf(v);
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag( v2f i ) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeOpaque" "DisableBatching"="True" }
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 nz : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeTransparentCutout" "DisableBatching"="True" }
|
||||
Pass {
|
||||
Cull Back
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
half alpha = tex2D(_MainTex, i.uv).a;
|
||||
|
||||
clip (alpha - _Cutoff);
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
Cull Front
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
fixed4 color : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
v2f vert( appdata v ) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainAnimateTree(v.vertex, v.color.w);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = -COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="TreeBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
v2f vert (appdata_tree_billboard v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
TerrainBillboardTree(v.vertex, v.texcoord1.xy, v.texcoord.y);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.x = v.texcoord.x;
|
||||
o.uv.y = v.texcoord.y > 0;
|
||||
o.nz.xyz = float3(0,0,1);
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
clip( texcol.a - 0.001 );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="GrassBillboard" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassBillboardVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Grass" }
|
||||
Pass {
|
||||
Cull Off
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainEngine.cginc"
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 nz : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert (appdata_full v) {
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
WavingGrassVert (v);
|
||||
o.color = v.color;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
o.nz.xyz = COMPUTE_VIEW_NORMAL;
|
||||
o.nz.w = COMPUTE_DEPTH_01;
|
||||
return o;
|
||||
}
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed _Cutoff;
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 texcol = tex2D( _MainTex, i.uv );
|
||||
fixed alpha = texcol.a * i.color.a;
|
||||
clip( alpha - _Cutoff );
|
||||
return EncodeDepthNormal (i.nz.w, i.nz.xyz);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abbda12fddbb0b048a842a3835470d30
|
||||
timeCreated: 1480325971
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
Shader "Spine/Sprite/Pixel Lit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
||||
|
||||
_EmissionColor("Color", Color) = (0,0,0,0)
|
||||
_EmissionMap("Emission", 2D) = "white" {}
|
||||
_EmissionPower("Emission Power", Float) = 2.0
|
||||
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
|
||||
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMap("Metallic", 2D) = "white" {}
|
||||
|
||||
_DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {}
|
||||
|
||||
_FixedNormal ("Fixed Normal", Vector) = (0,0,1,1)
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.5
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
_CustomRenderQueue ("Custom Render Queue", Float) = 0.0
|
||||
|
||||
_OverlayColor ("Overlay Color", Color) = (0,0,0,0)
|
||||
_Hue("Hue", Range(-0.5,0.5)) = 0.0
|
||||
_Saturation("Saturation", Range(0,2)) = 1.0
|
||||
_Brightness("Brightness", Range(0,2)) = 1.0
|
||||
|
||||
_RimPower("Rim Power", Float) = 2.0
|
||||
_RimColor ("Rim Color", Color) = (1,1,1,1)
|
||||
|
||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
|
||||
LOD 200
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
// Note: ZWrite needs to be enabled for following ForwardAdd pass, otherwise parts will look as if shining through by getting lit.
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull [_Cull]
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2
|
||||
#pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE
|
||||
#pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP
|
||||
#pragma shader_feature _NORMALMAP
|
||||
#pragma shader_feature _ALPHA_CLIP
|
||||
#pragma shader_feature _EMISSION
|
||||
#pragma shader_feature _RIM_LIGHTING
|
||||
#pragma shader_feature _DIFFUSE_RAMP
|
||||
#pragma shader_feature _COLOR_ADJUST
|
||||
#pragma shader_feature _TEXTURE_BLEND
|
||||
#pragma shader_feature _SPHERICAL_HARMONICS
|
||||
#pragma shader_feature _FOG
|
||||
|
||||
#pragma multi_compile_fwdbase
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragBase
|
||||
|
||||
#include "CGIncludes/SpritePixelLighting.cginc"
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD_DELTA"
|
||||
Tags { "LightMode" = "ForwardAdd" }
|
||||
Blend [_SrcBlend] One
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Cull [_Cull]
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2
|
||||
#pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE
|
||||
#pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP
|
||||
#pragma shader_feature _NORMALMAP
|
||||
#pragma shader_feature _ALPHA_CLIP
|
||||
#pragma shader_feature _DIFFUSE_RAMP
|
||||
#pragma shader_feature _COLOR_ADJUST
|
||||
#pragma shader_feature _TEXTURE_BLEND
|
||||
#pragma shader_feature _FOG
|
||||
|
||||
#pragma multi_compile_fwdadd_fullshadows
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAdd
|
||||
|
||||
#include "CGIncludes/SpritePixelLighting.cginc"
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
Fog { Mode Off }
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "CGIncludes/SpriteShadows.cginc"
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack "Spine/Sprite/Unlit"
|
||||
CustomEditor "SpineSpriteShaderGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f7a5a97a82637f478494bc40ea8c8a2
|
||||
timeCreated: 1479457857
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,109 @@
|
||||
Shader "Spine/Sprite/Unlit"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
||||
|
||||
_ZWrite ("Depth Write", Float) = 0.0
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0
|
||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
_CustomRenderQueue ("Custom Render Queue", Float) = 0.0
|
||||
|
||||
_OverlayColor ("Overlay Color", Color) = (0,0,0,0)
|
||||
_Hue("Hue", Range(-0.5,0.5)) = 0.0
|
||||
_Saturation("Saturation", Range(0,2)) = 1.0
|
||||
_Brightness("Brightness", Range(0,2)) = 1.0
|
||||
|
||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
|
||||
// Outline properties are drawn via custom editor.
|
||||
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||||
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||||
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||||
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||||
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||||
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||||
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
|
||||
LOD 100
|
||||
|
||||
Stencil {
|
||||
Ref[_StencilRef]
|
||||
Comp[_StencilComp]
|
||||
Pass Keep
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Normal"
|
||||
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
Lighting Off
|
||||
ZWrite [_ZWrite]
|
||||
ZTest LEqual
|
||||
Cull [_Cull]
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2
|
||||
#pragma shader_feature _ALPHA_CLIP
|
||||
#pragma shader_feature _TEXTURE_BLEND
|
||||
#pragma shader_feature _COLOR_ADJUST
|
||||
#pragma shader_feature _FOG
|
||||
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "CGIncludes/SpriteUnlit.cginc"
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
Offset 1, 1
|
||||
|
||||
Fog { Mode Off }
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Off
|
||||
Lighting Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile_shadowcaster
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "CGIncludes/SpriteShadows.cginc"
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
CustomEditor "SpineSpriteShaderGUI"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64005298b9a80bb4899eabd5140dc4a8
|
||||
timeCreated: 1479457857
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user