e
This commit is contained in:
@@ -1,128 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53efa1d97f5d9f74285d4330cda14e36
|
||||
timeCreated: 1496446742
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef SPRITES_DEPTH_ONLY_PASS_INCLUDED
|
||||
#define SPRITES_DEPTH_ONLY_PASS_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float _Cutoff;
|
||||
float _ZWriteOffset;
|
||||
|
||||
struct VertexInput {
|
||||
float4 positionOS : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float4 texcoordAndAlpha: TEXCOORD0;
|
||||
};
|
||||
|
||||
VertexOutput DepthOnlyVertex (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.positionCS = UnityObjectToClipPos(v.positionOS - float4(0, 0, _ZWriteOffset, 0));
|
||||
o.texcoordAndAlpha.xy = v.texcoord;
|
||||
o.texcoordAndAlpha.z = 0;
|
||||
o.texcoordAndAlpha.a = v.vertexColor.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 DepthOnlyFragment (VertexOutput input) : SV_Target{
|
||||
float4 texColor = tex2D(_MainTex, input.texcoordAndAlpha.rg);
|
||||
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
texColor.rgb *= texColor.a;
|
||||
#endif
|
||||
|
||||
clip(texColor.a * input.texcoordAndAlpha.a - _Cutoff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27351ce55d3beb643ae8d9385db21941
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef SPINE_OUTLINE_COMMON_INCLUDED
|
||||
#define SPINE_OUTLINE_COMMON_INCLUDED
|
||||
|
||||
float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
|
||||
float2 uv, float vertexColorAlpha,
|
||||
float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel,
|
||||
float OutlineSmoothness, float ThresholdEnd, float4 OutlineColor) {
|
||||
|
||||
float4 texColor = fixed4(0, 0, 0, 0);
|
||||
|
||||
float outlineWidthCompensated = OutlineWidth / (OutlineReferenceTexWidth * mainTextureTexelSize.x);
|
||||
float xOffset = mainTextureTexelSize.x * outlineWidthCompensated;
|
||||
float yOffset = mainTextureTexelSize.y * outlineWidthCompensated;
|
||||
float xOffsetDiagonal = mainTextureTexelSize.x * outlineWidthCompensated * 0.7;
|
||||
float yOffsetDiagonal = mainTextureTexelSize.y * outlineWidthCompensated * 0.7;
|
||||
|
||||
float pixelCenter = tex2D(mainTexture, uv).a;
|
||||
|
||||
float4 uvCenterWithLod = float4(uv, 0, OutlineMipLevel);
|
||||
float pixelTop = tex2Dlod(mainTexture, uvCenterWithLod + float4(0, yOffset, 0, 0)).a;
|
||||
float pixelBottom = tex2Dlod(mainTexture, uvCenterWithLod + float4(0, -yOffset, 0, 0)).a;
|
||||
float pixelLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffset, 0, 0, 0)).a;
|
||||
float pixelRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffset, 0, 0, 0)).a;
|
||||
#if _USE8NEIGHBOURHOOD_ON
|
||||
float numSamples = 8;
|
||||
float pixelTopLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelTopRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelBottomLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
|
||||
float pixelBottomRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
|
||||
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight +
|
||||
pixelTopLeft + pixelTopRight + pixelBottomLeft + pixelBottomRight)
|
||||
* vertexColorAlpha / numSamples;
|
||||
#else // 4 neighbourhood
|
||||
float numSamples = 1;
|
||||
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight) * vertexColorAlpha / numSamples;
|
||||
#endif
|
||||
float thresholdStart = ThresholdEnd * (1.0 - OutlineSmoothness);
|
||||
float outlineAlpha = saturate((average - thresholdStart) / (ThresholdEnd - thresholdStart)) - pixelCenter;
|
||||
return lerp(texColor, OutlineColor, outlineAlpha);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8d610b87be4e82409e18a63a930d335
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,30 +0,0 @@
|
||||
#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
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7297b25c81d2494e8e73b742e3c7345
|
||||
timeCreated: 1564083752
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,120 +0,0 @@
|
||||
#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));
|
||||
|
||||
#ifdef _DOUBLE_SIDED_LIGHTING
|
||||
// unfortunately we have to compute the sign here in the vertex shader
|
||||
// instead of using VFACE in fragment shader stage.
|
||||
half faceSign = sign(eyeNormal.z);
|
||||
eyeNormal *= faceSign;
|
||||
#endif
|
||||
|
||||
// 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);
|
||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||
tex.rgb *= tex.a;
|
||||
#endif
|
||||
fixed4 col = tex * i.color;
|
||||
col.rgb *= 2;
|
||||
return col;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70c77c02aabd5e44f94aab48dd0be7b2
|
||||
timeCreated: 1564083752
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,46 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0299ffae826705448b6c80ccc6a53b75
|
||||
timeCreated: 1573829476
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,46 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b3566a937643b8498d1ec6df5880b77
|
||||
timeCreated: 1573829476
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,92 +0,0 @@
|
||||
#ifndef SPINE_OUTLINE_PASS_INCLUDED
|
||||
#define SPINE_OUTLINE_PASS_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
#include "UnityUI.cginc"
|
||||
#endif
|
||||
|
||||
#include "../../CGIncludes/Spine-Outline-Common.cginc"
|
||||
|
||||
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 = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
|
||||
_OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
|
||||
_OutlineSmoothness, _ThresholdEnd, _OutlineColor);
|
||||
|
||||
#ifdef SKELETON_GRAPHIC
|
||||
texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
return texColor;
|
||||
}
|
||||
|
||||
#endif // SPINE_OUTLINE_PASS_INCLUDED
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ec781e799f97504c8a418e168759f70
|
||||
timeCreated: 1574096529
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e8ed065898e65f4d9303492725fb912
|
||||
folderAsset: yes
|
||||
timeCreated: 1573829873
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,43 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e158cbe58baa093438feb3d691f3daba
|
||||
timeCreated: 1573817434
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,40 +0,0 @@
|
||||
// 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
|
||||
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10fab3f69a099be4391fe8a1ad880c65
|
||||
timeCreated: 1573828963
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,41 +0,0 @@
|
||||
// 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
|
||||
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 756be4f2f738f6c4583bb1c90e16bf0b
|
||||
timeCreated: 1573828964
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,52 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28b5cf4804845fe4b868531fd0bb81d5
|
||||
timeCreated: 1573817434
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,62 +0,0 @@
|
||||
Shader "Spine/Outline/OutlineOnly-ZWrite" {
|
||||
Properties {
|
||||
_Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1
|
||||
_ZWriteOffset ("Depth offset", Range(0,1)) = 0.01
|
||||
[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 "DepthOnly"
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
#include "../CGIncludes/Spine-DepthOnlyPass.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Outline"
|
||||
CGPROGRAM
|
||||
#pragma vertex vertOutline
|
||||
#pragma fragment fragOutline
|
||||
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
|
||||
#include "CGIncludes/Spine-Outline-Pass.cginc"
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Spine/Skeleton"
|
||||
CustomEditor "SpineShaderWithOutlineGUI"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 177da18c3d2e0aa4cb39990ea011973c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a42d52714848d64f8ff99dddb93500e
|
||||
folderAsset: yes
|
||||
timeCreated: 1563289150
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,126 +0,0 @@
|
||||
// - 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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45495790b394f894a967dbf44489b57b
|
||||
timeCreated: 1492385797
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,82 +0,0 @@
|
||||
// - 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
|
||||
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", 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 shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||
#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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fde05abf1f7be4b4da1caf8c8de1823a
|
||||
timeCreated: 1564082883
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,80 +0,0 @@
|
||||
// - 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
|
||||
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", 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 shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||
#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"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd83c75f51f5e23498ae22ffcdfe92c3
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,76 +0,0 @@
|
||||
#ifndef SHADER_MATHS_INCLUDED
|
||||
#define SHADER_MATHS_INCLUDED
|
||||
|
||||
#if defined(USE_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/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
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1de23de2025abe4a84ff2edd3f24491
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,417 +0,0 @@
|
||||
// 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.lightweight/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(USE_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// 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;
|
||||
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform half _BumpScale;
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform fixed _Cutoff;
|
||||
#endif
|
||||
|
||||
#define ALPHA_CLIP(pixel, color) clip((pixel.a * color.a) - _Cutoff);
|
||||
|
||||
#else
|
||||
|
||||
#define ALPHA_CLIP(pixel, color)
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Additive Slot blend mode
|
||||
// return unlit textureColor, alpha clip textureColor.a only
|
||||
//
|
||||
#if defined(_ALPHAPREMULTIPLY_ON)
|
||||
#define RETURN_UNLIT_IF_ADDITIVE_SLOT(textureColor, vertexColor) \
|
||||
if (vertexColor.a == 0 && (vertexColor.r || vertexColor.g || vertexColor.b)) {\
|
||||
ALPHA_CLIP(texureColor, fixed4(1, 1, 1, 1))\
|
||||
return texureColor * vertexColor;\
|
||||
}
|
||||
#else
|
||||
#define RETURN_UNLIT_IF_ADDITIVE_SLOT(textureColor, vertexColor)
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
// Color functions
|
||||
//
|
||||
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform fixed4 _Color;
|
||||
#endif
|
||||
|
||||
inline fixed4 calculateVertexColor(fixed4 color)
|
||||
{
|
||||
return color * _Color;
|
||||
}
|
||||
|
||||
#if defined(_COLOR_ADJUST)
|
||||
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform float _Hue;
|
||||
uniform float _Saturation;
|
||||
uniform float _Brightness;
|
||||
uniform fixed4 _OverlayColor;
|
||||
#endif
|
||||
|
||||
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 _TEXTURE_BLEND
|
||||
uniform sampler2D _BlendTex;
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform float _BlendAmount;
|
||||
#endif
|
||||
|
||||
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 defined(_COLOR_ADJUST)
|
||||
pixel = adjustColor(pixel);
|
||||
#endif // _COLOR_ADJUST
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
#if !defined(USE_LWRP) && !defined(USE_URP)
|
||||
uniform fixed4 _MainTex_ST;
|
||||
#endif
|
||||
|
||||
inline float2 calculateTextureCoord(float4 texcoord)
|
||||
{
|
||||
return TRANSFORM_TEX(texcoord, _MainTex);
|
||||
}
|
||||
|
||||
|
||||
#endif // SHADER_SHARED_INCLUDED
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c18c5cab567666f4d8c5b2bd4e61390b
|
||||
timeCreated: 1494092582
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user