2190 lines
88 KiB
GLSL
2190 lines
88 KiB
GLSL
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "ASESampleShaders/Omni Decal/SRP HD Omni Decal"
|
|
{
|
|
Properties
|
|
{
|
|
[HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
|
|
[HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
|
|
[ASEBegin]_Size("Size", Range( 0 , 1)) = 1
|
|
_Rampfalloff("Ramp falloff", Range( 0.01 , 5)) = 5
|
|
[ASEEnd]_Ramp("Ramp", 2D) = "white" {}
|
|
|
|
[HideInInspector]_RenderQueueType("Render Queue Type", Float) = 5
|
|
[HideInInspector][ToggleUI]_AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1
|
|
//[HideInInspector]_ShadowMatteFilter("Shadow Matte Filter", Float) = 2
|
|
[HideInInspector]_StencilRef("Stencil Ref", Int) = 0
|
|
[HideInInspector]_StencilWriteMask("StencilWrite Mask", Int) = 6
|
|
[HideInInspector]_StencilRefDepth("StencilRefDepth", Int) = 0
|
|
[HideInInspector]_StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 8
|
|
[HideInInspector]_StencilRefMV("_StencilRefMV", Int) = 32
|
|
[HideInInspector]_StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 40
|
|
[HideInInspector]_StencilRefDistortionVec("_StencilRefDistortionVec", Int) = 4
|
|
[HideInInspector]_StencilWriteMaskDistortionVec("_StencilWriteMaskDistortionVec", Int) = 4
|
|
[HideInInspector]_StencilWriteMaskGBuffer("_StencilWriteMaskGBuffer", Int) = 14
|
|
[HideInInspector]_StencilRefGBuffer("_StencilRefGBuffer", Int) = 2
|
|
[HideInInspector]_ZTestGBuffer("_ZTestGBuffer", Int) = 4
|
|
[HideInInspector][ToggleUI]_RequireSplitLighting("_RequireSplitLighting", Float) = 0
|
|
[HideInInspector][ToggleUI]_ReceivesSSR("_ReceivesSSR", Float) = 0
|
|
[HideInInspector]_SurfaceType("_SurfaceType", Float) = 1
|
|
[HideInInspector]_BlendMode("_BlendMode", Float) = 0
|
|
[HideInInspector]_SrcBlend("_SrcBlend", Float) = 1
|
|
[HideInInspector]_DstBlend("_DstBlend", Float) = 0
|
|
[HideInInspector]_AlphaSrcBlend("Vec_AlphaSrcBlendtor1", Float) = 1
|
|
[HideInInspector]_AlphaDstBlend("_AlphaDstBlend", Float) = 0
|
|
[HideInInspector][ToggleUI]_ZWrite("_ZWrite", Float) = 1
|
|
[HideInInspector][ToggleUI]_TransparentZWrite("_TransparentZWrite", Float) = 1
|
|
[HideInInspector]_CullMode("Cull Mode", Float) = 2
|
|
[HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Int) = 0
|
|
[HideInInspector][ToggleUI]_EnableFogOnTransparent("_EnableFogOnTransparent", Float) = 1
|
|
[HideInInspector]_CullModeForward("_CullModeForward", Float) = 2
|
|
[HideInInspector][Enum(Front, 1, Back, 2)]_TransparentCullMode("_TransparentCullMode", Float) = 1
|
|
[HideInInspector]_ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4
|
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("_ZTestTransparent", Float) = 8
|
|
[HideInInspector][ToggleUI]_TransparentBackfaceEnable("_TransparentBackfaceEnable", Float) = 0
|
|
[HideInInspector][ToggleUI]_AlphaCutoffEnable("_AlphaCutoffEnable", Float) = 0
|
|
[HideInInspector][ToggleUI]_UseShadowThreshold("_UseShadowThreshold", Float) = 0
|
|
[HideInInspector][ToggleUI]_DoubleSidedEnable("_DoubleSidedEnable", Float) = 0
|
|
[HideInInspector][Enum(Flip, 0, Mirror, 1, None, 2)]_DoubleSidedNormalMode("_DoubleSidedNormalMode", Float) = 2
|
|
[HideInInspector]_DoubleSidedConstants("_DoubleSidedConstants", Vector) = (1, 1, -1, 0)
|
|
[HideInInspector]_DistortionEnable("_DistortionEnable",Float) = 0
|
|
[HideInInspector]_DistortionOnly("_DistortionOnly",Float) = 0
|
|
//_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
|
|
//_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
|
|
//_TessMin( "Tess Min Distance", Float ) = 10
|
|
//_TessMax( "Tess Max Distance", Float ) = 25
|
|
//_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
|
|
//_TessMaxDisp( "Tess Max Displacement", Float ) = 25
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
LOD 0
|
|
|
|
|
|
|
|
Tags { "RenderPipeline"="HDRenderPipeline" "RenderType"="Opaque" "Queue"="Transparent" }
|
|
|
|
HLSLINCLUDE
|
|
#pragma target 4.5
|
|
#pragma only_renderers d3d11 metal vulkan xboxone xboxseries playstation switch
|
|
#pragma instancing_options renderinglayer
|
|
|
|
#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 DistanceFromPlaneASE (float3 pos, float4 plane)
|
|
{
|
|
return dot (float4(pos,1.0f), plane);
|
|
}
|
|
|
|
bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
|
|
{
|
|
float4 planeTest;
|
|
planeTest.x = (( DistanceFromPlaneASE(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.y = (( DistanceFromPlaneASE(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.z = (( DistanceFromPlaneASE(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
|
|
planeTest.w = (( DistanceFromPlaneASE(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
|
|
(( DistanceFromPlaneASE(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 Unlit"
|
|
Tags { "LightMode"="ForwardOnly" }
|
|
|
|
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
|
Cull [_CullMode]
|
|
ZTest [_ZTestTransparent]
|
|
ZWrite [_ZWrite]
|
|
|
|
Stencil
|
|
{
|
|
Ref [_StencilRef]
|
|
WriteMask [_StencilWriteMask]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
HLSLPROGRAM
|
|
#pragma multi_compile_instancing
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
#define SHADERPASS SHADERPASS_FORWARD_UNLIT
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl"
|
|
|
|
#if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT
|
|
#define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER
|
|
#define HAS_LIGHTLOOP
|
|
#define SHADOW_OPTIMIZE_REGISTER_USAGE 1
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PunctualLightCommon.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl"
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 positionRWS : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float _Size;
|
|
float _Rampfalloff;
|
|
float4 _EmissionColor;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#endif
|
|
#ifdef _ENABLE_SHADOW_MATTE
|
|
float _ShadowMatteFilter;
|
|
#endif
|
|
float _StencilRef;
|
|
float _StencilWriteMask;
|
|
float _StencilRefDepth;
|
|
float _StencilWriteMaskDepth;
|
|
float _StencilRefMV;
|
|
float _StencilWriteMaskMV;
|
|
float _StencilRefDistortionVec;
|
|
float _StencilWriteMaskDistortionVec;
|
|
float _StencilWriteMaskGBuffer;
|
|
float _StencilRefGBuffer;
|
|
float _ZTestGBuffer;
|
|
float _RequireSplitLighting;
|
|
float _ReceivesSSR;
|
|
float _SurfaceType;
|
|
float _BlendMode;
|
|
float _SrcBlend;
|
|
float _DstBlend;
|
|
float _AlphaSrcBlend;
|
|
float _AlphaDstBlend;
|
|
float _ZWrite;
|
|
float _TransparentZWrite;
|
|
float _CullMode;
|
|
float _TransparentSortPriority;
|
|
float _EnableFogOnTransparent;
|
|
float _CullModeForward;
|
|
float _TransparentCullMode;
|
|
float _ZTestDepthEqualForOpaque;
|
|
float _ZTestTransparent;
|
|
float _TransparentBackfaceEnable;
|
|
float _AlphaCutoffEnable;
|
|
float _AlphaCutoff;
|
|
float _UseShadowThreshold;
|
|
float _DoubleSidedEnable;
|
|
float _DoubleSidedNormalMode;
|
|
float4 _DoubleSidedConstants;
|
|
#ifdef TESSELLATION_ON
|
|
float _TessPhongStrength;
|
|
float _TessValue;
|
|
float _TessMin;
|
|
float _TessMax;
|
|
float _TessEdgeLength;
|
|
float _TessMaxDisp;
|
|
#endif
|
|
CBUFFER_END
|
|
sampler2D _Ramp;
|
|
float4x4 unity_CameraProjection;
|
|
float4x4 unity_CameraInvProjection;
|
|
float4x4 unity_WorldToCamera;
|
|
float4x4 unity_CameraToWorld;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
float2 UnStereo( float2 UV )
|
|
{
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex ];
|
|
UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy;
|
|
#endif
|
|
return UV;
|
|
}
|
|
|
|
float3 InvertDepthDirHD73_g8( float3 In )
|
|
{
|
|
float3 result = In;
|
|
#if !defined(ASE_SRP_VERSION) || ASE_SRP_VERSION <= 70301 || ASE_SRP_VERSION == 70503 || ASE_SRP_VERSION == 70600 || ASE_SRP_VERSION == 70700 || ASE_SRP_VERSION == 70701 || ASE_SRP_VERSION >= 80301
|
|
result *= float3(1,1,-1);
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
|
|
struct SurfaceDescription
|
|
{
|
|
float3 Color;
|
|
float3 Emission;
|
|
float4 ShadowTint;
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
surfaceData.color = surfaceDescription.Color;
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription , FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#if _ALPHATEST_ON
|
|
DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
|
|
|
|
#if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT
|
|
HDShadowContext shadowContext = InitShadowContext();
|
|
float shadow;
|
|
float3 shadow3;
|
|
posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
|
|
float3 normalWS = normalize(fragInputs.tangentToWorld[1]);
|
|
uint renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
|
|
ShadowLoopMin(shadowContext, posInput, normalWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3);
|
|
shadow = dot(shadow3, float3(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f));
|
|
|
|
float4 shadowColor = (1 - shadow)*surfaceDescription.ShadowTint.rgba;
|
|
float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha);
|
|
|
|
#ifdef _SURFACE_TYPE_TRANSPARENT
|
|
surfaceData.color = lerp(shadowColor.rgb*surfaceData.color, lerp(lerp(shadowColor.rgb, surfaceData.color, 1 - surfaceDescription.ShadowTint.a), surfaceData.color, shadow), surfaceDescription.Alpha);
|
|
#else
|
|
surfaceData.color = lerp(lerp(shadowColor.rgb, surfaceData.color, 1 - surfaceDescription.ShadowTint.a), surfaceData.color, shadow);
|
|
#endif
|
|
localAlpha = ApplyBlendMode(surfaceData.color, localAlpha).a;
|
|
surfaceDescription.Alpha = localAlpha;
|
|
#endif
|
|
|
|
ZERO_INITIALIZE(BuiltinData, builtinData);
|
|
builtinData.opacity = surfaceDescription.Alpha;
|
|
builtinData.emissiveColor = surfaceDescription.Emission;
|
|
}
|
|
|
|
VertexOutput VertexFunction( VertexInput inputMesh )
|
|
{
|
|
VertexOutput o;
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS));
|
|
float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x );
|
|
o.ase_texcoord1 = screenPos;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
o.positionCS = TransformWorldToHClip(positionRWS);
|
|
o.positionRWS = positionRWS;
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
|
|
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.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
|
|
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 (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
|
|
float3 cameraPos = 0;
|
|
#else
|
|
float3 cameraPos = _WorldSpaceCameraPos;
|
|
#endif
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes );
|
|
#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.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
|
|
o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
|
|
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput Vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
float4 Frag( VertexOutput packedInput ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
input.tangentToWorld = k_identity3x3;
|
|
float3 positionRWS = packedInput.positionRWS;
|
|
|
|
input.positionSS = packedInput.positionCS;
|
|
input.positionRWS = positionRWS;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir( input.positionRWS );
|
|
|
|
SurfaceDescription surfaceDescription = (SurfaceDescription)0;
|
|
float4 transform114 = mul(GetObjectToWorldMatrix(),float4( 0,0,0,1 ));
|
|
transform114.xyz = GetAbsolutePositionWS((transform114).xyz);
|
|
float4 screenPos = packedInput.ase_texcoord1;
|
|
float4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float2 UV22_g9 = ase_screenPosNorm.xy;
|
|
float2 localUnStereo22_g9 = UnStereo( UV22_g9 );
|
|
float2 break64_g8 = localUnStereo22_g9;
|
|
float clampDepth69_g8 = SampleCameraDepth( ase_screenPosNorm.xy );
|
|
#ifdef UNITY_REVERSED_Z
|
|
float staticSwitch38_g8 = ( 1.0 - clampDepth69_g8 );
|
|
#else
|
|
float staticSwitch38_g8 = clampDepth69_g8;
|
|
#endif
|
|
float3 appendResult39_g8 = (float3(break64_g8.x , break64_g8.y , staticSwitch38_g8));
|
|
float4 appendResult42_g8 = (float4((appendResult39_g8*2.0 + -1.0) , 1.0));
|
|
float4 temp_output_43_0_g8 = mul( unity_CameraInvProjection, appendResult42_g8 );
|
|
float3 temp_output_46_0_g8 = ( (temp_output_43_0_g8).xyz / (temp_output_43_0_g8).w );
|
|
float3 In73_g8 = temp_output_46_0_g8;
|
|
float3 localInvertDepthDirHD73_g8 = InvertDepthDirHD73_g8( In73_g8 );
|
|
float4 appendResult49_g8 = (float4(localInvertDepthDirHD73_g8 , 1.0));
|
|
float3 ase_objectScale = float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) );
|
|
float temp_output_184_0 = ( 1.0 - saturate( pow( ( length( abs( (( transform114 - mul( unity_CameraToWorld, appendResult49_g8 ) )).xyz ) ) / ( max( max( ase_objectScale.x , ase_objectScale.y ) , ase_objectScale.z ) * 0.5 * _Size ) ) , _Rampfalloff ) ) );
|
|
float2 temp_cast_1 = (temp_output_184_0).xx;
|
|
|
|
surfaceDescription.Color = tex2Dlod( _Ramp, float4( temp_cast_1, 0, 0.0) ).rgb;
|
|
surfaceDescription.Emission = 0;
|
|
surfaceDescription.Alpha = temp_output_184_0;
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
surfaceDescription.ShadowTint = float4( 0, 0 ,0 ,1 );
|
|
float2 Distortion = float2 ( 0, 0 );
|
|
float DistortionBlur = 0;
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData);
|
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData( input.positionSS.xy, surfaceData );
|
|
|
|
float4 outColor = ApplyBlendMode( bsdfData.color + builtinData.emissiveColor * GetCurrentExposureMultiplier(), builtinData.opacity );
|
|
outColor = EvaluateAtmosphericScattering( posInput, V, outColor );
|
|
|
|
#ifdef DEBUG_DISPLAY
|
|
int bufferSize = int(_DebugViewMaterialArray[0].x);
|
|
for (int index = 1; index <= bufferSize; index++)
|
|
{
|
|
int indexMaterialProperty = int(_DebugViewMaterialArray[index].x);
|
|
if (indexMaterialProperty != 0)
|
|
{
|
|
float3 result = float3(1.0, 0.0, 1.0);
|
|
bool needLinearToSRGB = false;
|
|
|
|
GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB);
|
|
GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB);
|
|
GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB);
|
|
GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB);
|
|
GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB);
|
|
|
|
if (!needLinearToSRGB)
|
|
result = SRGBToLinear(max(0, result));
|
|
|
|
outColor = float4(result, 1.0);
|
|
}
|
|
}
|
|
|
|
if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW)
|
|
{
|
|
float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A);
|
|
outColor = result;
|
|
}
|
|
#endif
|
|
return outColor;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "META"
|
|
Tags { "LightMode"="Meta" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
#pragma multi_compile_instancing
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
#define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl"
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float _Size;
|
|
float _Rampfalloff;
|
|
float4 _EmissionColor;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#endif
|
|
#ifdef _ENABLE_SHADOW_MATTE
|
|
float _ShadowMatteFilter;
|
|
#endif
|
|
float _StencilRef;
|
|
float _StencilWriteMask;
|
|
float _StencilRefDepth;
|
|
float _StencilWriteMaskDepth;
|
|
float _StencilRefMV;
|
|
float _StencilWriteMaskMV;
|
|
float _StencilRefDistortionVec;
|
|
float _StencilWriteMaskDistortionVec;
|
|
float _StencilWriteMaskGBuffer;
|
|
float _StencilRefGBuffer;
|
|
float _ZTestGBuffer;
|
|
float _RequireSplitLighting;
|
|
float _ReceivesSSR;
|
|
float _SurfaceType;
|
|
float _BlendMode;
|
|
float _SrcBlend;
|
|
float _DstBlend;
|
|
float _AlphaSrcBlend;
|
|
float _AlphaDstBlend;
|
|
float _ZWrite;
|
|
float _TransparentZWrite;
|
|
float _CullMode;
|
|
float _TransparentSortPriority;
|
|
float _EnableFogOnTransparent;
|
|
float _CullModeForward;
|
|
float _TransparentCullMode;
|
|
float _ZTestDepthEqualForOpaque;
|
|
float _ZTestTransparent;
|
|
float _TransparentBackfaceEnable;
|
|
float _AlphaCutoffEnable;
|
|
float _AlphaCutoff;
|
|
float _UseShadowThreshold;
|
|
float _DoubleSidedEnable;
|
|
float _DoubleSidedNormalMode;
|
|
float4 _DoubleSidedConstants;
|
|
#ifdef TESSELLATION_ON
|
|
float _TessPhongStrength;
|
|
float _TessValue;
|
|
float _TessMin;
|
|
float _TessMax;
|
|
float _TessEdgeLength;
|
|
float _TessMaxDisp;
|
|
#endif
|
|
CBUFFER_END
|
|
|
|
CBUFFER_START( UnityMetaPass )
|
|
bool4 unity_MetaVertexControl;
|
|
bool4 unity_MetaFragmentControl;
|
|
CBUFFER_END
|
|
|
|
float unity_OneOverOutputBoost;
|
|
float unity_MaxOutputValue;
|
|
sampler2D _Ramp;
|
|
float4x4 unity_CameraProjection;
|
|
float4x4 unity_CameraInvProjection;
|
|
float4x4 unity_WorldToCamera;
|
|
float4x4 unity_CameraToWorld;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
|
|
float2 UnStereo( float2 UV )
|
|
{
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex ];
|
|
UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy;
|
|
#endif
|
|
return UV;
|
|
}
|
|
|
|
float3 InvertDepthDirHD73_g8( float3 In )
|
|
{
|
|
float3 result = In;
|
|
#if !defined(ASE_SRP_VERSION) || ASE_SRP_VERSION <= 70301 || ASE_SRP_VERSION == 70503 || ASE_SRP_VERSION == 70600 || ASE_SRP_VERSION == 70700 || ASE_SRP_VERSION == 70701 || ASE_SRP_VERSION >= 80301
|
|
result *= float3(1,1,-1);
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
|
|
struct SurfaceDescription
|
|
{
|
|
float3 Color;
|
|
float3 Emission;
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
void BuildSurfaceData( FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
|
|
{
|
|
ZERO_INITIALIZE( SurfaceData, surfaceData );
|
|
surfaceData.color = surfaceDescription.Color;
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData( SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData )
|
|
{
|
|
#if _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, surfaceData );
|
|
ZERO_INITIALIZE( BuiltinData, builtinData );
|
|
builtinData.opacity = surfaceDescription.Alpha;
|
|
builtinData.emissiveColor = surfaceDescription.Emission;
|
|
}
|
|
|
|
VertexOutput VertexFunction( VertexInput inputMesh )
|
|
{
|
|
VertexOutput o;
|
|
UNITY_SETUP_INSTANCE_ID( inputMesh );
|
|
UNITY_TRANSFER_INSTANCE_ID( inputMesh, o );
|
|
|
|
float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS));
|
|
float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x );
|
|
o.ase_texcoord = screenPos;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue ;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
|
|
float2 uv = float2( 0.0, 0.0 );
|
|
if( unity_MetaVertexControl.x )
|
|
{
|
|
uv = inputMesh.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
|
|
}
|
|
else if( unity_MetaVertexControl.y )
|
|
{
|
|
uv = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
|
}
|
|
|
|
o.positionCS = float4( uv * 2.0 - 1.0, inputMesh.positionOS.z > 0 ? 1.0e-4 : 0.0, 1.0 );
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
|
|
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.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.uv1 = v.uv1;
|
|
o.uv2 = v.uv2;
|
|
|
|
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 (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
|
|
float3 cameraPos = 0;
|
|
#else
|
|
float3 cameraPos = _WorldSpaceCameraPos;
|
|
#endif
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes );
|
|
#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.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
|
|
o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
|
|
o.uv1 = patch[0].uv1 * bary.x + patch[1].uv1 * bary.y + patch[2].uv1 * bary.z;
|
|
o.uv2 = patch[0].uv2 * bary.x + patch[1].uv2 * bary.y + patch[2].uv2 * bary.z;
|
|
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput Vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
float4 Frag( VertexOutput packedInput ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE( FragInputs, input );
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
PositionInputs posInput = GetPositionInput( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
|
|
|
|
float3 V = float3( 1.0, 1.0, 1.0 );
|
|
|
|
SurfaceDescription surfaceDescription = (SurfaceDescription)0;
|
|
float4 transform114 = mul(GetObjectToWorldMatrix(),float4( 0,0,0,1 ));
|
|
transform114.xyz = GetAbsolutePositionWS((transform114).xyz);
|
|
float4 screenPos = packedInput.ase_texcoord;
|
|
float4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float2 UV22_g9 = ase_screenPosNorm.xy;
|
|
float2 localUnStereo22_g9 = UnStereo( UV22_g9 );
|
|
float2 break64_g8 = localUnStereo22_g9;
|
|
float clampDepth69_g8 = SampleCameraDepth( ase_screenPosNorm.xy );
|
|
#ifdef UNITY_REVERSED_Z
|
|
float staticSwitch38_g8 = ( 1.0 - clampDepth69_g8 );
|
|
#else
|
|
float staticSwitch38_g8 = clampDepth69_g8;
|
|
#endif
|
|
float3 appendResult39_g8 = (float3(break64_g8.x , break64_g8.y , staticSwitch38_g8));
|
|
float4 appendResult42_g8 = (float4((appendResult39_g8*2.0 + -1.0) , 1.0));
|
|
float4 temp_output_43_0_g8 = mul( unity_CameraInvProjection, appendResult42_g8 );
|
|
float3 temp_output_46_0_g8 = ( (temp_output_43_0_g8).xyz / (temp_output_43_0_g8).w );
|
|
float3 In73_g8 = temp_output_46_0_g8;
|
|
float3 localInvertDepthDirHD73_g8 = InvertDepthDirHD73_g8( In73_g8 );
|
|
float4 appendResult49_g8 = (float4(localInvertDepthDirHD73_g8 , 1.0));
|
|
float3 ase_objectScale = float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) );
|
|
float temp_output_184_0 = ( 1.0 - saturate( pow( ( length( abs( (( transform114 - mul( unity_CameraToWorld, appendResult49_g8 ) )).xyz ) ) / ( max( max( ase_objectScale.x , ase_objectScale.y ) , ase_objectScale.z ) * 0.5 * _Size ) ) , _Rampfalloff ) ) );
|
|
float2 temp_cast_1 = (temp_output_184_0).xx;
|
|
|
|
surfaceDescription.Color = tex2Dlod( _Ramp, float4( temp_cast_1, 0, 0.0) ).rgb;
|
|
surfaceDescription.Emission = 0;
|
|
surfaceDescription.Alpha = temp_output_184_0;
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData( surfaceDescription,input, V, posInput, surfaceData, builtinData );
|
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData( input.positionSS.xy, surfaceData );
|
|
LightTransportData lightTransportData = GetLightTransportData( surfaceData, builtinData, bsdfData );
|
|
|
|
float4 res = float4( 0.0, 0.0, 0.0, 1.0 );
|
|
if( unity_MetaFragmentControl.x )
|
|
{
|
|
res.rgb = clamp( pow( abs( lightTransportData.diffuseColor ), saturate( unity_OneOverOutputBoost ) ), 0, unity_MaxOutputValue );
|
|
}
|
|
|
|
if( unity_MetaFragmentControl.y )
|
|
{
|
|
res.rgb = lightTransportData.emissiveColor;
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "SceneSelectionPass"
|
|
Tags { "LightMode"="SceneSelectionPass" }
|
|
|
|
Cull [_CullMode]
|
|
ZWrite On
|
|
|
|
ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
#pragma multi_compile_instancing
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
|
#define SCENESELECTIONPASS
|
|
#pragma editor_sync_compilation
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl"
|
|
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float _Size;
|
|
float _Rampfalloff;
|
|
float4 _EmissionColor;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#endif
|
|
#ifdef _ENABLE_SHADOW_MATTE
|
|
float _ShadowMatteFilter;
|
|
#endif
|
|
float _StencilRef;
|
|
float _StencilWriteMask;
|
|
float _StencilRefDepth;
|
|
float _StencilWriteMaskDepth;
|
|
float _StencilRefMV;
|
|
float _StencilWriteMaskMV;
|
|
float _StencilRefDistortionVec;
|
|
float _StencilWriteMaskDistortionVec;
|
|
float _StencilWriteMaskGBuffer;
|
|
float _StencilRefGBuffer;
|
|
float _ZTestGBuffer;
|
|
float _RequireSplitLighting;
|
|
float _ReceivesSSR;
|
|
float _SurfaceType;
|
|
float _BlendMode;
|
|
float _SrcBlend;
|
|
float _DstBlend;
|
|
float _AlphaSrcBlend;
|
|
float _AlphaDstBlend;
|
|
float _ZWrite;
|
|
float _TransparentZWrite;
|
|
float _CullMode;
|
|
float _TransparentSortPriority;
|
|
float _EnableFogOnTransparent;
|
|
float _CullModeForward;
|
|
float _TransparentCullMode;
|
|
float _ZTestDepthEqualForOpaque;
|
|
float _ZTestTransparent;
|
|
float _TransparentBackfaceEnable;
|
|
float _AlphaCutoffEnable;
|
|
float _AlphaCutoff;
|
|
float _UseShadowThreshold;
|
|
float _DoubleSidedEnable;
|
|
float _DoubleSidedNormalMode;
|
|
float4 _DoubleSidedConstants;
|
|
#ifdef TESSELLATION_ON
|
|
float _TessPhongStrength;
|
|
float _TessValue;
|
|
float _TessMin;
|
|
float _TessMax;
|
|
float _TessEdgeLength;
|
|
float _TessMaxDisp;
|
|
#endif
|
|
CBUFFER_END
|
|
float4x4 unity_CameraProjection;
|
|
float4x4 unity_CameraInvProjection;
|
|
float4x4 unity_WorldToCamera;
|
|
float4x4 unity_CameraToWorld;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
|
|
float2 UnStereo( float2 UV )
|
|
{
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex ];
|
|
UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy;
|
|
#endif
|
|
return UV;
|
|
}
|
|
|
|
float3 InvertDepthDirHD73_g8( float3 In )
|
|
{
|
|
float3 result = In;
|
|
#if !defined(ASE_SRP_VERSION) || ASE_SRP_VERSION <= 70301 || ASE_SRP_VERSION == 70503 || ASE_SRP_VERSION == 70600 || ASE_SRP_VERSION == 70700 || ASE_SRP_VERSION == 70701 || ASE_SRP_VERSION >= 80301
|
|
result *= float3(1,1,-1);
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
|
|
struct SurfaceDescription
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#if _ALPHATEST_ON
|
|
DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
|
|
ZERO_INITIALIZE(BuiltinData, builtinData);
|
|
builtinData.opacity = surfaceDescription.Alpha;
|
|
}
|
|
|
|
VertexOutput VertexFunction( VertexInput inputMesh )
|
|
{
|
|
VertexOutput o;
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS));
|
|
float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x );
|
|
o.ase_texcoord = screenPos;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue ;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
o.positionCS = TransformWorldToHClip(positionRWS);
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
|
|
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.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
|
|
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 (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
|
|
float3 cameraPos = 0;
|
|
#else
|
|
float3 cameraPos = _WorldSpaceCameraPos;
|
|
#endif
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes );
|
|
#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.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
|
|
o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
|
|
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput Vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( VertexOutput packedInput
|
|
, out float4 outColor : SV_Target0
|
|
#ifdef _DEPTHOFFSET_ON
|
|
, out float outputDepth : SV_Depth
|
|
#endif
|
|
|
|
)
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = float3( 1.0, 1.0, 1.0 );
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
SurfaceDescription surfaceDescription = (SurfaceDescription)0;
|
|
float4 transform114 = mul(GetObjectToWorldMatrix(),float4( 0,0,0,1 ));
|
|
transform114.xyz = GetAbsolutePositionWS((transform114).xyz);
|
|
float4 screenPos = packedInput.ase_texcoord;
|
|
float4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float2 UV22_g9 = ase_screenPosNorm.xy;
|
|
float2 localUnStereo22_g9 = UnStereo( UV22_g9 );
|
|
float2 break64_g8 = localUnStereo22_g9;
|
|
float clampDepth69_g8 = SampleCameraDepth( ase_screenPosNorm.xy );
|
|
#ifdef UNITY_REVERSED_Z
|
|
float staticSwitch38_g8 = ( 1.0 - clampDepth69_g8 );
|
|
#else
|
|
float staticSwitch38_g8 = clampDepth69_g8;
|
|
#endif
|
|
float3 appendResult39_g8 = (float3(break64_g8.x , break64_g8.y , staticSwitch38_g8));
|
|
float4 appendResult42_g8 = (float4((appendResult39_g8*2.0 + -1.0) , 1.0));
|
|
float4 temp_output_43_0_g8 = mul( unity_CameraInvProjection, appendResult42_g8 );
|
|
float3 temp_output_46_0_g8 = ( (temp_output_43_0_g8).xyz / (temp_output_43_0_g8).w );
|
|
float3 In73_g8 = temp_output_46_0_g8;
|
|
float3 localInvertDepthDirHD73_g8 = InvertDepthDirHD73_g8( In73_g8 );
|
|
float4 appendResult49_g8 = (float4(localInvertDepthDirHD73_g8 , 1.0));
|
|
float3 ase_objectScale = float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) );
|
|
float temp_output_184_0 = ( 1.0 - saturate( pow( ( length( abs( (( transform114 - mul( unity_CameraToWorld, appendResult49_g8 ) )).xyz ) ) / ( max( max( ase_objectScale.x , ase_objectScale.y ) , ase_objectScale.z ) * 0.5 * _Size ) ) , _Rampfalloff ) ) );
|
|
|
|
surfaceDescription.Alpha = temp_output_184_0;
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
|
|
GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData);
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
outputDepth = posInput.deviceDepth;
|
|
#endif
|
|
|
|
outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 );
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "DepthForwardOnly"
|
|
Tags { "LightMode"="DepthForwardOnly" }
|
|
|
|
Cull [_CullMode]
|
|
ZWrite On
|
|
Stencil
|
|
{
|
|
Ref [_StencilRefDepth]
|
|
WriteMask [_StencilWriteMaskDepth]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
|
|
ColorMask 0 0
|
|
|
|
HLSLPROGRAM
|
|
#pragma multi_compile_instancing
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
|
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl"
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float _Size;
|
|
float _Rampfalloff;
|
|
float4 _EmissionColor;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#endif
|
|
#ifdef _ENABLE_SHADOW_MATTE
|
|
float _ShadowMatteFilter;
|
|
#endif
|
|
float _StencilRef;
|
|
float _StencilWriteMask;
|
|
float _StencilRefDepth;
|
|
float _StencilWriteMaskDepth;
|
|
float _StencilRefMV;
|
|
float _StencilWriteMaskMV;
|
|
float _StencilRefDistortionVec;
|
|
float _StencilWriteMaskDistortionVec;
|
|
float _StencilWriteMaskGBuffer;
|
|
float _StencilRefGBuffer;
|
|
float _ZTestGBuffer;
|
|
float _RequireSplitLighting;
|
|
float _ReceivesSSR;
|
|
float _SurfaceType;
|
|
float _BlendMode;
|
|
float _SrcBlend;
|
|
float _DstBlend;
|
|
float _AlphaSrcBlend;
|
|
float _AlphaDstBlend;
|
|
float _ZWrite;
|
|
float _TransparentZWrite;
|
|
float _CullMode;
|
|
float _TransparentSortPriority;
|
|
float _EnableFogOnTransparent;
|
|
float _CullModeForward;
|
|
float _TransparentCullMode;
|
|
float _ZTestDepthEqualForOpaque;
|
|
float _ZTestTransparent;
|
|
float _TransparentBackfaceEnable;
|
|
float _AlphaCutoffEnable;
|
|
float _AlphaCutoff;
|
|
float _UseShadowThreshold;
|
|
float _DoubleSidedEnable;
|
|
float _DoubleSidedNormalMode;
|
|
float4 _DoubleSidedConstants;
|
|
#ifdef TESSELLATION_ON
|
|
float _TessPhongStrength;
|
|
float _TessValue;
|
|
float _TessMin;
|
|
float _TessMax;
|
|
float _TessEdgeLength;
|
|
float _TessMaxDisp;
|
|
#endif
|
|
CBUFFER_END
|
|
float4x4 unity_CameraProjection;
|
|
float4x4 unity_CameraInvProjection;
|
|
float4x4 unity_WorldToCamera;
|
|
float4x4 unity_CameraToWorld;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
float2 UnStereo( float2 UV )
|
|
{
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex ];
|
|
UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy;
|
|
#endif
|
|
return UV;
|
|
}
|
|
|
|
float3 InvertDepthDirHD73_g8( float3 In )
|
|
{
|
|
float3 result = In;
|
|
#if !defined(ASE_SRP_VERSION) || ASE_SRP_VERSION <= 70301 || ASE_SRP_VERSION == 70503 || ASE_SRP_VERSION == 70600 || ASE_SRP_VERSION == 70700 || ASE_SRP_VERSION == 70701 || ASE_SRP_VERSION >= 80301
|
|
result *= float3(1,1,-1);
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
|
|
struct SurfaceDescription
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#if _ALPHATEST_ON
|
|
DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
|
|
ZERO_INITIALIZE(BuiltinData, builtinData);
|
|
builtinData.opacity = surfaceDescription.Alpha;
|
|
}
|
|
|
|
VertexOutput VertexFunction( VertexInput inputMesh )
|
|
{
|
|
VertexOutput o;
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS));
|
|
float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x );
|
|
o.ase_texcoord = screenPos;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue ;
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
o.positionCS = TransformWorldToHClip(positionRWS);
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
|
|
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.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
|
|
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 (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
|
|
float3 cameraPos = 0;
|
|
#else
|
|
float3 cameraPos = _WorldSpaceCameraPos;
|
|
#endif
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes );
|
|
#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.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
|
|
o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
|
|
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput Vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( VertexOutput packedInput
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
, out float4 outNormalBuffer : SV_Target0
|
|
#ifdef WRITE_MSAA_DEPTH
|
|
, out float1 depthColor : SV_Target1
|
|
#endif
|
|
#elif defined(WRITE_MSAA_DEPTH)
|
|
, out float4 outNormalBuffer : SV_Target0
|
|
, out float1 depthColor : SV_Target1
|
|
#elif defined(SCENESELECTIONPASS)
|
|
, out float4 outColor : SV_Target0
|
|
#endif
|
|
#ifdef _DEPTHOFFSET_ON
|
|
, out float outputDepth : SV_Depth
|
|
#endif
|
|
|
|
)
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = float3( 1.0, 1.0, 1.0 );
|
|
|
|
SurfaceDescription surfaceDescription = (SurfaceDescription)0;
|
|
float4 transform114 = mul(GetObjectToWorldMatrix(),float4( 0,0,0,1 ));
|
|
transform114.xyz = GetAbsolutePositionWS((transform114).xyz);
|
|
float4 screenPos = packedInput.ase_texcoord;
|
|
float4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float2 UV22_g9 = ase_screenPosNorm.xy;
|
|
float2 localUnStereo22_g9 = UnStereo( UV22_g9 );
|
|
float2 break64_g8 = localUnStereo22_g9;
|
|
float clampDepth69_g8 = SampleCameraDepth( ase_screenPosNorm.xy );
|
|
#ifdef UNITY_REVERSED_Z
|
|
float staticSwitch38_g8 = ( 1.0 - clampDepth69_g8 );
|
|
#else
|
|
float staticSwitch38_g8 = clampDepth69_g8;
|
|
#endif
|
|
float3 appendResult39_g8 = (float3(break64_g8.x , break64_g8.y , staticSwitch38_g8));
|
|
float4 appendResult42_g8 = (float4((appendResult39_g8*2.0 + -1.0) , 1.0));
|
|
float4 temp_output_43_0_g8 = mul( unity_CameraInvProjection, appendResult42_g8 );
|
|
float3 temp_output_46_0_g8 = ( (temp_output_43_0_g8).xyz / (temp_output_43_0_g8).w );
|
|
float3 In73_g8 = temp_output_46_0_g8;
|
|
float3 localInvertDepthDirHD73_g8 = InvertDepthDirHD73_g8( In73_g8 );
|
|
float4 appendResult49_g8 = (float4(localInvertDepthDirHD73_g8 , 1.0));
|
|
float3 ase_objectScale = float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) );
|
|
float temp_output_184_0 = ( 1.0 - saturate( pow( ( length( abs( (( transform114 - mul( unity_CameraToWorld, appendResult49_g8 ) )).xyz ) ) / ( max( max( ase_objectScale.x , ase_objectScale.y ) , ase_objectScale.z ) * 0.5 * _Size ) ) , _Rampfalloff ) ) );
|
|
|
|
surfaceDescription.Alpha = temp_output_184_0;
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData);
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
outputDepth = posInput.deviceDepth;
|
|
#endif
|
|
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer );
|
|
#ifdef WRITE_MSAA_DEPTH
|
|
depthColor = packedInput.positionCS.z;
|
|
#endif
|
|
#elif defined(WRITE_MSAA_DEPTH)
|
|
outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 );
|
|
depthColor = packedInput.positionCS.z;
|
|
#elif defined(SCENESELECTIONPASS)
|
|
outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 );
|
|
#endif
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Motion Vectors"
|
|
Tags { "LightMode"="MotionVectors" }
|
|
|
|
Cull [_CullMode]
|
|
|
|
ZWrite On
|
|
|
|
Stencil
|
|
{
|
|
Ref [_StencilRefMV]
|
|
WriteMask [_StencilWriteMaskMV]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
|
|
HLSLPROGRAM
|
|
#pragma multi_compile_instancing
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
#define SHADERPASS SHADERPASS_MOTION_VECTORS
|
|
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl"
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float _Size;
|
|
float _Rampfalloff;
|
|
float4 _EmissionColor;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#endif
|
|
#ifdef _ENABLE_SHADOW_MATTE
|
|
float _ShadowMatteFilter;
|
|
#endif
|
|
float _StencilRef;
|
|
float _StencilWriteMask;
|
|
float _StencilRefDepth;
|
|
float _StencilWriteMaskDepth;
|
|
float _StencilRefMV;
|
|
float _StencilWriteMaskMV;
|
|
float _StencilRefDistortionVec;
|
|
float _StencilWriteMaskDistortionVec;
|
|
float _StencilWriteMaskGBuffer;
|
|
float _StencilRefGBuffer;
|
|
float _ZTestGBuffer;
|
|
float _RequireSplitLighting;
|
|
float _ReceivesSSR;
|
|
float _SurfaceType;
|
|
float _BlendMode;
|
|
float _SrcBlend;
|
|
float _DstBlend;
|
|
float _AlphaSrcBlend;
|
|
float _AlphaDstBlend;
|
|
float _ZWrite;
|
|
float _TransparentZWrite;
|
|
float _CullMode;
|
|
float _TransparentSortPriority;
|
|
float _EnableFogOnTransparent;
|
|
float _CullModeForward;
|
|
float _TransparentCullMode;
|
|
float _ZTestDepthEqualForOpaque;
|
|
float _ZTestTransparent;
|
|
float _TransparentBackfaceEnable;
|
|
float _AlphaCutoffEnable;
|
|
float _AlphaCutoff;
|
|
float _UseShadowThreshold;
|
|
float _DoubleSidedEnable;
|
|
float _DoubleSidedNormalMode;
|
|
float4 _DoubleSidedConstants;
|
|
#ifdef TESSELLATION_ON
|
|
float _TessPhongStrength;
|
|
float _TessValue;
|
|
float _TessMin;
|
|
float _TessMax;
|
|
float _TessEdgeLength;
|
|
float _TessMaxDisp;
|
|
#endif
|
|
CBUFFER_END
|
|
float4x4 unity_CameraProjection;
|
|
float4x4 unity_CameraInvProjection;
|
|
float4x4 unity_WorldToCamera;
|
|
float4x4 unity_CameraToWorld;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
|
|
|
|
struct VertexInput
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 vmeshPositionCS : SV_Position;
|
|
float3 vmeshInterp00 : TEXCOORD0;
|
|
float3 vpassInterpolators0 : TEXCOORD1; //interpolators0
|
|
float3 vpassInterpolators1 : TEXCOORD2; //interpolators1
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
float2 UnStereo( float2 UV )
|
|
{
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex ];
|
|
UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy;
|
|
#endif
|
|
return UV;
|
|
}
|
|
|
|
float3 InvertDepthDirHD73_g8( float3 In )
|
|
{
|
|
float3 result = In;
|
|
#if !defined(ASE_SRP_VERSION) || ASE_SRP_VERSION <= 70301 || ASE_SRP_VERSION == 70503 || ASE_SRP_VERSION == 70600 || ASE_SRP_VERSION == 70700 || ASE_SRP_VERSION == 70701 || ASE_SRP_VERSION >= 80301
|
|
result *= float3(1,1,-1);
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
|
|
struct SurfaceDescription
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#if _ALPHATEST_ON
|
|
DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
|
|
ZERO_INITIALIZE(BuiltinData, builtinData);
|
|
builtinData.opacity = surfaceDescription.Alpha;
|
|
}
|
|
|
|
VertexInput ApplyMeshModification(VertexInput inputMesh, float3 timeParameters, inout VertexOutput o )
|
|
{
|
|
_TimeParameters.xyz = timeParameters;
|
|
float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS));
|
|
float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x );
|
|
o.ase_texcoord3 = screenPos;
|
|
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = defaultVertexValue ;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
return inputMesh;
|
|
}
|
|
|
|
VertexOutput VertexFunction(VertexInput inputMesh)
|
|
{
|
|
VertexOutput o = (VertexOutput)0;
|
|
VertexInput defaultMesh = inputMesh;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, o);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
|
|
inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, o);
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
|
|
float3 VMESHpositionRWS = positionRWS;
|
|
float4 VMESHpositionCS = TransformWorldToHClip(positionRWS);
|
|
|
|
//#if defined(UNITY_REVERSED_Z)
|
|
// VMESHpositionCS.z -= unity_MotionVectorsParams.z * VMESHpositionCS.w;
|
|
//#else
|
|
// VMESHpositionCS.z += unity_MotionVectorsParams.z * VMESHpositionCS.w;
|
|
//#endif
|
|
|
|
float4 VPASSpreviousPositionCS;
|
|
float4 VPASSpositionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(VMESHpositionRWS, 1.0));
|
|
|
|
bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
|
|
if (forceNoMotion)
|
|
{
|
|
VPASSpreviousPositionCS = float4(0.0, 0.0, 0.0, 1.0);
|
|
}
|
|
else
|
|
{
|
|
bool hasDeformation = unity_MotionVectorsParams.x > 0.0;
|
|
float3 effectivePositionOS = (hasDeformation ? inputMesh.previousPositionOS : defaultMesh.positionOS);
|
|
#if defined(_ADD_PRECOMPUTED_VELOCITY)
|
|
effectivePositionOS -= inputMesh.precomputedVelocity;
|
|
#endif
|
|
|
|
#if defined(HAVE_MESH_MODIFICATION)
|
|
VertexInput previousMesh = defaultMesh;
|
|
previousMesh.positionOS = effectivePositionOS ;
|
|
VertexOutput test = (VertexOutput)0;
|
|
float3 curTime = _TimeParameters.xyz;
|
|
previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz, test);
|
|
_TimeParameters.xyz = curTime;
|
|
float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS);
|
|
#else
|
|
float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS);
|
|
#endif
|
|
|
|
#ifdef ATTRIBUTES_NEED_NORMAL
|
|
float3 normalWS = TransformPreviousObjectToWorldNormal(defaultMesh.normalOS);
|
|
#else
|
|
float3 normalWS = float3(0.0, 0.0, 0.0);
|
|
#endif
|
|
|
|
#if defined(HAVE_VERTEX_MODIFICATION)
|
|
//ApplyVertexModification(inputMesh, normalWS, previousPositionRWS, _LastTimeParameters.xyz);
|
|
#endif
|
|
|
|
VPASSpreviousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0));
|
|
}
|
|
|
|
o.vmeshPositionCS = VMESHpositionCS;
|
|
o.vmeshInterp00.xyz = VMESHpositionRWS;
|
|
|
|
o.vpassInterpolators0 = float3(VPASSpositionCS.xyw);
|
|
o.vpassInterpolators1 = float3(VPASSpreviousPositionCS.xyw);
|
|
return o;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
|
|
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.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.previousPositionOS = v.previousPositionOS;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
o.precomputedVelocity = v.precomputedVelocity;
|
|
#endif
|
|
|
|
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 (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
|
|
float3 cameraPos = 0;
|
|
#else
|
|
float3 cameraPos = _WorldSpaceCameraPos;
|
|
#endif
|
|
#if defined(ASE_FIXED_TESSELLATION)
|
|
tf = FixedTess( tessValue );
|
|
#elif defined(ASE_DISTANCE_TESSELLATION)
|
|
tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos );
|
|
#elif defined(ASE_LENGTH_TESSELLATION)
|
|
tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams );
|
|
#elif defined(ASE_LENGTH_CULL_TESSELLATION)
|
|
tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes );
|
|
#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.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
|
|
o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
|
|
o.previousPositionOS = patch[0].previousPositionOS * bary.x + patch[1].previousPositionOS * bary.y + patch[2].previousPositionOS * bary.z;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
o.precomputedVelocity = patch[0].precomputedVelocity * bary.x + patch[1].precomputedVelocity * bary.y + patch[2].precomputedVelocity * bary.z;
|
|
#endif
|
|
|
|
#if defined(ASE_PHONG_TESSELLATION)
|
|
float3 pp[3];
|
|
for (int i = 0; i < 3; ++i)
|
|
pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
|
|
float phongStrength = _TessPhongStrength;
|
|
o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz;
|
|
#endif
|
|
UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
|
|
return VertexFunction(o);
|
|
}
|
|
#else
|
|
VertexOutput Vert ( VertexInput v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( VertexOutput packedInput
|
|
, out float4 outMotionVector : SV_Target0
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
, out float4 outNormalBuffer : SV_Target1
|
|
#ifdef WRITE_MSAA_DEPTH
|
|
, out float1 depthColor : SV_Target2
|
|
#endif
|
|
#elif defined(WRITE_MSAA_DEPTH)
|
|
, out float4 outNormalBuffer : SV_Target1
|
|
, out float1 depthColor : SV_Target2
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
, out float outputDepth : SV_Depth
|
|
#endif
|
|
|
|
)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.vmeshPositionCS;
|
|
input.positionRWS = packedInput.vmeshInterp00.xyz;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
|
|
SurfaceDescription surfaceDescription = (SurfaceDescription)0;
|
|
float4 transform114 = mul(GetObjectToWorldMatrix(),float4( 0,0,0,1 ));
|
|
transform114.xyz = GetAbsolutePositionWS((transform114).xyz);
|
|
float4 screenPos = packedInput.ase_texcoord3;
|
|
float4 ase_screenPosNorm = screenPos / screenPos.w;
|
|
ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
|
|
float2 UV22_g9 = ase_screenPosNorm.xy;
|
|
float2 localUnStereo22_g9 = UnStereo( UV22_g9 );
|
|
float2 break64_g8 = localUnStereo22_g9;
|
|
float clampDepth69_g8 = SampleCameraDepth( ase_screenPosNorm.xy );
|
|
#ifdef UNITY_REVERSED_Z
|
|
float staticSwitch38_g8 = ( 1.0 - clampDepth69_g8 );
|
|
#else
|
|
float staticSwitch38_g8 = clampDepth69_g8;
|
|
#endif
|
|
float3 appendResult39_g8 = (float3(break64_g8.x , break64_g8.y , staticSwitch38_g8));
|
|
float4 appendResult42_g8 = (float4((appendResult39_g8*2.0 + -1.0) , 1.0));
|
|
float4 temp_output_43_0_g8 = mul( unity_CameraInvProjection, appendResult42_g8 );
|
|
float3 temp_output_46_0_g8 = ( (temp_output_43_0_g8).xyz / (temp_output_43_0_g8).w );
|
|
float3 In73_g8 = temp_output_46_0_g8;
|
|
float3 localInvertDepthDirHD73_g8 = InvertDepthDirHD73_g8( In73_g8 );
|
|
float4 appendResult49_g8 = (float4(localInvertDepthDirHD73_g8 , 1.0));
|
|
float3 ase_objectScale = float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) );
|
|
float temp_output_184_0 = ( 1.0 - saturate( pow( ( length( abs( (( transform114 - mul( unity_CameraToWorld, appendResult49_g8 ) )).xyz ) ) / ( max( max( ase_objectScale.x , ase_objectScale.y ) , ase_objectScale.z ) * 0.5 * _Size ) ) , _Rampfalloff ) ) );
|
|
|
|
surfaceDescription.Alpha = temp_output_184_0;
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData);
|
|
|
|
float4 VPASSpositionCS = float4(packedInput.vpassInterpolators0.xy, 0.0, packedInput.vpassInterpolators0.z);
|
|
float4 VPASSpreviousPositionCS = float4(packedInput.vpassInterpolators1.xy, 0.0, packedInput.vpassInterpolators1.z);
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
VPASSpositionCS.w += builtinData.depthOffset;
|
|
VPASSpreviousPositionCS.w += builtinData.depthOffset;
|
|
#endif
|
|
|
|
float2 motionVector = CalculateMotionVector( VPASSpositionCS, VPASSpreviousPositionCS );
|
|
EncodeMotionVector( motionVector * 0.5, outMotionVector );
|
|
|
|
bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
|
|
if( forceNoMotion )
|
|
outMotionVector = float4( 2.0, 0.0, 0.0, 0.0 );
|
|
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer );
|
|
|
|
#ifdef WRITE_MSAA_DEPTH
|
|
depthColor = packedInput.vmeshPositionCS.z;
|
|
#endif
|
|
#elif defined(WRITE_MSAA_DEPTH)
|
|
outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 );
|
|
depthColor = packedInput.vmeshPositionCS.z;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
outputDepth = posInput.deviceDepth;
|
|
#endif
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
}
|
|
CustomEditor "Rendering.HighDefinition.LitShaderGraphGUI"
|
|
Fallback "Hidden/InternalErrorShader"
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18916
|
|
592;73;931;641;-1286.324;43.19661;2.138459;True;False
|
|
Node;AmplifyShaderEditor.CommentaryNode;219;1378.052,401.4491;Inherit;False;328.9616;247.4789;Object pivot position in world space;1;114;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;220;1674.094,745.6295;Inherit;False;527.0399;229;Make the effect scale with the sphere;3;152;154;155;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.ObjectToWorldTransfNode;114;1428.052,451.4491;Inherit;False;1;0;FLOAT4;0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.FunctionNode;232;1256.361,701.5815;Inherit;False;Reconstruct World Position From Depth;-1;;8;e7094bcbcc80eb140b2a3dbe6a861de8;0;0;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.ObjectScaleNode;152;1724.094,795.6295;Inherit;False;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
|
|
Node;AmplifyShaderEditor.SimpleSubtractOpNode;113;1830.928,475.2047;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.SimpleMaxOpNode;154;1923.721,798.6289;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ComponentMaskNode;160;2016,496;Inherit;False;True;True;True;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SimpleMaxOpNode;155;2047.13,831.1067;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.AbsOpNode;158;2240,496;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;216;1922.201,1004.83;Float;False;Property;_Size;Size;0;0;Create;True;0;0;0;False;0;False;1;1;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LengthOpNode;159;2400,496;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;156;2254.979,824.6212;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0.5;False;2;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;164;2495.099,669.4001;Float;False;Property;_Rampfalloff;Ramp falloff;1;0;Create;True;0;0;0;False;0;False;5;5;0.01;5;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleDivideOpNode;148;2560,496;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.PowerNode;163;2736,496;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SaturateNode;187;2944,496;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;185;3348.951,288;Inherit;True;Property;_Ramp;Ramp;2;0;Create;True;0;0;0;False;0;False;-1;None;bb47b838a0905154496dfe9920ae73b0;True;0;False;white;Auto;False;Object;-1;MipLevel;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.RangedFloatNode;233;3163.349,370.7596;Float;False;Constant;_Float0;Float 0;4;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.OneMinusNode;184;3120,496;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;249;3685.973,468.2288;Float;False;True;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;13;ASESampleShaders/Omni Decal/SRP HD Omni Decal;7f5cb9c3ea6481f469fdd856555439ef;True;Forward Unlit;0;0;Forward Unlit;9;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Transparent=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;True;1;0;True;-20;0;True;-21;1;0;True;-22;0;True;-23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;False;False;False;False;False;False;False;False;True;True;0;True;-5;255;False;-1;255;True;-6;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;0;True;-24;True;0;True;-32;False;True;1;LightMode=ForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;29;Surface Type;1; Rendering Pass ;0; Rendering Pass;1; Blending Mode;0; Receive Fog;1; Distortion;0; Distortion Mode;0; Distortion Only;1; Depth Write;1; Cull Mode;1; Depth Test;8;Double-Sided;0;Alpha Clipping;0;Motion Vectors;1; Add Precomputed Velocity;0;Shadow Matte;0;Cast Shadows;0;DOTS Instancing;0;GPU Instancing;1;Tessellation;0; Phong;0; Strength;0.5,False,-1; Type;0; Tess;16,False,-1; Min;10,False,-1; Max;25,False,-1; Edge Length;16,False,-1; Max Displacement;25,False,-1;Vertex Position,InvertActionOnDeselection;1;0;7;True;False;True;True;True;True;False;False;;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;250;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;ShadowCaster;0;1;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;251;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;META;0;2;META;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;252;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;SceneSelectionPass;0;3;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;253;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;DepthForwardOnly;0;4;DepthForwardOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;True;True;0;True;-7;255;False;-1;255;True;-8;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;False;False;True;1;LightMode=DepthForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;254;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;Motion Vectors;0;5;Motion Vectors;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;False;False;False;False;False;False;False;False;True;True;0;True;-9;255;False;-1;255;True;-10;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;False;False;True;1;LightMode=MotionVectors;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;255;3685.973,468.2288;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;1;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;DistortionVectors;0;6;DistortionVectors;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;True;4;1;False;-1;1;False;-1;4;1;False;-1;1;False;-1;True;1;False;-1;1;False;-1;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-26;False;False;False;False;False;False;False;False;False;True;True;0;True;-11;255;False;-1;255;True;-12;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;2;False;-1;True;3;False;-1;False;True;1;LightMode=DistortionVectors;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
|
|
WireConnection;113;0;114;0
|
|
WireConnection;113;1;232;0
|
|
WireConnection;154;0;152;1
|
|
WireConnection;154;1;152;2
|
|
WireConnection;160;0;113;0
|
|
WireConnection;155;0;154;0
|
|
WireConnection;155;1;152;3
|
|
WireConnection;158;0;160;0
|
|
WireConnection;159;0;158;0
|
|
WireConnection;156;0;155;0
|
|
WireConnection;156;2;216;0
|
|
WireConnection;148;0;159;0
|
|
WireConnection;148;1;156;0
|
|
WireConnection;163;0;148;0
|
|
WireConnection;163;1;164;0
|
|
WireConnection;187;0;163;0
|
|
WireConnection;185;1;184;0
|
|
WireConnection;185;2;233;0
|
|
WireConnection;184;0;187;0
|
|
WireConnection;249;0;185;0
|
|
WireConnection;249;2;184;0
|
|
ASEEND*/
|
|
//CHKSM=0B51FF7C8A6FD7F219363034AED6CE86377AA2E5 |