812 lines
31 KiB
Plaintext
812 lines
31 KiB
Plaintext
// Made with Amplify Shader Editor v1.9.5.1
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "Soullies/EdgeShader"
|
|
{
|
|
Properties
|
|
{
|
|
[HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
|
|
[HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
|
|
_EdgeValue("EdgeValue", Range( 0 , 1)) = 0.2667609
|
|
[HDR]_ImageColor("ImageColor", Color) = (0,0,0,0)
|
|
_Width("Width", Range( 0 , 2)) = 0
|
|
_Opacity("Opacity", Float) = 0
|
|
[Toggle(_CIRCLE_ON_ON)] _circle_ON("circle_ON", Float) = 0
|
|
|
|
[HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
LOD 0
|
|
|
|
|
|
|
|
Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" "UniversalMaterialType"="Lit" "ShaderGraphShader"="true" }
|
|
|
|
Cull Off
|
|
HLSLINCLUDE
|
|
#pragma target 3.0
|
|
#pragma prefer_hlslcc gles
|
|
// ensure rendering platforms toggle list is visible
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
|
|
ENDHLSL
|
|
|
|
|
|
Pass
|
|
{
|
|
Name "Sprite Lit"
|
|
Tags { "LightMode"="Universal2D" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140009
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_0
|
|
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_1
|
|
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_2
|
|
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_3
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
|
|
#define SHADERPASS SHADERPASS_SPRITELIT
|
|
#define SHADERPASS_SPRITELIT
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
|
|
|
|
#if USE_SHAPE_LIGHT_TYPE_0
|
|
SHAPE_LIGHT(0)
|
|
#endif
|
|
|
|
#if USE_SHAPE_LIGHT_TYPE_1
|
|
SHAPE_LIGHT(1)
|
|
#endif
|
|
|
|
#if USE_SHAPE_LIGHT_TYPE_2
|
|
SHAPE_LIGHT(2)
|
|
#endif
|
|
|
|
#if USE_SHAPE_LIGHT_TYPE_3
|
|
SHAPE_LIGHT(3)
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl"
|
|
|
|
#pragma shader_feature_local _CIRCLE_ON_ON
|
|
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ImageColor;
|
|
float _EdgeValue;
|
|
float _Width;
|
|
float _Opacity;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : TEXCOORD0;
|
|
float4 color : TEXCOORD1;
|
|
float4 screenPosition : TEXCOORD2;
|
|
float3 positionWS : TEXCOORD3;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex);
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
|
|
|
|
VertexOutput vert ( VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
|
|
o.ase_color = v.color;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.positionOS.xyz = vertexValue;
|
|
#else
|
|
v.positionOS.xyz += vertexValue;
|
|
#endif
|
|
v.normal = v.normal;
|
|
v.tangent.xyz = v.tangent.xyz;
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
|
|
|
|
o.texCoord0 = v.uv0;
|
|
o.color = v.color;
|
|
o.positionCS = vertexInput.positionCS;
|
|
o.screenPosition = vertexInput.positionNDC;
|
|
o.positionWS = vertexInput.positionWS;
|
|
return o;
|
|
}
|
|
|
|
half4 frag ( VertexOutput IN ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
float3 positionWS = IN.positionWS.xyz;
|
|
|
|
float temp_output_79_0 = ( _EdgeValue * _Width );
|
|
float2 temp_output_51_0 = ( IN.texCoord0.xy - float2( 0.5,0.5 ) );
|
|
float2 break104 = temp_output_51_0;
|
|
#ifdef _CIRCLE_ON_ON
|
|
float staticSwitch101 = distance( temp_output_51_0 , float2( 0,0 ) );
|
|
#else
|
|
float staticSwitch101 = ( abs( break104.x ) + abs( break104.y ) );
|
|
#endif
|
|
float temp_output_75_0 = ( staticSwitch101 / _EdgeValue );
|
|
float smoothstepResult72 = smoothstep( temp_output_79_0 , temp_output_79_0 , temp_output_75_0);
|
|
float smoothstepResult69 = smoothstep( 0.95 , 0.95 , temp_output_75_0);
|
|
float4 break89 = _ImageColor;
|
|
float4 appendResult90 = (float4(break89.r , break89.g , break89.b , _Opacity));
|
|
|
|
float4 Color = ( saturate( ( smoothstepResult72 - smoothstepResult69 ) ) * IN.ase_color * appendResult90 );
|
|
float4 Mask = float4(1,1,1,1);
|
|
float3 Normal = float3( 0, 0, 1 );
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.texCoord0.xy);
|
|
Color.a = lerp ( Color.a, alpha.r, _EnableAlphaTexture);
|
|
#endif
|
|
|
|
Color *= IN.color;
|
|
|
|
SurfaceData2D surfaceData;
|
|
InitializeSurfaceData(Color.rgb, Color.a, Mask, surfaceData);
|
|
InputData2D inputData;
|
|
InitializeInputData(IN.texCoord0.xy, half2(IN.screenPosition.xy / IN.screenPosition.w), inputData);
|
|
SETUP_DEBUG_DATA_2D(inputData, positionWS);
|
|
return CombinedShapeLightShared(surfaceData, inputData);
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Sprite Normal"
|
|
Tags { "LightMode"="NormalsRendering" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140009
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define SHADERPASS SHADERPASS_SPRITENORMAL
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
#define ASE_NEEDS_FRAG_COLOR
|
|
#pragma shader_feature_local _CIRCLE_ON_ON
|
|
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ImageColor;
|
|
float _EdgeValue;
|
|
float _Width;
|
|
float _Opacity;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : TEXCOORD0;
|
|
float4 color : TEXCOORD1;
|
|
float3 normalWS : TEXCOORD2;
|
|
float4 tangentWS : TEXCOORD3;
|
|
float3 bitangentWS : TEXCOORD4;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
|
|
VertexOutput vert ( VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.positionOS.xyz = vertexValue;
|
|
#else
|
|
v.positionOS.xyz += vertexValue;
|
|
#endif
|
|
v.normal = v.normal;
|
|
v.tangent.xyz = v.tangent.xyz;
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
|
|
|
|
o.texCoord0 = v.uv0;
|
|
o.color = v.color;
|
|
o.positionCS = vertexInput.positionCS;
|
|
|
|
float3 normalWS = TransformObjectToWorldNormal( v.normal );
|
|
o.normalWS = -GetViewForwardDir();
|
|
float4 tangentWS = float4( TransformObjectToWorldDir( v.tangent.xyz ), v.tangent.w );
|
|
o.tangentWS = normalize( tangentWS );
|
|
half crossSign = (tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
|
|
o.bitangentWS = crossSign * cross( normalWS, tangentWS.xyz ) * tangentWS.w;
|
|
return o;
|
|
}
|
|
|
|
half4 frag ( VertexOutput IN ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
|
|
float temp_output_79_0 = ( _EdgeValue * _Width );
|
|
float2 temp_output_51_0 = ( IN.texCoord0.xy - float2( 0.5,0.5 ) );
|
|
float2 break104 = temp_output_51_0;
|
|
#ifdef _CIRCLE_ON_ON
|
|
float staticSwitch101 = distance( temp_output_51_0 , float2( 0,0 ) );
|
|
#else
|
|
float staticSwitch101 = ( abs( break104.x ) + abs( break104.y ) );
|
|
#endif
|
|
float temp_output_75_0 = ( staticSwitch101 / _EdgeValue );
|
|
float smoothstepResult72 = smoothstep( temp_output_79_0 , temp_output_79_0 , temp_output_75_0);
|
|
float smoothstepResult69 = smoothstep( 0.95 , 0.95 , temp_output_75_0);
|
|
float4 break89 = _ImageColor;
|
|
float4 appendResult90 = (float4(break89.r , break89.g , break89.b , _Opacity));
|
|
|
|
float4 Color = ( saturate( ( smoothstepResult72 - smoothstepResult69 ) ) * IN.color * appendResult90 );
|
|
float3 Normal = float3( 0, 0, 1 );
|
|
|
|
Color *= IN.color;
|
|
|
|
return NormalsRenderingShared( Color, Normal, IN.tangentWS.xyz, IN.bitangentWS, IN.normalWS);
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Sprite Forward"
|
|
Tags { "LightMode"="UniversalForward" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140009
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define SHADERPASS SHADERPASS_SPRITEFORWARD
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
|
|
|
|
#define ASE_NEEDS_FRAG_COLOR
|
|
#pragma shader_feature_local _CIRCLE_ON_ON
|
|
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ImageColor;
|
|
float _EdgeValue;
|
|
float _Width;
|
|
float _Opacity;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : TEXCOORD0;
|
|
float4 color : TEXCOORD1;
|
|
float3 positionWS : TEXCOORD2;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex );
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
|
|
|
|
VertexOutput vert( VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID( v );
|
|
UNITY_TRANSFER_INSTANCE_ID( v, o );
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.positionOS.xyz = vertexValue;
|
|
#else
|
|
v.positionOS.xyz += vertexValue;
|
|
#endif
|
|
v.normal = v.normal;
|
|
v.tangent.xyz = v.tangent.xyz;
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs( v.positionOS.xyz );
|
|
|
|
o.texCoord0 = v.uv0;
|
|
o.color = v.color;
|
|
o.positionCS = vertexInput.positionCS;
|
|
o.positionWS = vertexInput.positionWS;
|
|
|
|
return o;
|
|
}
|
|
|
|
half4 frag( VertexOutput IN ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
|
|
float3 positionWS = IN.positionWS.xyz;
|
|
|
|
float temp_output_79_0 = ( _EdgeValue * _Width );
|
|
float2 temp_output_51_0 = ( IN.texCoord0.xy - float2( 0.5,0.5 ) );
|
|
float2 break104 = temp_output_51_0;
|
|
#ifdef _CIRCLE_ON_ON
|
|
float staticSwitch101 = distance( temp_output_51_0 , float2( 0,0 ) );
|
|
#else
|
|
float staticSwitch101 = ( abs( break104.x ) + abs( break104.y ) );
|
|
#endif
|
|
float temp_output_75_0 = ( staticSwitch101 / _EdgeValue );
|
|
float smoothstepResult72 = smoothstep( temp_output_79_0 , temp_output_79_0 , temp_output_75_0);
|
|
float smoothstepResult69 = smoothstep( 0.95 , 0.95 , temp_output_75_0);
|
|
float4 break89 = _ImageColor;
|
|
float4 appendResult90 = (float4(break89.r , break89.g , break89.b , _Opacity));
|
|
|
|
float4 Color = ( saturate( ( smoothstepResult72 - smoothstepResult69 ) ) * IN.color * appendResult90 );
|
|
|
|
#if defined(DEBUG_DISPLAY)
|
|
SurfaceData2D surfaceData;
|
|
InitializeSurfaceData(Color.rgb, Color.a, surfaceData);
|
|
InputData2D inputData;
|
|
InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData);
|
|
half4 debugColor = 0;
|
|
|
|
SETUP_DEBUG_DATA_2D(inputData, positionWS);
|
|
|
|
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
|
|
{
|
|
return debugColor;
|
|
}
|
|
#endif
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy );
|
|
Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture );
|
|
#endif
|
|
|
|
Color *= IN.color;
|
|
|
|
return Color;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "SceneSelectionPass"
|
|
Tags { "LightMode"="SceneSelectionPass" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140009
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define FEATURES_GRAPH_VERTEX
|
|
#define SHADERPASS SHADERPASS_DEPTHONLY
|
|
#define SCENESELECTIONPASS 1
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
#pragma shader_feature_local _CIRCLE_ON_ON
|
|
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ImageColor;
|
|
float _EdgeValue;
|
|
float _Width;
|
|
float _Opacity;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
|
|
|
|
VertexOutput vert(VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
o.ase_texcoord.xy = v.ase_texcoord.xy;
|
|
o.ase_color = v.ase_color;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord.zw = 0;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.positionOS.xyz = vertexValue;
|
|
#else
|
|
v.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
|
|
float3 positionWS = TransformObjectToWorld(v.positionOS);
|
|
o.positionCS = TransformWorldToHClip(positionWS);
|
|
|
|
return o;
|
|
}
|
|
|
|
half4 frag(VertexOutput IN ) : SV_TARGET
|
|
{
|
|
float temp_output_79_0 = ( _EdgeValue * _Width );
|
|
float2 temp_output_51_0 = ( IN.ase_texcoord.xy - float2( 0.5,0.5 ) );
|
|
float2 break104 = temp_output_51_0;
|
|
#ifdef _CIRCLE_ON_ON
|
|
float staticSwitch101 = distance( temp_output_51_0 , float2( 0,0 ) );
|
|
#else
|
|
float staticSwitch101 = ( abs( break104.x ) + abs( break104.y ) );
|
|
#endif
|
|
float temp_output_75_0 = ( staticSwitch101 / _EdgeValue );
|
|
float smoothstepResult72 = smoothstep( temp_output_79_0 , temp_output_79_0 , temp_output_75_0);
|
|
float smoothstepResult69 = smoothstep( 0.95 , 0.95 , temp_output_75_0);
|
|
float4 break89 = _ImageColor;
|
|
float4 appendResult90 = (float4(break89.r , break89.g , break89.b , _Opacity));
|
|
|
|
float4 Color = ( saturate( ( smoothstepResult72 - smoothstepResult69 ) ) * IN.ase_color * appendResult90 );
|
|
|
|
half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
|
|
return outColor;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "ScenePickingPass"
|
|
Tags { "LightMode"="Picking" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140009
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define FEATURES_GRAPH_VERTEX
|
|
#define SHADERPASS SHADERPASS_DEPTHONLY
|
|
#define SCENEPICKINGPASS 1
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
#pragma shader_feature_local _CIRCLE_ON_ON
|
|
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ImageColor;
|
|
float _EdgeValue;
|
|
float _Width;
|
|
float _Opacity;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
float4 _SelectionID;
|
|
|
|
|
|
VertexOutput vert(VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
o.ase_texcoord.xy = v.ase_texcoord.xy;
|
|
o.ase_color = v.ase_color;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord.zw = 0;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.positionOS.xyz = vertexValue;
|
|
#else
|
|
v.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
|
|
float3 positionWS = TransformObjectToWorld(v.positionOS);
|
|
o.positionCS = TransformWorldToHClip(positionWS);
|
|
|
|
return o;
|
|
}
|
|
|
|
half4 frag(VertexOutput IN ) : SV_TARGET
|
|
{
|
|
float temp_output_79_0 = ( _EdgeValue * _Width );
|
|
float2 temp_output_51_0 = ( IN.ase_texcoord.xy - float2( 0.5,0.5 ) );
|
|
float2 break104 = temp_output_51_0;
|
|
#ifdef _CIRCLE_ON_ON
|
|
float staticSwitch101 = distance( temp_output_51_0 , float2( 0,0 ) );
|
|
#else
|
|
float staticSwitch101 = ( abs( break104.x ) + abs( break104.y ) );
|
|
#endif
|
|
float temp_output_75_0 = ( staticSwitch101 / _EdgeValue );
|
|
float smoothstepResult72 = smoothstep( temp_output_79_0 , temp_output_79_0 , temp_output_75_0);
|
|
float smoothstepResult69 = smoothstep( 0.95 , 0.95 , temp_output_75_0);
|
|
float4 break89 = _ImageColor;
|
|
float4 appendResult90 = (float4(break89.r , break89.g , break89.b , _Opacity));
|
|
|
|
float4 Color = ( saturate( ( smoothstepResult72 - smoothstepResult69 ) ) * IN.ase_color * appendResult90 );
|
|
half4 outColor = _SelectionID;
|
|
return outColor;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
}
|
|
CustomEditor "ASEMaterialInspector"
|
|
Fallback "Hidden/InternalErrorShader"
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=19501
|
|
Node;AmplifyShaderEditor.TexCoordVertexDataNode;52;-2672,432;Inherit;True;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.Vector2Node;50;-2672,656;Inherit;False;Constant;_Vector2;Vector 0;0;0;Create;True;0;0;0;False;0;False;0.5,0.5;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.SimpleSubtractOpNode;51;-2432,544;Inherit;True;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.BreakToComponentsNode;104;-2112,576;Inherit;True;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
|
|
Node;AmplifyShaderEditor.AbsOpNode;60;-1808,576;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.AbsOpNode;67;-1808,672;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;61;-1616,544;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DistanceOpNode;98;-1744,256;Inherit;True;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.StaticSwitch;101;-1328,544;Inherit;False;Property;_circle_ON;circle_ON;4;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;87;-1216,976;Inherit;False;Property;_Width;Width;2;0;Create;True;0;0;0;False;0;False;0;1.6;0;2;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;68;-1184,784;Inherit;False;Property;_EdgeValue;EdgeValue;0;0;Create;True;0;0;0;False;0;False;0.2667609;0.4832675;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleDivideOpNode;75;-880,640;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;79;-896,880;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.95;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode;86;-432,1008;Inherit;False;Property;_ImageColor;ImageColor;1;1;[HDR];Create;True;0;0;0;False;0;False;0,0,0,0;0.2206376,0.3690597,1.492826,1;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
|
|
Node;AmplifyShaderEditor.SmoothstepOpNode;72;-624,752;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.44;False;2;FLOAT;0.44;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SmoothstepOpNode;69;-624,512;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.95;False;2;FLOAT;0.95;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;88;-224,1280;Inherit;False;Property;_Opacity;Opacity;3;0;Create;True;0;0;0;False;0;False;0;0.0141803;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.BreakToComponentsNode;89;-144,976;Inherit;False;COLOR;1;0;COLOR;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
|
|
Node;AmplifyShaderEditor.SimpleSubtractOpNode;73;-304,576;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;90;0,976;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.VertexColorNode;81;-384,800;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SaturateNode;84;-64,608;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;82;224,704;Inherit;False;3;3;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;93;480,640;Float;False;True;-1;2;ASEMaterialInspector;0;16;Soullies/EdgeShader;199187dac283dbe4a8cb1ea611d70c58;True;Sprite Lit;0;0;Sprite Lit;6;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;UniversalMaterialType=Lit;ShaderGraphShader=true;True;2;True;12;all;0;False;True;2;5;False;;10;False;;3;1;False;;10;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;2;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;3;Vertex Position;1;0;Debug Display;0;0;External Alpha;0;0;0;5;True;True;True;True;True;False;;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;94;480,640;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;199187dac283dbe4a8cb1ea611d70c58;True;Sprite Normal;0;1;Sprite Normal;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;UniversalMaterialType=Lit;ShaderGraphShader=true;True;0;True;12;all;0;False;True;2;5;False;;10;False;;3;1;False;;10;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;2;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=NormalsRendering;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;95;480,640;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;199187dac283dbe4a8cb1ea611d70c58;True;Sprite Forward;0;2;Sprite Forward;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;UniversalMaterialType=Lit;ShaderGraphShader=true;True;0;True;12;all;0;False;True;2;5;False;;10;False;;3;1;False;;10;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;2;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;96;480,640;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;199187dac283dbe4a8cb1ea611d70c58;True;SceneSelectionPass;0;3;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;UniversalMaterialType=Lit;ShaderGraphShader=true;True;0;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;97;480,640;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;199187dac283dbe4a8cb1ea611d70c58;True;ScenePickingPass;0;4;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;UniversalMaterialType=Lit;ShaderGraphShader=true;True;0;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
WireConnection;51;0;52;0
|
|
WireConnection;51;1;50;0
|
|
WireConnection;104;0;51;0
|
|
WireConnection;60;0;104;0
|
|
WireConnection;67;0;104;1
|
|
WireConnection;61;0;60;0
|
|
WireConnection;61;1;67;0
|
|
WireConnection;98;0;51;0
|
|
WireConnection;101;1;61;0
|
|
WireConnection;101;0;98;0
|
|
WireConnection;75;0;101;0
|
|
WireConnection;75;1;68;0
|
|
WireConnection;79;0;68;0
|
|
WireConnection;79;1;87;0
|
|
WireConnection;72;0;75;0
|
|
WireConnection;72;1;79;0
|
|
WireConnection;72;2;79;0
|
|
WireConnection;69;0;75;0
|
|
WireConnection;89;0;86;0
|
|
WireConnection;73;0;72;0
|
|
WireConnection;73;1;69;0
|
|
WireConnection;90;0;89;0
|
|
WireConnection;90;1;89;1
|
|
WireConnection;90;2;89;2
|
|
WireConnection;90;3;88;0
|
|
WireConnection;84;0;73;0
|
|
WireConnection;82;0;84;0
|
|
WireConnection;82;1;81;0
|
|
WireConnection;82;2;90;0
|
|
WireConnection;93;1;82;0
|
|
ASEEND*/
|
|
//CHKSM=085DA3167E46743C7870F9C1D7CC01654569CEFA |