This commit is contained in:
badlogic 2020-12-05 10:06:16 +01:00
commit 7ac47d191c
62 changed files with 843 additions and 232 deletions

View File

@ -248,6 +248,7 @@
* Added Inspector context menu functions `SkeletonRenderer - Add all BoundingBoxFollower GameObjects` and `SkeletonGraphic - Add all BoundingBoxFollowerGraphic GameObjects` that automatically generate bounding box follower GameObjects for every `BoundingBoxAttachment` for all skins of a skeleton.
* `GetRemappedClone()` now provides an additional parameter `pivotShiftsMeshUVCoords` for `MeshAttachment` to prevent uv shifts at a non-central Sprite pivot. This parameter defaults to `true` to maintain previous behaviour.
* `SkeletonRenderer` components now provide an additional update mode `Only Event Timelines` at the `Update When Invisible` property. This mode saves additional timeline updates compared to update mode `Everything Except Mesh`.
* Now all URP (Universal Render Pipeline) and LWRP (Lightweight Render Pipeline) shaders support SRP (Scriptable Render Pipeline) batching. See [Unity SRPBatcher documentation pages](https://docs.unity3d.com/Manual/SRPBatcher.html) for additional information.
* **Changes of default values**
* `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.

View File

@ -96,6 +96,7 @@ namespace Spine.Unity.Editor {
public void UpdateSkeletonData () {
preview.Clear();
InitializeEditor();
if (targetSkeletonDataAsset)
EditorUtility.SetDirty(targetSkeletonDataAsset);
}

View File

@ -324,9 +324,13 @@ namespace Spine.Unity.Editor {
#if SPINE_TK2D
IngestSpineProject(loadedAsset, null);
#else
string skeletonName = Path.GetFileNameWithoutExtension(skeletonPath);
var atlasesForSkeleton = FindAtlasesAtPath(dir);
atlasesForSkeleton.AddRange(newAtlases);
atlasesForSkeleton = atlasesForSkeleton.Union(newAtlases).ToList();
var requiredPaths = GetRequiredAtlasRegions(skeletonPath);
atlasesForSkeleton.Sort((a, b) => (
string.CompareOrdinal(b.name, skeletonName)
- string.CompareOrdinal(a.name, skeletonName)));
var atlasMatch = GetMatchingAtlas(requiredPaths, atlasesForSkeleton);
if (atlasMatch != null || requiredPaths.Count == 0) {
IngestSpineProject(loadedAsset, atlasMatch);

View File

@ -109,9 +109,13 @@ namespace Spine.Unity.Editor {
GetOrCreateSettings();
}
internal static SpinePreferences GetOrCreateSettings () {
var settings = AssetDatabase.LoadAssetAtPath<SpinePreferences>(SPINE_SETTINGS_ASSET_PATH);
static SpinePreferences settings = null;
internal static SpinePreferences GetOrCreateSettings () {
if (settings != null)
return settings;
settings = AssetDatabase.LoadAssetAtPath<SpinePreferences>(SPINE_SETTINGS_ASSET_PATH);
if (settings == null)
settings = FindSpinePreferences();
if (settings == null)

View File

@ -0,0 +1,42 @@
#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

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a8d610b87be4e82409e18a63a930d335
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,6 +7,8 @@
#include "UnityUI.cginc"
#endif
#include "../../CGIncludes/Spine-Outline-Common.cginc"
sampler2D _MainTex;
float _OutlineWidth;
@ -76,38 +78,9 @@ VertexOutput vertOutline(VertexInput v) {
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);
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);

View File

@ -74,7 +74,10 @@ inline half3 calculateWorldNormal(float3 normal)
#if defined(_NORMALMAP)
uniform sampler2D _BumpMap;
#if !defined(USE_LWRP) && !defined(USE_URP)
uniform half _BumpScale;
#endif
half3 UnpackScaleNormal(half4 packednormal, half bumpScale)
{
@ -225,7 +228,9 @@ inline fixed4 calculatePixel(fixed4 texureColor) : SV_Target
#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);
@ -239,7 +244,9 @@ uniform fixed _Cutoff;
// Color functions
//
#if !defined(USE_LWRP) && !defined(USE_URP)
uniform fixed4 _Color;
#endif
inline fixed4 calculateVertexColor(fixed4 color)
{
@ -248,10 +255,12 @@ inline fixed4 calculateVertexColor(fixed4 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)
{
@ -354,7 +363,9 @@ 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)
{
@ -379,11 +390,14 @@ inline fixed4 calculateTexturePixel(float2 texcoord)
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

View File

@ -33,7 +33,9 @@ struct VertexInput
// Normal functions
//
#if !defined(USE_LWRP) && !defined(USE_URP)
uniform float4 _FixedNormal = float4(0, 0, 1, 1);
#endif
inline float3 getFixedNormal()
{
@ -189,8 +191,11 @@ inline fixed3 applyRimLighting(fixed3 posWorld, fixed3 normalWorld, fixed4 pixel
#ifdef _EMISSION
uniform sampler2D _EmissionMap;
#if !defined(USE_LWRP) && !defined(USE_URP)
uniform fixed4 _EmissionColor;
uniform float _EmissionPower;
#endif
#define APPLY_EMISSION(diffuse, uv) diffuse += tex2D(_EmissionMap, uv).rgb * _EmissionColor.rgb * _EmissionPower;

View File

@ -1,41 +1,41 @@
#ifndef SPRITES_DEPTH_ONLY_PASS_LW_INCLUDED
#define SPRITES_DEPTH_ONLY_PASS_LW_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
struct AttributesSprite
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSprite
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
VaryingsSprite DepthOnlyVertexSprite(AttributesSprite input)
VaryingsSpine DepthOnlyVertex(AttributesSpine input)
{
VaryingsSprite output = (VaryingsSprite)0;
VaryingsSpine output = (VaryingsSpine)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
output.texcoordAndAlpha.a = input.vertexColor.a * _Color.a;
output.texcoordAndAlpha.a = input.vertexColor.a;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
return output;
}
half4 DepthOnlyFragmentSprite(VaryingsSprite input) : SV_TARGET
half4 DepthOnlyFragment(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
clip(texureColor.a* input.texcoordAndAlpha.a - _Cutoff);
return 0;
}

View File

@ -1,48 +1,18 @@
#ifndef LIGHTWEIGHT_LIT_INPUT_INCLUDED
#define LIGHTWEIGHT_LIT_INPUT_INCLUDED
#ifndef LW_LIT_INPUT_INCLUDED
#define LW_LIT_INPUT_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
////////////////////////////////////////
// Defines
//
#undef LIGHTMAP_ON
#if defined(_SPECULAR) || defined(_SPECULAR_GLOSSMAP)
#define SPECULAR
#endif
//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
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
#if defined(SPECULAR)
CBUFFER_START(UnityPerMaterial)
half _Metallic;
half _Glossiness;
half _GlossMapScale;
float4 _MainTex_ST;
half _Cutoff;
CBUFFER_END
sampler2D _MetallicGlossMap;
sampler2D _MainTex;
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;
}
#endif
#endif // LIGHTWEIGHT_INPUT_SURFACE_PBR_INCLUDED
#endif // LW_LIT_INPUT_INCLUDED

View File

@ -0,0 +1,26 @@
#ifndef LWRP_INPUT_OUTLINE_INCLUDED
#define LWRP_INPUT_OUTLINE_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
////////////////////////////////////////
// Defines
//
#undef LIGHTMAP_ON
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half _Cutoff;
float _OutlineWidth;
float4 _OutlineColor;
float4 _MainTex_TexelSize;
float _ThresholdEnd;
float _OutlineSmoothness;
float _OutlineMipLevel;
int _OutlineReferenceTexWidth;
CBUFFER_END
sampler2D _MainTex;
#endif // URP_INPUT_OUTLINE_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9cbef8e6101ae9e478dbb082dc9bb2f0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
#ifndef LIGHTWEIGHT_INPUT_SPRITE_INCLUDED
#define LIGHTWEIGHT_INPUT_SPRITE_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half4 _Color;
half _Cutoff;
half _ShadowAlphaCutoff;
half _Metallic;
half _Glossiness;
half _GlossMapScale;
half _BumpScale;
float _BlendAmount;
float _Hue;
float _Saturation;
float _Brightness;
half4 _OverlayColor;
half4 _EmissionColor;
float _EmissionPower;
float4 _FixedNormal;
CBUFFER_END
#endif // LIGHTWEIGHT_INPUT_SPRITE_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f1cab442214f2534a88ae31916cada93
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,43 @@
#ifndef SPINE_OUTLINE_PASS_LW_INCLUDED
#define SPINE_OUTLINE_PASS_LW_INCLUDED
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/Spine-Outline-Common.cginc"
struct VertexInput {
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float vertexColorAlpha : COLOR;
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutput vertOutline(VertexInput v) {
VertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = TransformObjectToHClip(v.positionOS.xyz);
o.uv = v.uv;
o.vertexColorAlpha = v.vertexColor.a;
return o;
}
float4 fragOutline(VertexOutput i) : SV_Target{
float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
_OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
_OutlineSmoothness, _ThresholdEnd, _OutlineColor);
return texColor;
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: dc29d6aca678ea942977c7b8f55ed9f1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,9 @@
#ifndef SKELETON_FORWARD_PASS_LW_INCLUDED
#define SKELETON_FORWARD_PASS_LW_INCLUDED
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
struct appdata {
float3 pos : POSITION;
half4 color : COLOR;
@ -28,8 +31,6 @@ VertexOutput vert(appdata v) {
return o;
}
sampler2D _MainTex;
half4 frag(VertexOutput i) : SV_Target{
float4 texColor = tex2D(_MainTex, i.uv0);

View File

@ -1,6 +1,10 @@
#ifndef SKELETONLIT_FORWARD_PASS_LW_INCLUDED
#define SKELETONLIT_FORWARD_PASS_LW_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
struct appdata {
float3 pos : POSITION;
float3 normal : NORMAL;
@ -66,8 +70,6 @@ VertexOutput vert(appdata v) {
return o;
}
sampler2D _MainTex;
half4 frag(VertexOutput i) : SV_Target{
half4 tex = tex2D(_MainTex, i.uv0);
half4 col;

View File

@ -1,7 +1,42 @@
#ifndef SKELETONLIT_SHADOW_CASTER_PASS_LW_INCLUDED
#define SKELETONLIT_SHADOW_CASTER_PASS_LW_INCLUDED
#include "Spine-Common-ShadowCasterPass-LW.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Shadows.hlsl"
float3 _LightDirection;
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
};
float4 GetShadowPositionHClip(AttributesSpine input)
{
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
#if UNITY_REVERSED_Z
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#else
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#endif
return positionCS;
}
VaryingsSpine ShadowPassVertexSkeletonLit(AttributesSpine input)
{
@ -16,8 +51,8 @@ VaryingsSpine ShadowPassVertexSkeletonLit(AttributesSpine input)
half4 ShadowPassFragmentSkeletonLit(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
clip(texureColor.a* input.texcoordAndAlpha.a - _Cutoff);
return 0;
}

View File

@ -0,0 +1,39 @@
#ifndef LW_SPRITE_COMMON_INCLUDED
#define LW_SPRITE_COMMON_INCLUDED
#undef LIGHTMAP_ON
#if defined(_SPECULAR) || defined(_SPECULAR_GLOSSMAP)
#define SPECULAR
#endif
//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
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
#if defined(SPECULAR)
sampler2D _MetallicGlossMap;
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;
}
#endif
#endif // LW_SPRITE_COMMON_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 678ff30f3610c7d488dffe8e3a9992ea
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
#ifndef SPRITES_DEPTH_ONLY_PASS_LW_INCLUDED
#define SPRITES_DEPTH_ONLY_PASS_LW_INCLUDED
#include "CGIncludes/Spine-Sprite-Common-LW.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
struct AttributesSprite
{
float4 positionOS : POSITION;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSprite
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
VaryingsSprite DepthOnlyVertexSprite(AttributesSprite input)
{
VaryingsSprite output = (VaryingsSprite)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
output.texcoordAndAlpha.a = input.vertexColor.a * _Color.a;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
return output;
}
half4 DepthOnlyFragmentSprite(VaryingsSprite input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
clip(texureColor.a* input.texcoordAndAlpha.a - _Cutoff);
return 0;
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 59133a5e2cee2c845aadaf57d34067d2
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +1,8 @@
#ifndef VERTEX_LIT_FORWARD_PASS_LW_INCLUDED
#define VERTEX_LIT_FORWARD_PASS_LW_INCLUDED
#include "CGIncludes/Spine-Sprite-Common-LW.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
#include "SpineCoreShaders/SpriteLighting.cginc"
////////////////////////////////////////

View File

@ -1,9 +1,41 @@
#ifndef SPRITES_SHADOW_CASTER_PASS_LW_INCLUDED
#define SPRITES_SHADOW_CASTER_PASS_LW_INCLUDED
#include "Spine-Common-ShadowCasterPass-LW.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Shadows.hlsl"
uniform fixed _ShadowAlphaCutoff;
float3 _LightDirection;
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
};
float4 GetShadowPositionHClip(AttributesSpine input)
{
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
#if UNITY_REVERSED_Z
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#else
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#endif
return positionCS;
}
VaryingsSpine ShadowPassVertexSprite(AttributesSpine input)
{
@ -16,10 +48,12 @@ VaryingsSpine ShadowPassVertexSprite(AttributesSpine input)
return output;
}
#include "SpineCoreShaders/ShaderShared.cginc"
half4 ShadowPassFragmentSprite(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _ShadowAlphaCutoff);
clip(texureColor.a* input.texcoordAndAlpha.a - _ShadowAlphaCutoff);
return 0;
}

View File

@ -0,0 +1,2 @@
// Adapt this path accordingly if you have unpacked the Spine directory to another location.
#include "Assets/Spine/Runtime/spine-unity/Shaders/CGIncludes/Spine-Outline-Common.cginc"

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 22b696908e97db04587317413f8b88b1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,7 +29,29 @@ Shader "Lightweight Render Pipeline/Spine/Outline/Skeleton-OutlineOnly" {
Pass Keep
}
UsePass "Spine/Outline/Skeleton/OUTLINE"
Pass {
Name "Outline"
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../CGIncludes/Spine-Input-Outline-LW.hlsl"
#include "../CGIncludes/Spine-Outline-Pass-LW.hlsl"
ENDHLSL
}
}
FallBack "Hidden/InternalErrorShader"

View File

@ -60,13 +60,11 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton" {
#undef LIGHTMAP_ON
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "CGIncludes/Spine-Input-LW.hlsl"
#include "CGIncludes/Spine-Skeleton-ForwardPass-LW.hlsl"
ENDHLSL
}
@ -98,9 +96,6 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton" {
#pragma vertex ShadowPassVertexSkeletonLit
#pragma fragment ShadowPassFragmentSkeletonLit
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/ShadowCasterPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
@ -126,8 +121,8 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton" {
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex DepthOnlyVertexSprite
#pragma fragment DepthOnlyFragmentSprite
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
// -------------------------------------
// Material Keywords
@ -138,9 +133,6 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton" {
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/DepthOnlyPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3

View File

@ -68,13 +68,11 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
#undef LIGHTMAP_ON
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "CGIncludes/Spine-Input-LW.hlsl"
#include "CGIncludes/Spine-SkeletonLit-ForwardPass-LW.hlsl"
ENDHLSL
}
@ -106,9 +104,6 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
#pragma vertex ShadowPassVertexSkeletonLit
#pragma fragment ShadowPassFragmentSkeletonLit
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/ShadowCasterPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
@ -134,8 +129,8 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex DepthOnlyVertexSprite
#pragma fragment DepthOnlyFragmentSprite
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
// -------------------------------------
// Material Keywords
@ -146,9 +141,6 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/DepthOnlyPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3

View File

@ -127,11 +127,7 @@ Shader "Lightweight Render Pipeline/Spine/Sprite"
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "CGIncludes/Spine-Input-LW.hlsl"
#include "CGIncludes/Spine-Input-Sprite-LW.hlsl"
#include "CGIncludes/Spine-Sprite-ForwardPass-LW.hlsl"
ENDHLSL
}
@ -163,14 +159,11 @@ Shader "Lightweight Render Pipeline/Spine/Sprite"
#pragma vertex ShadowPassVertexSprite
#pragma fragment ShadowPassFragmentSprite
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/ShadowCasterPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "CGIncludes/Spine-Input-LW.hlsl"
#include "CGIncludes/Spine-Input-Sprite-LW.hlsl"
#include "CGIncludes/Spine-Sprite-ShadowCasterPass-LW.hlsl"
ENDHLSL
}
@ -202,15 +195,12 @@ Shader "Lightweight Render Pipeline/Spine/Sprite"
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/DepthOnlyPass.hlsl"
#define USE_LWRP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "CGIncludes/Spine-Input-LW.hlsl"
#include "CGIncludes/Spine-DepthOnlyPass-LW.hlsl"
#include "CGIncludes/Spine-Input-Sprite-LW.hlsl"
#include "CGIncludes/Spine-Sprite-DepthOnlyPass-LW.hlsl"
ENDHLSL
}
}

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.lwrp-shaders",
"displayName": "Spine Lightweight RP Shaders",
"description": "This plugin provides lightweight render pipeline (LWRP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "3.8.0",
"version": "3.8.1",
"unity": "2019.1",
"author": {
"name": "Esoteric Software",

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.lwrp-shaders",
"displayName": "Spine Lightweight RP Shaders",
"description": "This plugin provides lightweight render pipeline (LWRP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "3.8.0",
"version": "3.8.1",
"unity": "2019.2",
"author": {
"name": "Esoteric Software",

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.lwrp-shaders",
"displayName": "Spine Lightweight RP Shaders",
"description": "This plugin provides lightweight render pipeline (LWRP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "3.8.0",
"version": "3.8.1",
"unity": "2019.1",
"author": {
"name": "Esoteric Software",

View File

@ -104,6 +104,7 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
#include "../Include/Spine-Input-Sprite-URP.hlsl"
#include "Include/Spine-Sprite-StandardPass-URP-2D.hlsl"
ENDHLSL
}
@ -139,6 +140,7 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-Sprite-URP.hlsl"
#include "Include/Spine-Sprite-NormalsPass-URP-2D.hlsl"
ENDHLSL

View File

@ -1,7 +1,9 @@
#ifndef COMMON_SHADOW_CASTER_PASS_URP_INCLUDED
#define COMMON_SHADOW_CASTER_PASS_URP_INCLUDED
#include "SpineCoreShaders/ShaderShared.cginc"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
float3 _LightDirection;
struct AttributesSpine
{

View File

@ -1,40 +1,40 @@
#ifndef SPRITES_DEPTH_ONLY_PASS_URP_INCLUDED
#define SPRITES_DEPTH_ONLY_PASS_URP_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
struct AttributesSprite
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSprite
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
VaryingsSprite DepthOnlyVertexSprite(AttributesSprite input)
VaryingsSpine DepthOnlyVertex(AttributesSpine input)
{
VaryingsSprite output = (VaryingsSprite)0;
VaryingsSpine output = (VaryingsSpine)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
output.texcoordAndAlpha.a = input.vertexColor.a * _Color.a;
output.texcoordAndAlpha.a = input.vertexColor.a;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
return output;
}
half4 DepthOnlyFragmentSprite(VaryingsSprite input) : SV_TARGET
half4 DepthOnlyFragment(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
return 0;
}

View File

@ -0,0 +1,26 @@
#ifndef URP_INPUT_OUTLINE_INCLUDED
#define URP_INPUT_OUTLINE_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
////////////////////////////////////////
// Defines
//
#undef LIGHTMAP_ON
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half _Cutoff;
float _OutlineWidth;
float4 _OutlineColor;
float4 _MainTex_TexelSize;
float _ThresholdEnd;
float _OutlineSmoothness;
float _OutlineMipLevel;
int _OutlineReferenceTexWidth;
CBUFFER_END
sampler2D _MainTex;
#endif // URP_INPUT_OUTLINE_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fbcfa8e1a739e2b4d9307f6c0980c50f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
#ifndef URP_INPUT_SPRITE_INCLUDED
#define URP_INPUT_SPRITE_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half4 _Color;
half _Cutoff;
half _ShadowAlphaCutoff;
half _Metallic;
half _Glossiness;
half _GlossMapScale;
half _BumpScale;
float _BlendAmount;
float _Hue;
float _Saturation;
float _Brightness;
half4 _OverlayColor;
half4 _EmissionColor;
float _EmissionPower;
float4 _FixedNormal;
CBUFFER_END
#endif // URP_INPUT_SPRITE_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7cb02894258b6c249ad73b7869086876
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,48 +1,18 @@
#ifndef URP_LIT_INPUT_INCLUDED
#define URP_LIT_INPUT_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
////////////////////////////////////////
// Defines
//
#undef LIGHTMAP_ON
#if defined(_SPECULAR) || defined(_SPECULAR_GLOSSMAP)
#define SPECULAR
#endif
//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
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
#if defined(SPECULAR)
CBUFFER_START(UnityPerMaterial)
half _Metallic;
half _Glossiness;
half _GlossMapScale;
float4 _MainTex_ST;
half _Cutoff;
CBUFFER_END
sampler2D _MetallicGlossMap;
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;
}
#endif
sampler2D _MainTex;
#endif // URP_LIT_INPUT_INCLUDED

View File

@ -0,0 +1,43 @@
#ifndef SPINE_OUTLINE_PASS_URP_INCLUDED
#define SPINE_OUTLINE_PASS_URP_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/Spine-Outline-Common.cginc"
struct VertexInput {
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float vertexColorAlpha : COLOR;
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutput vertOutline(VertexInput v) {
VertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = TransformObjectToHClip(v.positionOS.xyz);
o.uv = v.uv;
o.vertexColorAlpha = v.vertexColor.a;
return o;
}
float4 fragOutline(VertexOutput i) : SV_Target{
float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
_OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
_OutlineSmoothness, _ThresholdEnd, _OutlineColor);
return texColor;
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6702be883c5f0ef439d7d9ad87d0b84b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,9 @@
#ifndef SKELETON_FORWARD_PASS_URP_INCLUDED
#define SKELETON_FORWARD_PASS_URP_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
struct appdata {
float3 pos : POSITION;
half4 color : COLOR;
@ -28,8 +31,6 @@ VertexOutput vert(appdata v) {
return o;
}
sampler2D _MainTex;
half4 frag(VertexOutput i) : SV_Target{
float4 texColor = tex2D(_MainTex, i.uv0);

View File

@ -1,6 +1,10 @@
#ifndef SKELETONLIT_FORWARD_PASS_URP_INCLUDED
#define SKELETONLIT_FORWARD_PASS_URP_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
struct appdata {
float3 pos : POSITION;
float3 normal : NORMAL;
@ -66,8 +70,6 @@ VertexOutput vert(appdata v) {
return o;
}
sampler2D _MainTex;
half4 frag(VertexOutput i) : SV_Target{
half4 tex = tex2D(_MainTex, i.uv0);
half4 col;

View File

@ -1,7 +1,42 @@
#ifndef SKELETONLIT_SHADOW_CASTER_PASS_URP_INCLUDED
#define SKELETONLIT_SHADOW_CASTER_PASS_URP_INCLUDED
#include "Spine-Common-ShadowCasterPass-URP.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
float3 _LightDirection;
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
};
float4 GetShadowPositionHClip(AttributesSpine input)
{
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
#if UNITY_REVERSED_Z
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#else
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#endif
return positionCS;
}
VaryingsSpine ShadowPassVertexSkeletonLit(AttributesSpine input)
{
@ -16,7 +51,7 @@ VaryingsSpine ShadowPassVertexSkeletonLit(AttributesSpine input)
half4 ShadowPassFragmentSkeletonLit(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
return 0;
}

View File

@ -0,0 +1,39 @@
#ifndef URP_SPRITE_COMMON_INCLUDED
#define URP_SPRITE_COMMON_INCLUDED
#undef LIGHTMAP_ON
#if defined(_SPECULAR) || defined(_SPECULAR_GLOSSMAP)
#define SPECULAR
#endif
//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
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/ShaderShared.cginc"
#if defined(SPECULAR)
sampler2D _MetallicGlossMap;
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;
}
#endif
#endif // URP_SPRITE_COMMON_INCLUDED

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 46ef6e1b09e1bc04885eb905a8f2822d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
#ifndef SPRITES_DEPTH_ONLY_PASS_URP_INCLUDED
#define SPRITES_DEPTH_ONLY_PASS_URP_INCLUDED
#include "Include/Spine-Sprite-Common-URP.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct AttributesSprite
{
float4 positionOS : POSITION;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSprite
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
VaryingsSprite DepthOnlyVertexSprite(AttributesSprite input)
{
VaryingsSprite output = (VaryingsSprite)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
output.texcoordAndAlpha.a = input.vertexColor.a * _Color.a;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
return output;
}
half4 DepthOnlyFragmentSprite(VaryingsSprite input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);
clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
return 0;
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9e6e6f2288b792e4aa0db167249e73bd
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +1,8 @@
#ifndef VERTEX_LIT_FORWARD_PASS_URP_INCLUDED
#define VERTEX_LIT_FORWARD_PASS_URP_INCLUDED
#include "Include/Spine-Sprite-Common-URP.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "SpineCoreShaders/SpriteLighting.cginc"
#if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS) || defined(MAIN_LIGHT_CALCULATE_SHADOWS)

View File

@ -1,9 +1,41 @@
#ifndef SPRITES_SHADOW_CASTER_PASS_URP_INCLUDED
#define SPRITES_SHADOW_CASTER_PASS_URP_INCLUDED
#include "Spine-Common-ShadowCasterPass-URP.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
uniform fixed _ShadowAlphaCutoff;
float3 _LightDirection;
struct AttributesSpine
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VaryingsSpine
{
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
};
float4 GetShadowPositionHClip(AttributesSpine input)
{
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
#if UNITY_REVERSED_Z
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#else
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
#endif
return positionCS;
}
VaryingsSpine ShadowPassVertexSprite(AttributesSpine input)
{
@ -16,6 +48,8 @@ VaryingsSpine ShadowPassVertexSprite(AttributesSpine input)
return output;
}
#include "SpineCoreShaders/ShaderShared.cginc"
half4 ShadowPassFragmentSprite(VaryingsSpine input) : SV_TARGET
{
fixed4 texureColor = calculateTexturePixel(input.texcoordAndAlpha.xy);

View File

@ -0,0 +1,2 @@
// Adapt this path accordingly if you have unpacked the Spine directory to another location.
#include "Assets/Spine/Runtime/spine-unity/Shaders/CGIncludes/Spine-Outline-Common.cginc"

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 13cee1d5ffe7f304a9f5ff15ef07c3bc
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,7 +29,29 @@ Shader "Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly" {
Pass Keep
}
UsePass "Spine/Outline/Skeleton/OUTLINE"
Pass {
Name "Outline"
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-Outline-URP.hlsl"
#include "../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
}
FallBack "Hidden/InternalErrorShader"

View File

@ -58,13 +58,11 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
#undef LIGHTMAP_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Include/Spine-Input-URP.hlsl"
#include "Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
@ -96,9 +94,6 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
#pragma vertex ShadowPassVertexSkeletonLit
#pragma fragment ShadowPassFragmentSkeletonLit
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
@ -123,8 +118,8 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma vertex DepthOnlyVertexSprite
#pragma fragment DepthOnlyFragmentSprite
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
// -------------------------------------
// Material Keywords
@ -135,9 +130,6 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3

View File

@ -62,13 +62,11 @@
#undef LIGHTMAP_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Include/Spine-Input-URP.hlsl"
#include "Include/Spine-SkeletonLit-ForwardPass-URP.hlsl"
ENDHLSL
}
@ -100,9 +98,6 @@
#pragma vertex ShadowPassVertexSkeletonLit
#pragma fragment ShadowPassFragmentSkeletonLit
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
@ -127,8 +122,8 @@
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma vertex DepthOnlyVertexSprite
#pragma fragment DepthOnlyFragmentSprite
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
// -------------------------------------
// Material Keywords
@ -139,9 +134,6 @@
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3

View File

@ -128,11 +128,7 @@ Shader "Universal Render Pipeline/Spine/Sprite"
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Include/Spine-Input-URP.hlsl"
#include "Include/Spine-Input-Sprite-URP.hlsl"
#include "Include/Spine-Sprite-ForwardPass-URP.hlsl"
ENDHLSL
}
@ -164,14 +160,11 @@ Shader "Universal Render Pipeline/Spine/Sprite"
#pragma vertex ShadowPassVertexSprite
#pragma fragment ShadowPassFragmentSprite
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Include/Spine-Input-URP.hlsl"
#include "Include/Spine-Input-Sprite-URP.hlsl"
#include "Include/Spine-Sprite-ShadowCasterPass-URP.hlsl"
ENDHLSL
}
@ -202,15 +195,12 @@ Shader "Universal Render Pipeline/Spine/Sprite"
// GPU Instancing
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "Include/Spine-Input-URP.hlsl"
#include "Include/Spine-DepthOnlyPass-URP.hlsl"
#include "Include/Spine-Input-Sprite-URP.hlsl"
#include "Include/Spine-Sprite-DepthOnlyPass-URP.hlsl"
ENDHLSL
}
}

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.urp-shaders",
"displayName": "Spine Universal RP Shaders",
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "3.8.0",
"version": "3.8.1",
"unity": "2019.3",
"author": {
"name": "Esoteric Software",