671 lines
26 KiB
Plaintext
671 lines
26 KiB
Plaintext
// Made with Amplify Shader Editor v1.9.3.2
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "EmissiveParticle"
|
|
{
|
|
Properties
|
|
{
|
|
[HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
|
|
[HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
|
|
_TextureSample0("Texture Sample 0", 2D) = "white" {}
|
|
_FresnelScale("FresnelScale", Float) = 0
|
|
_FresnelPower("FresnelPower", Float) = 0
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
|
|
|
[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" }
|
|
|
|
Cull Off
|
|
HLSLINCLUDE
|
|
#pragma target 2.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 Unlit"
|
|
Tags { "LightMode"="Universal2D" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140010
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define SHADERPASS SHADERPASS_SPRITEUNLIT
|
|
|
|
#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
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
sampler2D _TextureSample0;
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _TextureSample0_ST;
|
|
float _FresnelScale;
|
|
float _FresnelPower;
|
|
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;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
float4 ase_texcoord4 : TEXCOORD4;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex );
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
|
|
float4 _RendererColor;
|
|
|
|
|
|
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 );
|
|
|
|
float3 ase_worldPos = TransformObjectToWorld( (v.positionOS).xyz );
|
|
o.ase_texcoord3.xyz = ase_worldPos;
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(v.normal);
|
|
o.ase_texcoord4.xyz = ase_worldNormal;
|
|
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord3.w = 0;
|
|
o.ase_texcoord4.w = 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
|
|
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 );
|
|
|
|
float4 texCoord18 = IN.texCoord0;
|
|
texCoord18.xy = IN.texCoord0.xy * float2( 1,1 ) + float2( 0,0 );
|
|
float2 uv_TextureSample0 = IN.texCoord0.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
|
|
float4 temp_output_4_0 = ( IN.color * ( texCoord18.z + 1.0 ) * tex2D( _TextureSample0, uv_TextureSample0 ) );
|
|
float3 ase_worldPos = IN.ase_texcoord3.xyz;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - ase_worldPos );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
float3 ase_worldNormal = IN.ase_texcoord4.xyz;
|
|
float fresnelNdotV11 = dot( ase_worldNormal, ase_worldViewDir );
|
|
float fresnelNode11 = ( 0.0 + _FresnelScale * pow( 1.0 - fresnelNdotV11, _FresnelPower ) );
|
|
float clampResult9 = clamp( ( temp_output_4_0.a + fresnelNode11 ) , 0.0 , 1.0 );
|
|
float4 appendResult29 = (float4(( float4( 0,0,0,0 ) + temp_output_4_0 ).rgb , clampResult9));
|
|
|
|
float4 Color = appendResult29;
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy );
|
|
Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture );
|
|
#endif
|
|
|
|
#if defined(DEBUG_DISPLAY)
|
|
SurfaceData2D surfaceData;
|
|
InitializeSurfaceData(Color.rgb, Color.a, surfaceData);
|
|
InputData2D inputData;
|
|
InitializeInputData(IN.positionWS.xy, half2(IN.texCoord0.xy), inputData);
|
|
half4 debugColor = 0;
|
|
|
|
SETUP_DEBUG_DATA_2D(inputData, IN.positionWS);
|
|
|
|
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
|
|
{
|
|
return debugColor;
|
|
}
|
|
#endif
|
|
|
|
Color *= IN.color * _RendererColor;
|
|
return Color;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Sprite Unlit Forward"
|
|
Tags { "LightMode"="UniversalForward" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140010
|
|
|
|
|
|
#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
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
sampler2D _TextureSample0;
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _TextureSample0_ST;
|
|
float _FresnelScale;
|
|
float _FresnelPower;
|
|
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;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
float4 ase_texcoord4 : TEXCOORD4;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex );
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
|
|
float4 _RendererColor;
|
|
|
|
|
|
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 );
|
|
|
|
float3 ase_worldPos = TransformObjectToWorld( (v.positionOS).xyz );
|
|
o.ase_texcoord3.xyz = ase_worldPos;
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(v.normal);
|
|
o.ase_texcoord4.xyz = ase_worldNormal;
|
|
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord3.w = 0;
|
|
o.ase_texcoord4.w = 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
|
|
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 );
|
|
|
|
float4 texCoord18 = IN.texCoord0;
|
|
texCoord18.xy = IN.texCoord0.xy * float2( 1,1 ) + float2( 0,0 );
|
|
float2 uv_TextureSample0 = IN.texCoord0.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
|
|
float4 temp_output_4_0 = ( IN.color * ( texCoord18.z + 1.0 ) * tex2D( _TextureSample0, uv_TextureSample0 ) );
|
|
float3 ase_worldPos = IN.ase_texcoord3.xyz;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - ase_worldPos );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
float3 ase_worldNormal = IN.ase_texcoord4.xyz;
|
|
float fresnelNdotV11 = dot( ase_worldNormal, ase_worldViewDir );
|
|
float fresnelNode11 = ( 0.0 + _FresnelScale * pow( 1.0 - fresnelNdotV11, _FresnelPower ) );
|
|
float clampResult9 = clamp( ( temp_output_4_0.a + fresnelNode11 ) , 0.0 , 1.0 );
|
|
float4 appendResult29 = (float4(( float4( 0,0,0,0 ) + temp_output_4_0 ).rgb , clampResult9));
|
|
|
|
float4 Color = appendResult29;
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy );
|
|
Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture );
|
|
#endif
|
|
|
|
|
|
#if defined(DEBUG_DISPLAY)
|
|
SurfaceData2D surfaceData;
|
|
InitializeSurfaceData(Color.rgb, Color.a, surfaceData);
|
|
InputData2D inputData;
|
|
InitializeInputData(IN.positionWS.xy, half2(IN.texCoord0.xy), inputData);
|
|
half4 debugColor = 0;
|
|
|
|
SETUP_DEBUG_DATA_2D(inputData, IN.positionWS);
|
|
|
|
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
|
|
{
|
|
return debugColor;
|
|
}
|
|
#endif
|
|
|
|
Color *= IN.color * _RendererColor;
|
|
return Color;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "SceneSelectionPass"
|
|
Tags { "LightMode"="SceneSelectionPass" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define ASE_SRP_VERSION 140010
|
|
|
|
|
|
#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"
|
|
|
|
#define ASE_NEEDS_FRAG_COLOR
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
sampler2D _TextureSample0;
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _TextureSample0_ST;
|
|
float _FresnelScale;
|
|
float _FresnelPower;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
float4 ase_texcoord2 : TEXCOORD2;
|
|
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 );
|
|
|
|
float3 ase_worldPos = TransformObjectToWorld( (v.positionOS).xyz );
|
|
o.ase_texcoord1.xyz = ase_worldPos;
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(v.normal);
|
|
o.ase_texcoord2.xyz = ase_worldNormal;
|
|
|
|
o.ase_color = v.ase_color;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord1.w = 0;
|
|
o.ase_texcoord2.w = 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
|
|
{
|
|
float4 texCoord18 = IN.ase_texcoord;
|
|
texCoord18.xy = IN.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
|
|
float2 uv_TextureSample0 = IN.ase_texcoord.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
|
|
float4 temp_output_4_0 = ( IN.ase_color * ( texCoord18.z + 1.0 ) * tex2D( _TextureSample0, uv_TextureSample0 ) );
|
|
float3 ase_worldPos = IN.ase_texcoord1.xyz;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - ase_worldPos );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
float3 ase_worldNormal = IN.ase_texcoord2.xyz;
|
|
float fresnelNdotV11 = dot( ase_worldNormal, ase_worldViewDir );
|
|
float fresnelNode11 = ( 0.0 + _FresnelScale * pow( 1.0 - fresnelNdotV11, _FresnelPower ) );
|
|
float clampResult9 = clamp( ( temp_output_4_0.a + fresnelNode11 ) , 0.0 , 1.0 );
|
|
float4 appendResult29 = (float4(( float4( 0,0,0,0 ) + temp_output_4_0 ).rgb , clampResult9));
|
|
|
|
float4 Color = appendResult29;
|
|
|
|
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 140010
|
|
|
|
|
|
#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"
|
|
|
|
#define ASE_NEEDS_FRAG_COLOR
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
sampler2D _TextureSample0;
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _TextureSample0_ST;
|
|
float _FresnelScale;
|
|
float _FresnelPower;
|
|
CBUFFER_END
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normal : NORMAL;
|
|
float4 tangent : TANGENT;
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
float4 ase_texcoord2 : TEXCOORD2;
|
|
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 );
|
|
|
|
float3 ase_worldPos = TransformObjectToWorld( (v.positionOS).xyz );
|
|
o.ase_texcoord1.xyz = ase_worldPos;
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(v.normal);
|
|
o.ase_texcoord2.xyz = ase_worldNormal;
|
|
|
|
o.ase_color = v.ase_color;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord1.w = 0;
|
|
o.ase_texcoord2.w = 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
|
|
{
|
|
float4 texCoord18 = IN.ase_texcoord;
|
|
texCoord18.xy = IN.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
|
|
float2 uv_TextureSample0 = IN.ase_texcoord.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
|
|
float4 temp_output_4_0 = ( IN.ase_color * ( texCoord18.z + 1.0 ) * tex2D( _TextureSample0, uv_TextureSample0 ) );
|
|
float3 ase_worldPos = IN.ase_texcoord1.xyz;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - ase_worldPos );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
float3 ase_worldNormal = IN.ase_texcoord2.xyz;
|
|
float fresnelNdotV11 = dot( ase_worldNormal, ase_worldViewDir );
|
|
float fresnelNode11 = ( 0.0 + _FresnelScale * pow( 1.0 - fresnelNdotV11, _FresnelPower ) );
|
|
float clampResult9 = clamp( ( temp_output_4_0.a + fresnelNode11 ) , 0.0 , 1.0 );
|
|
float4 appendResult29 = (float4(( float4( 0,0,0,0 ) + temp_output_4_0 ).rgb , clampResult9));
|
|
|
|
float4 Color = appendResult29;
|
|
half4 outColor = _SelectionID;
|
|
return outColor;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
}
|
|
// CustomEditor "ASEMaterialInspector"
|
|
Fallback "Hidden/InternalErrorShader"
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=19302
|
|
Node;AmplifyShaderEditor.RangedFloatNode;8;-503.1194,267.3835;Inherit;False;Constant;_Float0;Float 0;1;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;18;-639.0632,35.4738;Inherit;False;0;-1;4;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;7;-284.5947,138.0285;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;5;-556.9079,-466.4421;Inherit;True;Property;_TextureSample0;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;c16c6407de95bba4a838acad653cebd8;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.VertexColorNode;2;-507.7784,-178.76;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;4;-113.4007,-39.78129;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;15;-1016.531,633.1378;Inherit;False;Property;_FresnelScale;FresnelScale;1;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;16;-1008.731,718.9379;Inherit;False;Property;_FresnelPower;FresnelPower;3;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.BreakToComponentsNode;6;44.24745,320.8797;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.FresnelNode;11;-755.3662,650.4958;Inherit;True;Standard;WorldNormal;ViewDir;False;False;5;0;FLOAT3;0,0,1;False;4;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;5;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;14;214.5692,395.2379;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;9;406.4248,391.9684;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;13;478.8257,88.6251;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.ColorNode;10;-803.6648,415.6819;Inherit;False;Property;_FresnelColor;FresnelColor;2;0;Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;12;-287.6748,457.7732;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;29;635.8922,170.6508;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;30;937.4523,74.84953;Float;False;True;-1;2;ASEMaterialInspector;0;15;EmissiveParticle;cf964e524c8e69742b1d21fbe2ebcc4a;True;Sprite Unlit;0;0;Sprite Unlit;4;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;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;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=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;3;Vertex Position;1;0;Debug Display;0;0;External Alpha;0;0;0;4;True;True;True;True;False;;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;31;937.4523,74.84953;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;cf964e524c8e69742b1d21fbe2ebcc4a;True;Sprite Unlit Forward;0;1;Sprite Unlit 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;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;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;32;937.4523,74.84953;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;cf964e524c8e69742b1d21fbe2ebcc4a;True;SceneSelectionPass;0;2;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;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;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;33;937.4523,74.84953;Float;False;False;-1;2;ASEMaterialInspector;0;1;New Amplify Shader;cf964e524c8e69742b1d21fbe2ebcc4a;True;ScenePickingPass;0;3;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;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;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;7;0;18;3
|
|
WireConnection;7;1;8;0
|
|
WireConnection;4;0;2;0
|
|
WireConnection;4;1;7;0
|
|
WireConnection;4;2;5;0
|
|
WireConnection;6;0;4;0
|
|
WireConnection;11;2;15;0
|
|
WireConnection;11;3;16;0
|
|
WireConnection;14;0;6;3
|
|
WireConnection;14;1;11;0
|
|
WireConnection;9;0;14;0
|
|
WireConnection;13;1;4;0
|
|
WireConnection;12;0;10;0
|
|
WireConnection;12;1;11;0
|
|
WireConnection;29;0;13;0
|
|
WireConnection;29;3;9;0
|
|
WireConnection;30;1;29;0
|
|
ASEEND*/
|
|
//CHKSM=DA8C797E2AEA2929071BD40F4E6FB6DFB8F3F8A0 |