1166 lines
58 KiB
Plaintext
Executable File
1166 lines
58 KiB
Plaintext
Executable File
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
// Modified to add GPU Instancing support
|
|
Shader "VFX/AllInOneShader_Instanced"
|
|
{
|
|
Properties
|
|
{
|
|
[HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
|
|
[HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
|
|
[ASEBegin][Enum(UnityEngine.Rendering.BlendMode)]_Scr("Scr", Float) = 5
|
|
[Enum(UnityEngine.Rendering.BlendMode)]_Dst("Dst", Float) = 10
|
|
[Enum(UnityEngine.Rendering.CullMode)]_CullMode("CullMode", Float) = 0
|
|
_MainTex("MainTex", 2D) = "white" {}
|
|
[Toggle]_MainTexAR("MainTexAR", Float) = 0
|
|
[HDR]_MainColor("MainColor", Color) = (1,1,1,1)
|
|
_MainTexUSpeed("MainTexUSpeed", Float) = 0
|
|
_MainTexVSpeed("MainTexVSpeed", Float) = 0
|
|
[Toggle]_CustomMainTex("CustomMainTex", Float) = 0
|
|
[Toggle(_FMASKTEX_ON)] _FMaskTex("FMaskTex", Float) = 0
|
|
_MaskTex("MaskTex", 2D) = "white" {}
|
|
[Toggle]_MaskTexAR("MaskTexAR", Float) = 1
|
|
_MaskTexUSpeed("MaskTexUSpeed", Float) = 0
|
|
_MaskTexVSpeed("MaskTexVSpeed", Float) = 0
|
|
[Toggle(_FDISTORTTEX_ON)] _FDistortTex("FDistortTex", Float) = 0
|
|
_DistortTex("DistortTex", 2D) = "white" {}
|
|
[Toggle]_DistortTexAR("DistortTexAR", Float) = 1
|
|
_DistortFactor("DistortFactor", Range( 0 , 1)) = 0
|
|
_DistortTexUSpeed("DistortTexUSpeed", Float) = 0
|
|
_DistortTexVSpeed("DistortTexVSpeed", Float) = 0
|
|
[Toggle]_DistortMainTex("DistortMainTex", Float) = 0
|
|
[Toggle]_DistortMaskTex("DistortMaskTex", Float) = 0
|
|
[Toggle]_DistortDissolveTex("DistortDissolveTex", Float) = 0
|
|
[Toggle(_FDISSOLVETEX_ON)] _FDissolveTex("FDissolveTex", Float) = 0
|
|
_DissolveTex("DissolveTex", 2D) = "white" {}
|
|
[Toggle]_DissolveTexAR("DissolveTexAR", Float) = 1
|
|
[HDR]_DissolveColor("DissolveColor", Color) = (1,1,1,1)
|
|
[Toggle]_CustomDissolve("CustomDissolve", Float) = 0
|
|
_DissolveFactor("DissolveFactor", Range( 0 , 1)) = 0
|
|
_DissolveSoft("DissolveSoft", Range( 0 , 1)) = 0.1
|
|
_DissolveWide("DissolveWide", Range( 0 , 1)) = 0.05
|
|
_DissolveTexUSpeed("DissolveTexUSpeed", Float) = 0
|
|
_DissolveTexVSpeed("DissolveTexVSpeed", Float) = 0
|
|
_MainAlpha("MainAlpha", Range( 0 , 10)) = 1
|
|
[Toggle(_FFNL_ON)] _FFnl("FFnl", Float) = 0
|
|
[HDR]_FnlColor("FnlColor", Color) = (1,1,1,1)
|
|
_FnlScale("FnlScale", Range( 0 , 2)) = 0
|
|
[Toggle(_FDEPTH_ON)] _FDepth("FDepth", Float) = 0
|
|
_FnlPower("FnlPower", Range( 1 , 10)) = 1
|
|
[Toggle]_ReFnl("ReFnl", Float) = 0
|
|
[Enum(Alpha,0,Add,1)]_BlendMode("BlendMode", Float) = 0
|
|
[ASEEnd]_DepthFade("DepthFade", Range( 0 , 10)) = 1
|
|
_MainTexRotate("MainTexRotate", Range( 0 , 360)) = 0
|
|
_MaskTexRotate("MaskTexRotate", Range( 0 , 360)) = 0
|
|
_DistortTexRotate("DistortTexRotate", Range( 0 , 360)) = 0
|
|
_DissolveTexRotate("DissolveTexRotate", Range( 0 , 360)) = 0
|
|
[KeywordEnum(Normal,Polar)] _MainTexUVS("MainTex UV Mode", Float) = 0
|
|
[Toggle] _MainTexClampU("MainTex Clamp U", Float) = 0
|
|
[Toggle] _MainTexClampV("MainTex Clamp V", Float) = 0
|
|
[KeywordEnum(Normal,Polar)] _MaskTexUVS("MaskTex UV Mode", Float) = 0
|
|
[Toggle] _MaskTexClampU("MaskTex Clamp U", Float) = 0
|
|
[Toggle] _MaskTexClampV("MaskTex Clamp V", Float) = 0
|
|
[KeywordEnum(Normal,Polar)] _DistortTexUVS("DistortTex UV Mode", Float) = 0
|
|
[Toggle] _DistortTexClampU("DistortTex Clamp U", Float) = 0
|
|
[Toggle] _DistortTexClampV("DistortTex Clamp V", Float) = 0
|
|
[KeywordEnum(Normal,Polar)] _DissolveTexUVS("DissolveTex UV Mode", Float) = 0
|
|
[Toggle] _DissolveTexClampU("DissolveTex Clamp U", Float) = 0
|
|
[Toggle] _DissolveTexClampV("DissolveTex Clamp V", Float) = 0
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
LOD 0
|
|
|
|
|
|
Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" }
|
|
|
|
Cull [_CullMode]
|
|
AlphaToMask Off
|
|
|
|
HLSLINCLUDE
|
|
#pragma target 3.0
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
|
|
#ifndef ASE_TESS_FUNCS
|
|
#define ASE_TESS_FUNCS
|
|
float4 FixedTess( float tessValue )
|
|
{
|
|
return tessValue;
|
|
}
|
|
|
|
float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
|
|
{
|
|
float3 wpos = mul(o2w,vertex).xyz;
|
|
float dist = distance (wpos, cameraPos);
|
|
float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
|
|
return f;
|
|
}
|
|
|
|
float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
|
|
{
|
|
float4 tess;
|
|
tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
|
|
tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
|
|
tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
|
|
tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
|
|
return tess;
|
|
}
|
|
|
|
float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
|
|
{
|
|
float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
|
|
float len = distance(wpos0, wpos1);
|
|
float f = max(len * scParams.y / (edgeLen * dist), 1.0);
|
|
return f;
|
|
}
|
|
|
|
float DistanceFromPlane (float3 pos, float4 plane)
|
|
{
|
|
float d = dot (float4(pos,1.0f), plane);
|
|
return d;
|
|
}
|
|
|
|
bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
|
|
{
|
|
float4 planeTest;
|
|
planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
|
|
return !all (planeTest);
|
|
}
|
|
|
|
float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
|
|
{
|
|
float3 f;
|
|
f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
|
|
f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
|
|
f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
|
|
|
|
return CalcTriEdgeTessFactors (f);
|
|
}
|
|
|
|
float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
|
|
{
|
|
float3 pos0 = mul(o2w,v0).xyz;
|
|
float3 pos1 = mul(o2w,v1).xyz;
|
|
float3 pos2 = mul(o2w,v2).xyz;
|
|
float4 tess;
|
|
tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
|
|
tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
|
|
tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
|
|
tess.w = (tess.x + tess.y + tess.z) / 3.0f;
|
|
return tess;
|
|
}
|
|
|
|
float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
|
|
{
|
|
float3 pos0 = mul(o2w,v0).xyz;
|
|
float3 pos1 = mul(o2w,v1).xyz;
|
|
float3 pos2 = mul(o2w,v2).xyz;
|
|
float4 tess;
|
|
|
|
if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
|
|
{
|
|
tess = 0.0f;
|
|
}
|
|
else
|
|
{
|
|
tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
|
|
tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
|
|
tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
|
|
tess.w = (tess.x + tess.y + tess.z) / 3.0f;
|
|
}
|
|
return tess;
|
|
}
|
|
#endif //ASE_TESS_FUNCS
|
|
|
|
ENDHLSL
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Forward"
|
|
Tags { "LightMode"="UniversalForwardOnly" }
|
|
|
|
Blend [_Scr] [_Dst], One OneMinusSrcAlpha
|
|
ZWrite Off
|
|
ZTest LEqual
|
|
Offset 0 , 0
|
|
ColorMask RGBA
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _RECEIVE_SHADOWS_OFF 1
|
|
#define ASE_SRP_VERSION 100501
|
|
#define REQUIRE_DEPTH_TEXTURE 1
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
|
|
#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/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#if ASE_SRP_VERSION <= 70108
|
|
#define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR
|
|
#endif
|
|
|
|
#define ASE_NEEDS_FRAG_WORLD_POSITION
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
#define ASE_NEEDS_FRAG_COLOR
|
|
#pragma shader_feature_local _FDISSOLVETEX_ON
|
|
#pragma shader_feature_local _FDISTORTTEX_ON
|
|
#pragma shader_feature_local _FFNL_ON
|
|
#pragma shader_feature_local _FMASKTEX_ON
|
|
#pragma shader_feature_local _FDEPTH_ON
|
|
#pragma shader_feature_local _MAINTEXUVS_NORMAL _MAINTEXUVS_POLAR
|
|
#pragma shader_feature_local _MASKTEXUVS_NORMAL _MASKTEXUVS_POLAR
|
|
#pragma shader_feature_local _DISTORTTEXUVS_NORMAL _DISTORTTEXUVS_POLAR
|
|
#pragma shader_feature_local _DISSOLVETEXUVS_NORMAL _DISSOLVETEXUVS_POLAR
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 vertex : POSITION;
|
|
float3 ase_normal : NORMAL;
|
|
half4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 clipPos : SV_POSITION;
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
float3 worldPos : TEXCOORD0;
|
|
#endif
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
float4 shadowCoord : TEXCOORD1;
|
|
#endif
|
|
#ifdef ASE_FOG
|
|
float fogFactor : TEXCOORD2;
|
|
#endif
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
float4 ase_texcoord4 : TEXCOORD4;
|
|
float4 ase_texcoord5 : TEXCOORD5;
|
|
float4 ase_texcoord6 : TEXCOORD6;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
// Textures (shared across instances)
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
TEXTURE2D(_DistortTex);
|
|
SAMPLER(sampler_DistortTex);
|
|
TEXTURE2D(_DissolveTex);
|
|
SAMPLER(sampler_DissolveTex);
|
|
TEXTURE2D(_MaskTex);
|
|
SAMPLER(sampler_MaskTex);
|
|
|
|
// Per-material properties with instancing support
|
|
UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MaskTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DissolveTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MainColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DissolveColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DistortTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MainTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _FnlColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CullMode)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortDissolveTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainAlpha)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _FnlScale)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _FnlPower)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _ReFnl)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveWide)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortMaskTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveFactor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CustomDissolve)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortFactor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortMainTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CustomMainTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _Scr)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _BlendMode)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _Dst)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveSoft)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DepthFade)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexClampV)
|
|
UNITY_INSTANCING_BUFFER_END(UnityPerMaterial)
|
|
|
|
// Macros to access instanced properties
|
|
#define _MaskTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTex_ST)
|
|
#define _DissolveTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTex_ST)
|
|
#define _MainColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainColor)
|
|
#define _DissolveColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveColor)
|
|
#define _DistortTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTex_ST)
|
|
#define _MainTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTex_ST)
|
|
#define _FnlColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlColor)
|
|
#define _DissolveTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexVSpeed)
|
|
#define _DistortDissolveTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortDissolveTex)
|
|
#define _MainAlpha_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainAlpha)
|
|
#define _FnlScale_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlScale)
|
|
#define _DissolveTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexUSpeed)
|
|
#define _FnlPower_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlPower)
|
|
#define _MainTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexAR)
|
|
#define _MaskTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexAR)
|
|
#define _MaskTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexUSpeed)
|
|
#define _MaskTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexVSpeed)
|
|
#define _ReFnl_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _ReFnl)
|
|
#define _DissolveTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexAR)
|
|
#define _DissolveWide_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveWide)
|
|
#define _DistortMaskTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortMaskTex)
|
|
#define _DissolveFactor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveFactor)
|
|
#define _CustomDissolve_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _CustomDissolve)
|
|
#define _DistortFactor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortFactor)
|
|
#define _DistortTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexVSpeed)
|
|
#define _DistortTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexUSpeed)
|
|
#define _DistortTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexAR)
|
|
#define _DistortMainTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortMainTex)
|
|
#define _CustomMainTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _CustomMainTex)
|
|
#define _MainTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexVSpeed)
|
|
#define _MainTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexUSpeed)
|
|
#define _Scr_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Scr)
|
|
#define _BlendMode_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _BlendMode)
|
|
#define _Dst_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Dst)
|
|
#define _DissolveSoft_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveSoft)
|
|
#define _DepthFade_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DepthFade)
|
|
#define _MainTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexRotate)
|
|
#define _MaskTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexRotate)
|
|
#define _DistortTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexRotate)
|
|
#define _DissolveTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexRotate)
|
|
#define _MainTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexClampU)
|
|
#define _MainTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexClampV)
|
|
#define _MaskTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexClampU)
|
|
#define _MaskTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexClampV)
|
|
#define _DistortTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexClampU)
|
|
#define _DistortTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexClampV)
|
|
#define _DissolveTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexClampU)
|
|
#define _DissolveTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexClampV)
|
|
|
|
VertexOutput VertexFunction ( VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
|
|
half3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal);
|
|
o.ase_texcoord5.xyz = ase_worldNormal;
|
|
float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz);
|
|
float4 screenPos = ComputeScreenPos(ase_clipPos);
|
|
o.ase_texcoord6 = screenPos;
|
|
|
|
o.ase_color = v.ase_color;
|
|
o.ase_texcoord3.xy = v.ase_texcoord.xy;
|
|
o.ase_texcoord4 = v.ase_texcoord1;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord3.zw = 0;
|
|
o.ase_texcoord5.w = 0;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.vertex.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.vertex.xyz = vertexValue;
|
|
#else
|
|
v.vertex.xyz += vertexValue;
|
|
#endif
|
|
v.ase_normal = v.ase_normal;
|
|
|
|
float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
|
|
float4 positionCS = TransformWorldToHClip( positionWS );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
o.worldPos = positionWS;
|
|
#endif
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
VertexPositionInputs vertexInput = (VertexPositionInputs)0;
|
|
vertexInput.positionWS = positionWS;
|
|
vertexInput.positionCS = positionCS;
|
|
o.shadowCoord = GetShadowCoord( vertexInput );
|
|
#endif
|
|
#ifdef ASE_FOG
|
|
o.fogFactor = ComputeFogFactor( positionCS.z );
|
|
#endif
|
|
o.clipPos = positionCS;
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float4 vertex : INTERNALTESSPOS;
|
|
float3 ase_normal : NORMAL;
|
|
half4 ase_color : COLOR;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl vert ( VertexInput v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.vertex = v.vertex;
|
|
o.ase_normal = v.ase_normal;
|
|
o.ase_color = v.ase_color;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
o.ase_texcoord1 = v.ase_texcoord1;
|
|
return o;
|
|
}
|
|
|
|
TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
|
|
{
|
|
TessellationFactors o;
|
|
float4 tf = 1;
|
|
float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
|
|
float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
|
|
#endif
|
|
o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
|
|
return o;
|
|
}
|
|
|
|
[domain("tri")]
|
|
[partitioning("fractional_odd")]
|
|
[outputtopology("triangle_cw")]
|
|
[patchconstantfunc("TessellationFunction")]
|
|
[outputcontrolpoints(3)]
|
|
VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
|
|
{
|
|
return patch[id];
|
|
}
|
|
|
|
[domain("tri")]
|
|
VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
VertexInput o = (VertexInput) 0;
|
|
o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
|
|
o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
|
|
o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z;
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
|
|
o.ase_texcoord1 = patch[0].ase_texcoord1 * bary.x + patch[1].ase_texcoord1 * bary.y + patch[2].ase_texcoord1 * bary.z;
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
half4 frag ( VertexOutput IN ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
float3 WorldPosition = IN.worldPos;
|
|
#endif
|
|
float4 ShadowCoords = float4( 0, 0, 0, 0 );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
ShadowCoords = IN.shadowCoord;
|
|
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
|
ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
|
|
#endif
|
|
#endif
|
|
|
|
// Access instanced properties
|
|
half Scr106 = _Scr_Instanced;
|
|
half2 appendResult4_g13 = (half2(_MainTexUSpeed_Instanced , _MainTexVSpeed_Instanced));
|
|
half2 uv_MainTex = IN.ase_texcoord3.xy * _MainTex_ST_Instanced.xy + _MainTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g8 = uv_MainTex;
|
|
half2 appendResult4_g7 = (half2(_DistortTexUSpeed_Instanced , _DistortTexVSpeed_Instanced));
|
|
half2 uv_DistortTex = IN.ase_texcoord3.xy * _DistortTex_ST_Instanced.xy + _DistortTex_ST_Instanced.zw;
|
|
half2 _baseUV_distort = uv_DistortTex;
|
|
#if defined(_DISTORTTEXUVS_POLAR)
|
|
{ half2 _cuv_distort = IN.ase_texcoord3.xy - half2(0.5,0.5); _baseUV_distort = half2( length(_cuv_distort)*_DistortTex_ST_Instanced.x*2.0, atan2(_cuv_distort.x,_cuv_distort.y)*(1.0/6.28318548202515)*_DistortTex_ST_Instanced.y ) + _DistortTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_distort = (_DistortTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_distort = cos(_ra__baseUV_distort); half _rs__baseUV_distort = sin(_ra__baseUV_distort); _baseUV_distort = mul(_baseUV_distort - half2(0.5,0.5), half2x2(_rc__baseUV_distort,-_rs__baseUV_distort,_rs__baseUV_distort,_rc__baseUV_distort)) + half2(0.5,0.5); }
|
|
half2 panner5_g7 = ( 1.0 * _Time.y * appendResult4_g7 + _baseUV_distort);
|
|
{ half2 _cuv = panner5_g7; panner5_g7 = half2( (_DistortTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_DistortTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g7 = SAMPLE_TEXTURE2D( _DistortTex, sampler_DistortTex, panner5_g7 );
|
|
half Distort148 = ( ( _DistortTexAR_Instanced == 0.0 ? tex2DNode7_g7.a : tex2DNode7_g7.r ) * _DistortFactor_Instanced );
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch316 = ( _DistortMainTex_Instanced == 0.0 ? temp_output_3_0_g8 : ( temp_output_3_0_g8 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch316 = uv_MainTex;
|
|
#endif
|
|
half4 texCoord328 = IN.ase_texcoord4;
|
|
texCoord328.xy = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 );
|
|
half2 appendResult330 = (half2(texCoord328.x , texCoord328.y));
|
|
half2 _baseUV_main = (( _CustomMainTex_Instanced )?( ( staticSwitch316 + appendResult330 ) ):( staticSwitch316 ));
|
|
#if defined(_MAINTEXUVS_POLAR)
|
|
{ half2 _cuv_main = IN.ase_texcoord3.xy - half2(0.5,0.5); _baseUV_main = half2( length(_cuv_main)*_MainTex_ST_Instanced.x*2.0, atan2(_cuv_main.x,_cuv_main.y)*(1.0/6.28318548202515)*_MainTex_ST_Instanced.y ) + _MainTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_main = (_MainTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_main = cos(_ra__baseUV_main); half _rs__baseUV_main = sin(_ra__baseUV_main); _baseUV_main = mul(_baseUV_main - half2(0.5,0.5), half2x2(_rc__baseUV_main,-_rs__baseUV_main,_rs__baseUV_main,_rc__baseUV_main)) + half2(0.5,0.5); }
|
|
half2 panner5_g13 = ( 1.0 * _Time.y * appendResult4_g13 + _baseUV_main);
|
|
{ half2 _cuv = panner5_g13; panner5_g13 = half2( (_MainTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_MainTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g13 = SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, panner5_g13 );
|
|
half4 MainTexColor215 = ( _MainColor_Instanced * tex2DNode7_g13 );
|
|
half4 texCoord333 = IN.ase_texcoord4;
|
|
texCoord333.xy = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 );
|
|
half temp_output_275_0 = (-_DissolveWide_Instanced + ((( _CustomDissolve_Instanced )?( texCoord333.z ):( _DissolveFactor_Instanced )) - 0.0) * (1.0 - -_DissolveWide_Instanced) / (1.0 - 0.0));
|
|
half temp_output_277_0 = ( _DissolveSoft_Instanced + 0.0001 );
|
|
half temp_output_272_0 = (-temp_output_277_0 + (( temp_output_275_0 + _DissolveWide_Instanced ) - 0.0) * (1.0 - -temp_output_277_0) / (1.0 - 0.0));
|
|
half2 appendResult4_g10 = (half2(_DissolveTexUSpeed_Instanced , _DissolveTexVSpeed_Instanced));
|
|
half2 uv_DissolveTex = IN.ase_texcoord3.xy * _DissolveTex_ST_Instanced.xy + _DissolveTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g9 = uv_DissolveTex;
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch314 = ( _DistortDissolveTex_Instanced == 0.0 ? temp_output_3_0_g9 : ( temp_output_3_0_g9 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch314 = uv_DissolveTex;
|
|
#endif
|
|
half2 _baseUV_dissolve = staticSwitch314;
|
|
#if defined(_DISSOLVETEXUVS_POLAR)
|
|
{ half2 _cuv_dissolve = IN.ase_texcoord3.xy - half2(0.5,0.5); _baseUV_dissolve = half2( length(_cuv_dissolve)*_DissolveTex_ST_Instanced.x*2.0, atan2(_cuv_dissolve.x,_cuv_dissolve.y)*(1.0/6.28318548202515)*_DissolveTex_ST_Instanced.y ) + _DissolveTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_dissolve = (_DissolveTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_dissolve = cos(_ra__baseUV_dissolve); half _rs__baseUV_dissolve = sin(_ra__baseUV_dissolve); _baseUV_dissolve = mul(_baseUV_dissolve - half2(0.5,0.5), half2x2(_rc__baseUV_dissolve,-_rs__baseUV_dissolve,_rs__baseUV_dissolve,_rc__baseUV_dissolve)) + half2(0.5,0.5); }
|
|
half2 panner5_g10 = ( 1.0 * _Time.y * appendResult4_g10 + _baseUV_dissolve);
|
|
{ half2 _cuv = panner5_g10; panner5_g10 = half2( (_DissolveTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_DissolveTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g10 = SAMPLE_TEXTURE2D( _DissolveTex, sampler_DissolveTex, panner5_g10 );
|
|
half temp_output_351_20 = ( _DissolveTexAR_Instanced == 0.0 ? tex2DNode7_g10.a : tex2DNode7_g10.r );
|
|
half smoothstepResult264 = smoothstep( temp_output_272_0 , ( temp_output_272_0 + temp_output_277_0 ) , temp_output_351_20);
|
|
half Alpha337 = _MainAlpha_Instanced;
|
|
half4 lerpResult223 = lerp( MainTexColor215 , _DissolveColor_Instanced , ( _DissolveColor_Instanced.a * ( 1.0 - smoothstepResult264 ) * Alpha337 ));
|
|
#ifdef _FDISSOLVETEX_ON
|
|
half4 staticSwitch298 = lerpResult223;
|
|
#else
|
|
half4 staticSwitch298 = MainTexColor215;
|
|
#endif
|
|
half4 temp_cast_0 = (0.0).xxxx;
|
|
half Refnl339 = _ReFnl_Instanced;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
half3 ase_worldNormal = IN.ase_texcoord5.xyz;
|
|
half fresnelNdotV279 = dot( ase_worldNormal, ase_worldViewDir );
|
|
half fresnelNode279 = ( 0.0 + _FnlScale_Instanced * pow( 1.0 - fresnelNdotV279, _FnlPower_Instanced ) );
|
|
half temp_output_283_0 = saturate( fresnelNode279 );
|
|
half4 FnlMainColor286 = ( _FnlColor_Instanced * temp_output_283_0 * _FnlColor_Instanced.a );
|
|
half4 temp_cast_1 = (0.0).xxxx;
|
|
#ifdef _FFNL_ON
|
|
half4 staticSwitch300 = ( Refnl339 == 0.0 ? FnlMainColor286 : temp_cast_1 );
|
|
#else
|
|
half4 staticSwitch300 = temp_cast_0;
|
|
#endif
|
|
float4 MainColor98 = ( IN.ase_color * ( staticSwitch298 + staticSwitch300 ) );
|
|
float MainTexAlpha138 = ( _MainColor_Instanced.a * ( _MainTexAR_Instanced == 0.0 ? tex2DNode7_g13.a : tex2DNode7_g13.r ) );
|
|
half2 appendResult4_g14 = (half2(_MaskTexUSpeed_Instanced , _MaskTexVSpeed_Instanced));
|
|
half2 uv_MaskTex = IN.ase_texcoord3.xy * _MaskTex_ST_Instanced.xy + _MaskTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g12 = uv_MaskTex;
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch312 = ( _DistortMaskTex_Instanced == 0.0 ? temp_output_3_0_g12 : ( temp_output_3_0_g12 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch312 = uv_MaskTex;
|
|
#endif
|
|
half2 _baseUV_mask = staticSwitch312;
|
|
#if defined(_MASKTEXUVS_POLAR)
|
|
{ half2 _cuv_mask = IN.ase_texcoord3.xy - half2(0.5,0.5); _baseUV_mask = half2( length(_cuv_mask)*_MaskTex_ST_Instanced.x*2.0, atan2(_cuv_mask.x,_cuv_mask.y)*(1.0/6.28318548202515)*_MaskTex_ST_Instanced.y ) + _MaskTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_mask = (_MaskTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_mask = cos(_ra__baseUV_mask); half _rs__baseUV_mask = sin(_ra__baseUV_mask); _baseUV_mask = mul(_baseUV_mask - half2(0.5,0.5), half2x2(_rc__baseUV_mask,-_rs__baseUV_mask,_rs__baseUV_mask,_rc__baseUV_mask)) + half2(0.5,0.5); }
|
|
half2 panner5_g14 = ( 1.0 * _Time.y * appendResult4_g14 + _baseUV_mask);
|
|
{ half2 _cuv = panner5_g14; panner5_g14 = half2( (_MaskTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_MaskTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g14 = SAMPLE_TEXTURE2D( _MaskTex, sampler_MaskTex, panner5_g14 );
|
|
#ifdef _FMASKTEX_ON
|
|
half staticSwitch291 = ( _MaskTexAR_Instanced == 0.0 ? tex2DNode7_g14.a : tex2DNode7_g14.r );
|
|
#else
|
|
half staticSwitch291 = 1.0;
|
|
#endif
|
|
half temp_output_270_0 = (-temp_output_277_0 + (temp_output_275_0 - 0.0) * (1.0 - -temp_output_277_0) / (1.0 - 0.0));
|
|
half smoothstepResult256 = smoothstep( temp_output_270_0 , ( temp_output_270_0 + temp_output_277_0 ) , temp_output_351_20);
|
|
half DissolveAlpha212 = smoothstepResult256;
|
|
#ifdef _FDISSOLVETEX_ON
|
|
half staticSwitch299 = DissolveAlpha212;
|
|
#else
|
|
half staticSwitch299 = 1.0;
|
|
#endif
|
|
half ReFnlAlpha318 = ( 1.0 - temp_output_283_0 );
|
|
#ifdef _FFNL_ON
|
|
half staticSwitch319 = ( Refnl339 == 0.0 ? 1.0 : ReFnlAlpha318 );
|
|
#else
|
|
half staticSwitch319 = 1.0;
|
|
#endif
|
|
float4 screenPos = IN.ase_texcoord6;
|
|
half4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float screenDepth375 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams);
|
|
half distanceDepth375 = abs( ( screenDepth375 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _DepthFade_Instanced ) );
|
|
#ifdef _FDEPTH_ON
|
|
half staticSwitch378 = saturate( distanceDepth375 );
|
|
#else
|
|
half staticSwitch378 = 1.0;
|
|
#endif
|
|
float MainAlpha97 = saturate( ( MainTexAlpha138 * staticSwitch291 * IN.ase_color.a * Alpha337 * staticSwitch299 * staticSwitch319 * staticSwitch378 ) );
|
|
|
|
float3 BakedAlbedo = 0;
|
|
float3 BakedEmission = 0;
|
|
float3 Color = ( Scr106 == 5.0 ? MainColor98 : ( MainColor98 * MainAlpha97 ) ).rgb;
|
|
float Alpha = MainAlpha97;
|
|
float AlphaClipThreshold = 0.5;
|
|
float AlphaClipThresholdShadow = 0.5;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
clip( Alpha - AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
|
|
#endif
|
|
|
|
#ifdef ASE_FOG
|
|
Color = MixFog( Color, IN.fogFactor );
|
|
#endif
|
|
|
|
return half4( Color, Alpha );
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "DepthOnly"
|
|
Tags { "LightMode"="DepthOnly" }
|
|
|
|
ZWrite On
|
|
ColorMask 0
|
|
AlphaToMask Off
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _RECEIVE_SHADOWS_OFF 1
|
|
#define ASE_SRP_VERSION 100501
|
|
#define REQUIRE_DEPTH_TEXTURE 1
|
|
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// GPU Instancing for DepthOnly pass
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
|
|
#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.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
|
|
|
|
#define ASE_NEEDS_FRAG_WORLD_POSITION
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
#pragma shader_feature_local _FDISTORTTEX_ON
|
|
#pragma shader_feature_local _FMASKTEX_ON
|
|
#pragma shader_feature_local _FDISSOLVETEX_ON
|
|
#pragma shader_feature_local _FFNL_ON
|
|
#pragma shader_feature_local _FDEPTH_ON
|
|
#pragma shader_feature_local _MAINTEXUVS_NORMAL _MAINTEXUVS_POLAR
|
|
#pragma shader_feature_local _MASKTEXUVS_NORMAL _MASKTEXUVS_POLAR
|
|
#pragma shader_feature_local _DISTORTTEXUVS_NORMAL _DISTORTTEXUVS_POLAR
|
|
#pragma shader_feature_local _DISSOLVETEXUVS_NORMAL _DISSOLVETEXUVS_POLAR
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 vertex : POSITION;
|
|
float3 ase_normal : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
half4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 clipPos : SV_POSITION;
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
float3 worldPos : TEXCOORD0;
|
|
#endif
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
float4 shadowCoord : TEXCOORD1;
|
|
#endif
|
|
float4 ase_texcoord2 : TEXCOORD2;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
float4 ase_color : COLOR;
|
|
float4 ase_texcoord4 : TEXCOORD4;
|
|
float4 ase_texcoord5 : TEXCOORD5;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
// Textures (shared)
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
TEXTURE2D(_DistortTex);
|
|
SAMPLER(sampler_DistortTex);
|
|
TEXTURE2D(_MaskTex);
|
|
SAMPLER(sampler_MaskTex);
|
|
TEXTURE2D(_DissolveTex);
|
|
SAMPLER(sampler_DissolveTex);
|
|
|
|
// Per-material instanced properties (same as Forward pass)
|
|
UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MaskTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DissolveTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MainColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DissolveColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _DistortTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _MainTex_ST)
|
|
UNITY_DEFINE_INSTANCED_PROP(half4, _FnlColor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CullMode)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortDissolveTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainAlpha)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _FnlScale)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _FnlPower)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _ReFnl)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveWide)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortMaskTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveFactor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CustomDissolve)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortFactor)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexAR)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortMainTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _CustomMainTex)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexVSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexUSpeed)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _Scr)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _BlendMode)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _Dst)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveSoft)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DepthFade)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexRotate)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MainTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _MaskTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DistortTexClampV)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexClampU)
|
|
UNITY_DEFINE_INSTANCED_PROP(half, _DissolveTexClampV)
|
|
UNITY_INSTANCING_BUFFER_END(UnityPerMaterial)
|
|
|
|
// Access macros (same as Forward pass)
|
|
#define _MaskTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTex_ST)
|
|
#define _DissolveTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTex_ST)
|
|
#define _MainColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainColor)
|
|
#define _DissolveColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveColor)
|
|
#define _DistortTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTex_ST)
|
|
#define _MainTex_ST_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTex_ST)
|
|
#define _FnlColor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlColor)
|
|
#define _DissolveTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexVSpeed)
|
|
#define _DistortDissolveTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortDissolveTex)
|
|
#define _MainAlpha_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainAlpha)
|
|
#define _FnlScale_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlScale)
|
|
#define _DissolveTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexUSpeed)
|
|
#define _FnlPower_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _FnlPower)
|
|
#define _MainTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexAR)
|
|
#define _MaskTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexAR)
|
|
#define _MaskTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexUSpeed)
|
|
#define _MaskTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexVSpeed)
|
|
#define _ReFnl_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _ReFnl)
|
|
#define _DissolveTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexAR)
|
|
#define _DissolveWide_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveWide)
|
|
#define _DistortMaskTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortMaskTex)
|
|
#define _DissolveFactor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveFactor)
|
|
#define _CustomDissolve_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _CustomDissolve)
|
|
#define _DistortFactor_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortFactor)
|
|
#define _DistortTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexVSpeed)
|
|
#define _DistortTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexUSpeed)
|
|
#define _DistortTexAR_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexAR)
|
|
#define _DistortMainTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortMainTex)
|
|
#define _CustomMainTex_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _CustomMainTex)
|
|
#define _MainTexVSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexVSpeed)
|
|
#define _MainTexUSpeed_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexUSpeed)
|
|
#define _Scr_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Scr)
|
|
#define _BlendMode_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _BlendMode)
|
|
#define _Dst_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Dst)
|
|
#define _DissolveSoft_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveSoft)
|
|
#define _DepthFade_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DepthFade)
|
|
#define _MainTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexRotate)
|
|
#define _MaskTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexRotate)
|
|
#define _DistortTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexRotate)
|
|
#define _DissolveTexRotate_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexRotate)
|
|
#define _MainTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexClampU)
|
|
#define _MainTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MainTexClampV)
|
|
#define _MaskTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexClampU)
|
|
#define _MaskTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _MaskTexClampV)
|
|
#define _DistortTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexClampU)
|
|
#define _DistortTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DistortTexClampV)
|
|
#define _DissolveTexClampU_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexClampU)
|
|
#define _DissolveTexClampV_Instanced UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _DissolveTexClampV)
|
|
|
|
|
|
|
|
VertexOutput VertexFunction( VertexInput v )
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
|
|
half3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal);
|
|
o.ase_texcoord4.xyz = ase_worldNormal;
|
|
float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz);
|
|
float4 screenPos = ComputeScreenPos(ase_clipPos);
|
|
o.ase_texcoord5 = screenPos;
|
|
|
|
o.ase_texcoord2.xy = v.ase_texcoord.xy;
|
|
o.ase_texcoord3 = v.ase_texcoord1;
|
|
o.ase_color = v.ase_color;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord2.zw = 0;
|
|
o.ase_texcoord4.w = 0;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = v.vertex.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3(0, 0, 0);
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
v.vertex.xyz = vertexValue;
|
|
#else
|
|
v.vertex.xyz += vertexValue;
|
|
#endif
|
|
|
|
v.ase_normal = v.ase_normal;
|
|
|
|
float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
o.worldPos = positionWS;
|
|
#endif
|
|
|
|
o.clipPos = TransformWorldToHClip( positionWS );
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
VertexPositionInputs vertexInput = (VertexPositionInputs)0;
|
|
vertexInput.positionWS = positionWS;
|
|
vertexInput.positionCS = o.clipPos;
|
|
o.shadowCoord = GetShadowCoord( vertexInput );
|
|
#endif
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float4 vertex : INTERNALTESSPOS;
|
|
float3 ase_normal : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
half4 ase_color : COLOR;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl vert ( VertexInput v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.vertex = v.vertex;
|
|
o.ase_normal = v.ase_normal;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
o.ase_texcoord1 = v.ase_texcoord1;
|
|
o.ase_color = v.ase_color;
|
|
return o;
|
|
}
|
|
|
|
TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
|
|
{
|
|
TessellationFactors o;
|
|
float4 tf = 1;
|
|
float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
|
|
float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
|
|
#endif
|
|
o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
|
|
return o;
|
|
}
|
|
|
|
[domain("tri")]
|
|
[partitioning("fractional_odd")]
|
|
[outputtopology("triangle_cw")]
|
|
[patchconstantfunc("TessellationFunction")]
|
|
[outputcontrolpoints(3)]
|
|
VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
|
|
{
|
|
return patch[id];
|
|
}
|
|
|
|
[domain("tri")]
|
|
VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
VertexInput o = (VertexInput) 0;
|
|
o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
|
|
o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
|
|
o.ase_texcoord1 = patch[0].ase_texcoord1 * bary.x + patch[1].ase_texcoord1 * bary.y + patch[2].ase_texcoord1 * bary.z;
|
|
o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z;
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
half4 frag(VertexOutput IN ) : SV_TARGET
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID(IN);
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
|
|
float3 WorldPosition = IN.worldPos;
|
|
#endif
|
|
float4 ShadowCoords = float4( 0, 0, 0, 0 );
|
|
|
|
#if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
ShadowCoords = IN.shadowCoord;
|
|
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
|
ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
|
|
#endif
|
|
#endif
|
|
|
|
// Use instanced properties (same logic as Forward pass, just for alpha)
|
|
half2 appendResult4_g13 = (half2(_MainTexUSpeed_Instanced , _MainTexVSpeed_Instanced));
|
|
half2 uv_MainTex = IN.ase_texcoord2.xy * _MainTex_ST_Instanced.xy + _MainTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g8 = uv_MainTex;
|
|
half2 appendResult4_g7 = (half2(_DistortTexUSpeed_Instanced , _DistortTexVSpeed_Instanced));
|
|
half2 uv_DistortTex = IN.ase_texcoord2.xy * _DistortTex_ST_Instanced.xy + _DistortTex_ST_Instanced.zw;
|
|
half2 _baseUV_distort = uv_DistortTex;
|
|
#if defined(_DISTORTTEXUVS_POLAR)
|
|
{ half2 _cuv_distort = IN.ase_texcoord2.xy - half2(0.5,0.5); _baseUV_distort = half2( length(_cuv_distort)*_DistortTex_ST_Instanced.x*2.0, atan2(_cuv_distort.x,_cuv_distort.y)*(1.0/6.28318548202515)*_DistortTex_ST_Instanced.y ) + _DistortTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_distort = (_DistortTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_distort = cos(_ra__baseUV_distort); half _rs__baseUV_distort = sin(_ra__baseUV_distort); _baseUV_distort = mul(_baseUV_distort - half2(0.5,0.5), half2x2(_rc__baseUV_distort,-_rs__baseUV_distort,_rs__baseUV_distort,_rc__baseUV_distort)) + half2(0.5,0.5); }
|
|
half2 panner5_g7 = ( 1.0 * _Time.y * appendResult4_g7 + _baseUV_distort);
|
|
{ half2 _cuv = panner5_g7; panner5_g7 = half2( (_DistortTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_DistortTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g7 = SAMPLE_TEXTURE2D( _DistortTex, sampler_DistortTex, panner5_g7 );
|
|
half Distort148 = ( ( _DistortTexAR_Instanced == 0.0 ? tex2DNode7_g7.a : tex2DNode7_g7.r ) * _DistortFactor_Instanced );
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch316 = ( _DistortMainTex_Instanced == 0.0 ? temp_output_3_0_g8 : ( temp_output_3_0_g8 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch316 = uv_MainTex;
|
|
#endif
|
|
half4 texCoord328 = IN.ase_texcoord3;
|
|
texCoord328.xy = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 );
|
|
half2 appendResult330 = (half2(texCoord328.x , texCoord328.y));
|
|
half2 _baseUV_main = (( _CustomMainTex_Instanced )?( ( staticSwitch316 + appendResult330 ) ):( staticSwitch316 ));
|
|
#if defined(_MAINTEXUVS_POLAR)
|
|
{ half2 _cuv_main = IN.ase_texcoord2.xy - half2(0.5,0.5); _baseUV_main = half2( length(_cuv_main)*_MainTex_ST_Instanced.x*2.0, atan2(_cuv_main.x,_cuv_main.y)*(1.0/6.28318548202515)*_MainTex_ST_Instanced.y ) + _MainTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_main = (_MainTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_main = cos(_ra__baseUV_main); half _rs__baseUV_main = sin(_ra__baseUV_main); _baseUV_main = mul(_baseUV_main - half2(0.5,0.5), half2x2(_rc__baseUV_main,-_rs__baseUV_main,_rs__baseUV_main,_rc__baseUV_main)) + half2(0.5,0.5); }
|
|
half2 panner5_g13 = ( 1.0 * _Time.y * appendResult4_g13 + _baseUV_main);
|
|
{ half2 _cuv = panner5_g13; panner5_g13 = half2( (_MainTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_MainTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g13 = SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, panner5_g13 );
|
|
float MainTexAlpha138 = ( _MainColor_Instanced.a * ( _MainTexAR_Instanced == 0.0 ? tex2DNode7_g13.a : tex2DNode7_g13.r ) );
|
|
half2 appendResult4_g14 = (half2(_MaskTexUSpeed_Instanced , _MaskTexVSpeed_Instanced));
|
|
half2 uv_MaskTex = IN.ase_texcoord2.xy * _MaskTex_ST_Instanced.xy + _MaskTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g12 = uv_MaskTex;
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch312 = ( _DistortMaskTex_Instanced == 0.0 ? temp_output_3_0_g12 : ( temp_output_3_0_g12 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch312 = uv_MaskTex;
|
|
#endif
|
|
half2 _baseUV_mask = staticSwitch312;
|
|
#if defined(_MASKTEXUVS_POLAR)
|
|
{ half2 _cuv_mask = IN.ase_texcoord2.xy - half2(0.5,0.5); _baseUV_mask = half2( length(_cuv_mask)*_MaskTex_ST_Instanced.x*2.0, atan2(_cuv_mask.x,_cuv_mask.y)*(1.0/6.28318548202515)*_MaskTex_ST_Instanced.y ) + _MaskTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_mask = (_MaskTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_mask = cos(_ra__baseUV_mask); half _rs__baseUV_mask = sin(_ra__baseUV_mask); _baseUV_mask = mul(_baseUV_mask - half2(0.5,0.5), half2x2(_rc__baseUV_mask,-_rs__baseUV_mask,_rs__baseUV_mask,_rc__baseUV_mask)) + half2(0.5,0.5); }
|
|
half2 panner5_g14 = ( 1.0 * _Time.y * appendResult4_g14 + _baseUV_mask);
|
|
{ half2 _cuv = panner5_g14; panner5_g14 = half2( (_MaskTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_MaskTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g14 = SAMPLE_TEXTURE2D( _MaskTex, sampler_MaskTex, panner5_g14 );
|
|
#ifdef _FMASKTEX_ON
|
|
half staticSwitch291 = ( _MaskTexAR_Instanced == 0.0 ? tex2DNode7_g14.a : tex2DNode7_g14.r );
|
|
#else
|
|
half staticSwitch291 = 1.0;
|
|
#endif
|
|
half Alpha337 = _MainAlpha_Instanced;
|
|
half4 texCoord333 = IN.ase_texcoord3;
|
|
texCoord333.xy = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 );
|
|
half temp_output_275_0 = (-_DissolveWide_Instanced + ((( _CustomDissolve_Instanced )?( texCoord333.z ):( _DissolveFactor_Instanced )) - 0.0) * (1.0 - -_DissolveWide_Instanced) / (1.0 - 0.0));
|
|
half temp_output_277_0 = ( _DissolveSoft_Instanced + 0.0001 );
|
|
half temp_output_270_0 = (-temp_output_277_0 + (temp_output_275_0 - 0.0) * (1.0 - -temp_output_277_0) / (1.0 - 0.0));
|
|
half2 appendResult4_g10 = (half2(_DissolveTexUSpeed_Instanced , _DissolveTexVSpeed_Instanced));
|
|
half2 uv_DissolveTex = IN.ase_texcoord2.xy * _DissolveTex_ST_Instanced.xy + _DissolveTex_ST_Instanced.zw;
|
|
half2 temp_output_3_0_g9 = uv_DissolveTex;
|
|
#ifdef _FDISTORTTEX_ON
|
|
half2 staticSwitch314 = ( _DistortDissolveTex_Instanced == 0.0 ? temp_output_3_0_g9 : ( temp_output_3_0_g9 + Distort148 ) );
|
|
#else
|
|
half2 staticSwitch314 = uv_DissolveTex;
|
|
#endif
|
|
half2 _baseUV_dissolve = staticSwitch314;
|
|
#if defined(_DISSOLVETEXUVS_POLAR)
|
|
{ half2 _cuv_dissolve = IN.ase_texcoord2.xy - half2(0.5,0.5); _baseUV_dissolve = half2( length(_cuv_dissolve)*_DissolveTex_ST_Instanced.x*2.0, atan2(_cuv_dissolve.x,_cuv_dissolve.y)*(1.0/6.28318548202515)*_DissolveTex_ST_Instanced.y ) + _DissolveTex_ST_Instanced.zw; }
|
|
#endif
|
|
{ half _ra__baseUV_dissolve = (_DissolveTexRotate_Instanced / 360.0) * PI * 2.0; half _rc__baseUV_dissolve = cos(_ra__baseUV_dissolve); half _rs__baseUV_dissolve = sin(_ra__baseUV_dissolve); _baseUV_dissolve = mul(_baseUV_dissolve - half2(0.5,0.5), half2x2(_rc__baseUV_dissolve,-_rs__baseUV_dissolve,_rs__baseUV_dissolve,_rc__baseUV_dissolve)) + half2(0.5,0.5); }
|
|
half2 panner5_g10 = ( 1.0 * _Time.y * appendResult4_g10 + _baseUV_dissolve);
|
|
{ half2 _cuv = panner5_g10; panner5_g10 = half2( (_DissolveTexClampU_Instanced==0.0 ? _cuv.x : clamp(_cuv.x,0.0,1.0)), (_DissolveTexClampV_Instanced==0.0 ? _cuv.y : clamp(_cuv.y,0.0,1.0)) ); }
|
|
half4 tex2DNode7_g10 = SAMPLE_TEXTURE2D( _DissolveTex, sampler_DissolveTex, panner5_g10 );
|
|
half temp_output_351_20 = ( _DissolveTexAR_Instanced == 0.0 ? tex2DNode7_g10.a : tex2DNode7_g10.r );
|
|
half smoothstepResult256 = smoothstep( temp_output_270_0 , ( temp_output_270_0 + temp_output_277_0 ) , temp_output_351_20);
|
|
half DissolveAlpha212 = smoothstepResult256;
|
|
#ifdef _FDISSOLVETEX_ON
|
|
half staticSwitch299 = DissolveAlpha212;
|
|
#else
|
|
half staticSwitch299 = 1.0;
|
|
#endif
|
|
half Refnl339 = _ReFnl_Instanced;
|
|
float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition );
|
|
ase_worldViewDir = normalize(ase_worldViewDir);
|
|
half3 ase_worldNormal = IN.ase_texcoord4.xyz;
|
|
half fresnelNdotV279 = dot( ase_worldNormal, ase_worldViewDir );
|
|
half fresnelNode279 = ( 0.0 + _FnlScale_Instanced * pow( 1.0 - fresnelNdotV279, _FnlPower_Instanced ) );
|
|
half temp_output_283_0 = saturate( fresnelNode279 );
|
|
half ReFnlAlpha318 = ( 1.0 - temp_output_283_0 );
|
|
#ifdef _FFNL_ON
|
|
half staticSwitch319 = ( Refnl339 == 0.0 ? 1.0 : ReFnlAlpha318 );
|
|
#else
|
|
half staticSwitch319 = 1.0;
|
|
#endif
|
|
float4 screenPos = IN.ase_texcoord5;
|
|
half4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float screenDepth375 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams);
|
|
half distanceDepth375 = abs( ( screenDepth375 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _DepthFade_Instanced ) );
|
|
#ifdef _FDEPTH_ON
|
|
half staticSwitch378 = saturate( distanceDepth375 );
|
|
#else
|
|
half staticSwitch378 = 1.0;
|
|
#endif
|
|
float MainAlpha97 = saturate( ( MainTexAlpha138 * staticSwitch291 * IN.ase_color.a * Alpha337 * staticSwitch299 * staticSwitch319 * staticSwitch378 ) );
|
|
|
|
float Alpha = MainAlpha97;
|
|
float AlphaClipThreshold = 0.5;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
clip(Alpha - AlphaClipThreshold);
|
|
#endif
|
|
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
|
|
#endif
|
|
return 0;
|
|
}
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
}
|
|
|
|
CustomEditor "SampleGUI"
|
|
Fallback "Hidden/InternalErrorShader"
|
|
|
|
}
|