5679 lines
253 KiB
GLSL
5679 lines
253 KiB
GLSL
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "ASESampleShaders/TV/Vector Displacement Mapping"
|
|
{
|
|
Properties
|
|
{
|
|
[HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
|
|
[HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
|
|
[ASEBegin]_ScreenToggle("Screen Toggle", Range( 0 , 1)) = 0
|
|
_HandIntensity("Hand Intensity", Range( 0 , 3)) = 0
|
|
_SkullIntensity("Skull Intensity", Range( 0 , 1.5)) = 0
|
|
_SideHandIntensity("Side Hand Intensity", Range( 0 , 1.5)) = 0
|
|
_NoiseTiling("Noise Tiling", Float) = 1
|
|
_TilingGlow("Tiling Glow", Float) = 1
|
|
_NormalHands("Normal Hands", 2D) = "bump" {}
|
|
_Albedo("Albedo", 2D) = "white" {}
|
|
_Masks("Masks", 2D) = "white" {}
|
|
_NormalTopSkull("Normal Top Skull", 2D) = "bump" {}
|
|
_TopSkullTint("Top Skull Tint", Color) = (0,0,0,0)
|
|
_SideHandTint("Side Hand Tint", Color) = (0,0,0,0)
|
|
_Normal("Normal", 2D) = "bump" {}
|
|
_NormalsLeftHand("Normals Left Hand", 2D) = "bump" {}
|
|
_TV_MetallicSmoothness("TV_MetallicSmoothness", 2D) = "white" {}
|
|
_BaseSmoothness("Base Smoothness", Range( 0 , 1)) = 0
|
|
_NoiseFlipbook("Noise Flipbook", 2D) = "white" {}
|
|
[HDR]_GlowIntensity("Glow Intensity", Float) = 0
|
|
[HDR]_NoiseTint("Noise Tint", Color) = (0,0,0,0)
|
|
_TVHandsTint("TV Hands Tint", Color) = (0,0,0,0)
|
|
_ScreenHandsVDM("Screen Hands VDM", 2D) = "white" {}
|
|
_TopSkullVDM("Top Skull VDM", 2D) = "white" {}
|
|
_LeftHandVDM("Left Hand VDM", 2D) = "white" {}
|
|
_ScreenColorTintBlend("Screen Color Tint Blend", Range( 0 , 1)) = 0
|
|
[ASEEnd]_DisplacementMultiplier("Displacement Multiplier", Float) = 1
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
|
|
|
[HideInInspector] _RenderQueueType("Render Queue Type", Float) = 1
|
|
[HideInInspector] [ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1
|
|
[HideInInspector] [ToggleUI]_SupportDecals("Boolean", Float) = 1
|
|
[HideInInspector] _StencilRef("Stencil Ref", Int) = 0
|
|
[HideInInspector] _StencilWriteMask("Stencil Write Mask", Int) = 6
|
|
[HideInInspector] _StencilRefDepth("Stencil Ref Depth", Int) = 8
|
|
[HideInInspector] _StencilWriteMaskDepth("Stencil Write Mask Depth", Int) = 8
|
|
[HideInInspector] _StencilRefMV("Stencil Ref MV", Int) = 40
|
|
[HideInInspector] _StencilWriteMaskMV("Stencil Write Mask MV", Int) = 40
|
|
[HideInInspector] _StencilRefDistortionVec("Stencil Ref Distortion Vec", Int) = 4
|
|
[HideInInspector] _StencilWriteMaskDistortionVec("Stencil Write Mask Distortion Vec", Int) = 4
|
|
[HideInInspector] _StencilWriteMaskGBuffer("Stencil Write Mask GBuffer", Int) = 14
|
|
[HideInInspector] _StencilRefGBuffer("Stencil Ref GBuffer", Int) = 10
|
|
[HideInInspector] _ZTestGBuffer("ZTest GBuffer", Int) = 4
|
|
[HideInInspector] [ToggleUI] _RequireSplitLighting("Require Split Lighting", Float) = 0
|
|
[HideInInspector] [ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1
|
|
[HideInInspector] [ToggleUI] _ReceivesSSRTransparent("Boolean", Float) = 0
|
|
[HideInInspector] _SurfaceType("Surface Type", Float) = 0
|
|
[HideInInspector] _BlendMode("Blend Mode", Float) = 0
|
|
[HideInInspector] _SrcBlend("Src Blend", Float) = 1
|
|
[HideInInspector] _DstBlend("Dst Blend", Float) = 0
|
|
[HideInInspector] _AlphaSrcBlend("Alpha Src Blend", Float) = 1
|
|
[HideInInspector] _AlphaDstBlend("Alpha Dst Blend", Float) = 0
|
|
[HideInInspector] [ToggleUI] _ZWrite("ZWrite", Float) = 1
|
|
[HideInInspector] [ToggleUI] _TransparentZWrite("Transparent ZWrite", Float) = 1
|
|
[HideInInspector] _CullMode("Cull Mode", Float) = 2
|
|
[HideInInspector] _TransparentSortPriority("Transparent Sort Priority", Int) = 0
|
|
[HideInInspector] [ToggleUI] _EnableFogOnTransparent("Enable Fog On Transparent", Float) = 1
|
|
[HideInInspector] _CullModeForward("Cull Mode Forward", Float) = 2
|
|
[HideInInspector] [Enum(Front, 1, Back, 2)] _TransparentCullMode("Transparent Cull Mode", Float) = 2
|
|
[HideInInspector] _ZTestDepthEqualForOpaque("ZTest Depth Equal For Opaque", Int) = 4
|
|
[HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("ZTest Transparent", Float) = 4
|
|
[HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Transparent Backface Enable", Float) = 0
|
|
[HideInInspector] [ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0
|
|
[HideInInspector] [ToggleUI] _UseShadowThreshold("Use Shadow Threshold", Float) = 0
|
|
[HideInInspector] [ToggleUI] _DoubleSidedEnable("Double Sided Enable", Float) = 0
|
|
[HideInInspector] [Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double Sided Normal Mode", Float) = 2
|
|
[HideInInspector] _DoubleSidedConstants("DoubleSidedConstants", Vector) = (1,1,-1,0)
|
|
//_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
|
|
_TessValue( "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"="Geometry" }
|
|
|
|
HLSLINCLUDE
|
|
#pragma target 4.5
|
|
#pragma only_renderers d3d11 metal vulkan xboxone xboxseries playstation switch
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
|
|
struct GlobalSurfaceDescription // GBuffer Forward META TransparentBackface
|
|
{
|
|
float3 Albedo;
|
|
float3 Normal;
|
|
float3 BentNormal;
|
|
float3 Specular;
|
|
float CoatMask;
|
|
float Metallic;
|
|
float3 Emission;
|
|
float Smoothness;
|
|
float Occlusion;
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
float AlphaClipThresholdShadow;
|
|
float AlphaClipThresholdDepthPrepass;
|
|
float AlphaClipThresholdDepthPostpass;
|
|
float SpecularAAScreenSpaceVariance;
|
|
float SpecularAAThreshold;
|
|
float SpecularOcclusion;
|
|
float DepthOffset;
|
|
//Refraction
|
|
float RefractionIndex;
|
|
float3 RefractionColor;
|
|
float RefractionDistance;
|
|
//SSS/Translucent
|
|
float Thickness;
|
|
float SubsurfaceMask;
|
|
float DiffusionProfile;
|
|
//Anisotropy
|
|
float Anisotropy;
|
|
float3 Tangent;
|
|
//Iridescent
|
|
float IridescenceMask;
|
|
float IridescenceThickness;
|
|
//BakedGI
|
|
float3 BakedGI;
|
|
float3 BakedBackGI;
|
|
};
|
|
|
|
struct AlphaSurfaceDescription // ShadowCaster
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
float AlphaClipThresholdShadow;
|
|
float DepthOffset;
|
|
};
|
|
|
|
struct SceneSurfaceDescription // SceneSelection
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
float DepthOffset;
|
|
};
|
|
|
|
struct PrePassSurfaceDescription // DepthPrePass
|
|
{
|
|
float3 Normal;
|
|
float Smoothness;
|
|
float Alpha;
|
|
float AlphaClipThresholdDepthPrepass;
|
|
float DepthOffset;
|
|
};
|
|
|
|
struct PostPassSurfaceDescription //DepthPostPass
|
|
{
|
|
float Alpha;
|
|
float AlphaClipThresholdDepthPostpass;
|
|
float DepthOffset;
|
|
};
|
|
|
|
struct SmoothSurfaceDescription // MotionVectors DepthOnly
|
|
{
|
|
float3 Normal;
|
|
float Smoothness;
|
|
float Alpha;
|
|
float AlphaClipThreshold;
|
|
float DepthOffset;
|
|
};
|
|
|
|
struct DistortionSurfaceDescription //Distortion
|
|
{
|
|
float Alpha;
|
|
float2 Distortion;
|
|
float DistortionBlur;
|
|
float AlphaClipThreshold;
|
|
};
|
|
|
|
#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 "GBuffer"
|
|
Tags { "LightMode"="GBuffer" }
|
|
|
|
Cull [_CullMode]
|
|
ZTest [_ZTestGBuffer]
|
|
|
|
Stencil
|
|
{
|
|
Ref [_StencilRefGBuffer]
|
|
WriteMask [_StencilWriteMaskGBuffer]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#if !defined(DEBUG_DISPLAY) && defined(_ALPHATEST_ON)
|
|
#define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST
|
|
#endif
|
|
|
|
#define SHADERPASS SHADERPASS_GBUFFER
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile _ LIGHT_LAYERS
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
sampler2D _Albedo;
|
|
sampler2D _NoiseFlipbook;
|
|
sampler2D _Normal;
|
|
sampler2D _NormalHands;
|
|
sampler2D _NormalTopSkull;
|
|
sampler2D _NormalsLeftHand;
|
|
sampler2D _TV_MetallicSmoothness;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_TANGENT
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 interp00 : TEXCOORD0;
|
|
float3 interp01 : TEXCOORD1;
|
|
float4 interp02 : TEXCOORD2;
|
|
float4 interp03 : TEXCOORD3;
|
|
float4 interp04 : TEXCOORD4;
|
|
float4 ase_texcoord5 : TEXCOORD5;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
surfaceData.baseColor = surfaceDescription.Albedo;
|
|
surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
|
|
surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
|
|
surfaceData.metallic = surfaceDescription.Metallic;
|
|
surfaceData.coatMask = surfaceDescription.CoatMask;
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
|
|
#endif
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceData.thickness = surfaceDescription.Thickness;
|
|
#endif
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile);
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.specularColor = surfaceDescription.Specular;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.anisotropy = surfaceDescription.Anisotropy;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
|
|
surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
|
|
#endif
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.ior = surfaceDescription.RefractionIndex;
|
|
surfaceData.transmittanceColor = surfaceDescription.RefractionColor;
|
|
surfaceData.atDistance = surfaceDescription.RefractionDistance;
|
|
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
normalTS = surfaceDescription.Normal;
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
|
|
#ifdef ASE_BENT_NORMAL
|
|
GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld );
|
|
#endif
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
#ifdef _ASE_BAKEDGI
|
|
builtinData.bakeDiffuseLighting = surfaceDescription.BakedGI;
|
|
#endif
|
|
#ifdef _ASE_BAKEDBACKGI
|
|
builtinData.backBakeDiffuseLighting = surfaceDescription.BakedBackGI;
|
|
#endif
|
|
|
|
builtinData.emissiveColor = surfaceDescription.Emission;
|
|
|
|
#if (SHADERPASS == SHADERPASS_DISTORTION)
|
|
builtinData.distortion = surfaceDescription.Distortion;
|
|
builtinData.distortionBlur = surfaceDescription.DistortionBlur;
|
|
#else
|
|
builtinData.distortion = float2(0.0, 0.0);
|
|
builtinData.distortionBlur = 0.0;
|
|
#endif
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh )
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.tangentOS.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.tangentOS.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
outputPackedVaryingsMeshToPS.ase_texcoord5.xy = inputMesh.ase_texcoord.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
outputPackedVaryingsMeshToPS.ase_texcoord5.zw = 0;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
inputMesh.tangentOS = inputMesh.tangentOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w);
|
|
|
|
outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS);
|
|
outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
|
|
outputPackedVaryingsMeshToPS.interp01.xyz = normalWS;
|
|
outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS;
|
|
outputPackedVaryingsMeshToPS.interp03.xyzw = inputMesh.uv1;
|
|
outputPackedVaryingsMeshToPS.interp04.xyzw = inputMesh.uv2;
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.tangentOS = v.tangentOS;
|
|
o.uv1 = v.uv1;
|
|
o.uv2 = v.uv2;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * 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;
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( PackedVaryingsMeshToPS packedInput,
|
|
OUTPUT_GBUFFER(outGBuffer)
|
|
#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;
|
|
float3 positionRWS = packedInput.interp00.xyz;
|
|
float3 normalWS = packedInput.interp01.xyz;
|
|
float4 tangentWS = packedInput.interp02.xyzw;
|
|
|
|
input.positionSS = packedInput.positionCS;
|
|
input.positionRWS = positionRWS;
|
|
input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS);
|
|
input.texCoord1 = packedInput.interp03.xyzw;
|
|
input.texCoord2 = packedInput.interp04.xyzw;
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false );
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
|
|
GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0;
|
|
float2 uv_Albedo = packedInput.ase_texcoord5.xy * _Albedo_ST.xy + _Albedo_ST.zw;
|
|
float SkullIntensity51 = _SkullIntensity;
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = packedInput.ase_texcoord5.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = packedInput.ase_texcoord5.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2D( _TopSkullVDM, SkullWave175 );
|
|
float TopSkullColorMask66 = tex2DNode35.g;
|
|
float clampResult59 = clamp( ( ( SkullIntensity51 * 0.5 ) * TopSkullColorMask66 ) , 0.0 , 0.5 );
|
|
float4 lerpResult56 = lerp( tex2D( _Albedo, uv_Albedo ) , _TopSkullTint , clampResult59);
|
|
float SideHandIntensity75 = _SideHandIntensity;
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = packedInput.ase_texcoord5.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2D( _LeftHandVDM, LeftHandWave103 );
|
|
float SideHandColorMask80 = tex2DNode77.g;
|
|
float clampResult93 = clamp( ( ( SideHandIntensity75 * 0.5 ) * SideHandColorMask80 ) , 0.0 , 0.5 );
|
|
float4 lerpResult94 = lerp( lerpResult56 , _SideHandTint , clampResult93);
|
|
float2 texCoord206 = packedInput.ase_texcoord5.xy * float2( 3,3 ) + float2( 0,0 );
|
|
// *** BEGIN Flipbook UV Animation vars ***
|
|
// Total tiles of Flipbook Texture
|
|
float fbtotaltiles205 = 2.0 * 2.0;
|
|
// Offsets for cols and rows of Flipbook Texture
|
|
float fbcolsoffset205 = 1.0f / 2.0;
|
|
float fbrowsoffset205 = 1.0f / 2.0;
|
|
// Speed of animation
|
|
float fbspeed205 = _TimeParameters.x * 12.0;
|
|
// UV Tiling (col and row offset)
|
|
float2 fbtiling205 = float2(fbcolsoffset205, fbrowsoffset205);
|
|
// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
|
|
// Calculate current tile linear index
|
|
float fbcurrenttileindex205 = round( fmod( fbspeed205 + 0.0, fbtotaltiles205) );
|
|
fbcurrenttileindex205 += ( fbcurrenttileindex205 < 0) ? fbtotaltiles205 : 0;
|
|
// Obtain Offset X coordinate from current tile linear index
|
|
float fblinearindextox205 = round ( fmod ( fbcurrenttileindex205, 2.0 ) );
|
|
// Multiply Offset X by coloffset
|
|
float fboffsetx205 = fblinearindextox205 * fbcolsoffset205;
|
|
// Obtain Offset Y coordinate from current tile linear index
|
|
float fblinearindextoy205 = round( fmod( ( fbcurrenttileindex205 - fblinearindextox205 ) / 2.0, 2.0 ) );
|
|
// Reverse Y to get tiles from Top to Bottom
|
|
fblinearindextoy205 = (int)(2.0-1) - fblinearindextoy205;
|
|
// Multiply Offset Y by rowoffset
|
|
float fboffsety205 = fblinearindextoy205 * fbrowsoffset205;
|
|
// UV Offset
|
|
float2 fboffset205 = float2(fboffsetx205, fboffsety205);
|
|
// Flipbook UV
|
|
half2 fbuv205 = texCoord206 * fbtiling205 + fboffset205;
|
|
// *** END Flipbook UV Animation vars ***
|
|
float2 uv_Masks = packedInput.ase_texcoord5.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2D( _Masks, uv_Masks );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float4 temp_output_209_0 = ( tex2D( _NoiseFlipbook, fbuv205 ) * MaskR15 );
|
|
float2 uv_ScreenHandsVDM = packedInput.ase_texcoord5.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2D( _ScreenHandsVDM, uv_ScreenHandsVDM );
|
|
float myVarName244 = tex2DNode6.g;
|
|
float HandIntensity29 = _HandIntensity;
|
|
float clampResult259 = clamp( saturate( ( myVarName244 * ( HandIntensity29 * 0.7 ) ) ) , 0.0 , 0.9 );
|
|
float4 lerpResult252 = lerp( temp_output_209_0 , _TVHandsTint , ( clampResult259 * _ScreenColorTintBlend ));
|
|
float ScreenToggle242 = _ScreenToggle;
|
|
float ScreenToggleSlider283 = ( MaskR15 * ScreenToggle242 );
|
|
float4 lerpResult213 = lerp( lerpResult94 , lerpResult252 , ScreenToggleSlider283);
|
|
|
|
float MaskG63 = tex2DNode45.g;
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 appendResult20 = (float3(MaskR15 , MaskG63 , MaskB84));
|
|
float2 uv_Normal = packedInput.ase_texcoord5.xy * _Normal_ST.xy + _Normal_ST.zw;
|
|
float2 uv_NormalHands = packedInput.ase_texcoord5.xy * _NormalHands_ST.xy + _NormalHands_ST.zw;
|
|
float clampResult32 = clamp( HandIntensity29 , 0.0 , 1.0 );
|
|
float3 unpack21 = UnpackNormalScale( tex2D( _NormalHands, uv_NormalHands ), clampResult32 );
|
|
unpack21.z = lerp( 1, unpack21.z, saturate(clampResult32) );
|
|
float clampResult53 = clamp( SkullIntensity51 , 0.0 , 1.0 );
|
|
float3 unpack50 = UnpackNormalScale( tex2D( _NormalTopSkull, SkullWave175 ), clampResult53 );
|
|
unpack50.z = lerp( 1, unpack50.z, saturate(clampResult53) );
|
|
float clampResult98 = clamp( SideHandIntensity75 , 0.0 , 1.0 );
|
|
float3 unpack96 = UnpackNormalScale( tex2D( _NormalsLeftHand, LeftHandWave103 ), clampResult98 );
|
|
unpack96.z = lerp( 1, unpack96.z, saturate(clampResult98) );
|
|
float3 layeredBlendVar18 = appendResult20;
|
|
float3 layeredBlend18 = ( lerp( lerp( lerp( UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ) , unpack21 , layeredBlendVar18.x ) , unpack50 , layeredBlendVar18.y ) , unpack96 , layeredBlendVar18.z ) );
|
|
float3 normalizeResult19 = normalize( layeredBlend18 );
|
|
|
|
float4 TVNoise214 = temp_output_209_0;
|
|
float2 temp_cast_2 = (_TilingGlow).xx;
|
|
float2 texCoord235 = packedInput.ase_texcoord5.xy * temp_cast_2 + float2( 0,0 );
|
|
float simplePerlin2D237 = snoise( texCoord235*_TimeParameters.y );
|
|
simplePerlin2D237 = simplePerlin2D237*0.5 + 0.5;
|
|
float HandMaskNoiseEmission263 = clampResult259;
|
|
|
|
float2 uv_TV_MetallicSmoothness = packedInput.ase_texcoord5.xy * _TV_MetallicSmoothness_ST.xy + _TV_MetallicSmoothness_ST.zw;
|
|
|
|
surfaceDescription.Albedo = lerpResult213.rgb;
|
|
surfaceDescription.Normal = normalizeResult19;
|
|
surfaceDescription.BentNormal = float3( 0, 0, 1 );
|
|
surfaceDescription.CoatMask = 0;
|
|
surfaceDescription.Metallic = 0;
|
|
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceDescription.Specular = 0;
|
|
#endif
|
|
|
|
surfaceDescription.Emission = ( ( ( ( TVNoise214 * _NoiseTint * _GlowIntensity ) * simplePerlin2D237 ) * ( 1.0 - HandMaskNoiseEmission263 ) ) * ScreenToggle242 ).rgb;
|
|
surfaceDescription.Smoothness = ( tex2D( _TV_MetallicSmoothness, uv_TV_MetallicSmoothness ).a * _BaseSmoothness );
|
|
surfaceDescription.Occlusion = 1;
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _ALPHATEST_SHADOW_ON
|
|
surfaceDescription.AlphaClipThresholdShadow = 0.5;
|
|
#endif
|
|
|
|
surfaceDescription.AlphaClipThresholdDepthPrepass = 0.5;
|
|
surfaceDescription.AlphaClipThresholdDepthPostpass = 0.5;
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceDescription.SpecularAAScreenSpaceVariance = 0;
|
|
surfaceDescription.SpecularAAThreshold = 0;
|
|
#endif
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceDescription.SpecularOcclusion = 0;
|
|
#endif
|
|
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceDescription.Thickness = 1;
|
|
#endif
|
|
|
|
#ifdef _HAS_REFRACTION
|
|
surfaceDescription.RefractionIndex = 1;
|
|
surfaceDescription.RefractionColor = float3( 1, 1, 1 );
|
|
surfaceDescription.RefractionDistance = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceDescription.SubsurfaceMask = 1;
|
|
#endif
|
|
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceDescription.DiffusionProfile = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceDescription.Anisotropy = 1;
|
|
surfaceDescription.Tangent = float3( 1, 0, 0 );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceDescription.IridescenceMask = 0;
|
|
surfaceDescription.IridescenceThickness = 0;
|
|
#endif
|
|
|
|
#ifdef _ASE_DISTORTION
|
|
surfaceDescription.Distortion = float2 ( 2, -1 );
|
|
surfaceDescription.DistortionBlur = 1;
|
|
#endif
|
|
|
|
#ifdef _ASE_BAKEDGI
|
|
surfaceDescription.BakedGI = 0;
|
|
#endif
|
|
#ifdef _ASE_BAKEDBACKGI
|
|
surfaceDescription.BakedBackGI = 0;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
GetSurfaceAndBuiltinData( surfaceDescription, input, V, posInput, surfaceData, builtinData );
|
|
ENCODE_INTO_GBUFFER( surfaceData, builtinData, posInput.positionSS, outGBuffer );
|
|
#ifdef _DEPTHOFFSET_ON
|
|
outputDepth = posInput.deviceDepth;
|
|
#endif
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "META"
|
|
Tags { "LightMode"="Meta" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
sampler2D _Albedo;
|
|
sampler2D _NoiseFlipbook;
|
|
sampler2D _Normal;
|
|
sampler2D _NormalHands;
|
|
sampler2D _NormalTopSkull;
|
|
sampler2D _NormalsLeftHand;
|
|
sampler2D _TV_MetallicSmoothness;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_TANGENT
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
surfaceData.baseColor = surfaceDescription.Albedo;
|
|
surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
|
|
surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
|
|
surfaceData.metallic = surfaceDescription.Metallic;
|
|
surfaceData.coatMask = surfaceDescription.CoatMask;
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
|
|
#endif
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceData.thickness = surfaceDescription.Thickness;
|
|
#endif
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile);
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.specularColor = surfaceDescription.Specular;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.anisotropy = surfaceDescription.Anisotropy;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
|
|
surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
|
|
#endif
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.ior = surfaceDescription.RefractionIndex;
|
|
surfaceData.transmittanceColor = surfaceDescription.RefractionColor;
|
|
surfaceData.atDistance = surfaceDescription.RefractionDistance;
|
|
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
normalTS = surfaceDescription.Normal;
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
|
|
#ifdef ASE_BENT_NORMAL
|
|
GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld );
|
|
#endif
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
builtinData.emissiveColor = surfaceDescription.Emission;
|
|
|
|
#if (SHADERPASS == SHADERPASS_DISTORTION)
|
|
builtinData.distortion = surfaceDescription.Distortion;
|
|
builtinData.distortionBlur = surfaceDescription.DistortionBlur;
|
|
#else
|
|
builtinData.distortion = float2(0.0, 0.0);
|
|
builtinData.distortionBlur = 0.0;
|
|
#endif
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
CBUFFER_START(UnityMetaPass)
|
|
bool4 unity_MetaVertexControl;
|
|
bool4 unity_MetaFragmentControl;
|
|
CBUFFER_END
|
|
|
|
float unity_OneOverOutputBoost;
|
|
float unity_MaxOutputValue;
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh )
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
|
|
float2 uv_ScreenHandsVDM = inputMesh.uv0.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.uv0.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.uv0.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.tangentOS.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.tangentOS.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.uv0.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.uv0.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.uv0.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
inputMesh.tangentOS = inputMesh.tangentOS ;
|
|
|
|
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;
|
|
}
|
|
|
|
outputPackedVaryingsMeshToPS.positionCS = float4(uv * 2.0 - 1.0, inputMesh.positionOS.z > 0 ? 1.0e-4 : 0.0, 1.0);
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.tangentOS = v.tangentOS;
|
|
o.uv0 = v.uv0;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
|
|
o.uv0 = patch[0].uv0 * bary.x + patch[1].uv0 * bary.y + patch[2].uv0 * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
float4 Frag(PackedVaryingsMeshToPS packedInput ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE(packedInput.cullFace, true, false);
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
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;
|
|
GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0;
|
|
float2 uv_Albedo = packedInput.ase_texcoord.xy * _Albedo_ST.xy + _Albedo_ST.zw;
|
|
float SkullIntensity51 = _SkullIntensity;
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = packedInput.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = packedInput.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2D( _TopSkullVDM, SkullWave175 );
|
|
float TopSkullColorMask66 = tex2DNode35.g;
|
|
float clampResult59 = clamp( ( ( SkullIntensity51 * 0.5 ) * TopSkullColorMask66 ) , 0.0 , 0.5 );
|
|
float4 lerpResult56 = lerp( tex2D( _Albedo, uv_Albedo ) , _TopSkullTint , clampResult59);
|
|
float SideHandIntensity75 = _SideHandIntensity;
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = packedInput.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2D( _LeftHandVDM, LeftHandWave103 );
|
|
float SideHandColorMask80 = tex2DNode77.g;
|
|
float clampResult93 = clamp( ( ( SideHandIntensity75 * 0.5 ) * SideHandColorMask80 ) , 0.0 , 0.5 );
|
|
float4 lerpResult94 = lerp( lerpResult56 , _SideHandTint , clampResult93);
|
|
float2 texCoord206 = packedInput.ase_texcoord.xy * float2( 3,3 ) + float2( 0,0 );
|
|
// *** BEGIN Flipbook UV Animation vars ***
|
|
// Total tiles of Flipbook Texture
|
|
float fbtotaltiles205 = 2.0 * 2.0;
|
|
// Offsets for cols and rows of Flipbook Texture
|
|
float fbcolsoffset205 = 1.0f / 2.0;
|
|
float fbrowsoffset205 = 1.0f / 2.0;
|
|
// Speed of animation
|
|
float fbspeed205 = _TimeParameters.x * 12.0;
|
|
// UV Tiling (col and row offset)
|
|
float2 fbtiling205 = float2(fbcolsoffset205, fbrowsoffset205);
|
|
// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
|
|
// Calculate current tile linear index
|
|
float fbcurrenttileindex205 = round( fmod( fbspeed205 + 0.0, fbtotaltiles205) );
|
|
fbcurrenttileindex205 += ( fbcurrenttileindex205 < 0) ? fbtotaltiles205 : 0;
|
|
// Obtain Offset X coordinate from current tile linear index
|
|
float fblinearindextox205 = round ( fmod ( fbcurrenttileindex205, 2.0 ) );
|
|
// Multiply Offset X by coloffset
|
|
float fboffsetx205 = fblinearindextox205 * fbcolsoffset205;
|
|
// Obtain Offset Y coordinate from current tile linear index
|
|
float fblinearindextoy205 = round( fmod( ( fbcurrenttileindex205 - fblinearindextox205 ) / 2.0, 2.0 ) );
|
|
// Reverse Y to get tiles from Top to Bottom
|
|
fblinearindextoy205 = (int)(2.0-1) - fblinearindextoy205;
|
|
// Multiply Offset Y by rowoffset
|
|
float fboffsety205 = fblinearindextoy205 * fbrowsoffset205;
|
|
// UV Offset
|
|
float2 fboffset205 = float2(fboffsetx205, fboffsety205);
|
|
// Flipbook UV
|
|
half2 fbuv205 = texCoord206 * fbtiling205 + fboffset205;
|
|
// *** END Flipbook UV Animation vars ***
|
|
float2 uv_Masks = packedInput.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2D( _Masks, uv_Masks );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float4 temp_output_209_0 = ( tex2D( _NoiseFlipbook, fbuv205 ) * MaskR15 );
|
|
float2 uv_ScreenHandsVDM = packedInput.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2D( _ScreenHandsVDM, uv_ScreenHandsVDM );
|
|
float myVarName244 = tex2DNode6.g;
|
|
float HandIntensity29 = _HandIntensity;
|
|
float clampResult259 = clamp( saturate( ( myVarName244 * ( HandIntensity29 * 0.7 ) ) ) , 0.0 , 0.9 );
|
|
float4 lerpResult252 = lerp( temp_output_209_0 , _TVHandsTint , ( clampResult259 * _ScreenColorTintBlend ));
|
|
float ScreenToggle242 = _ScreenToggle;
|
|
float ScreenToggleSlider283 = ( MaskR15 * ScreenToggle242 );
|
|
float4 lerpResult213 = lerp( lerpResult94 , lerpResult252 , ScreenToggleSlider283);
|
|
|
|
float MaskG63 = tex2DNode45.g;
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 appendResult20 = (float3(MaskR15 , MaskG63 , MaskB84));
|
|
float2 uv_Normal = packedInput.ase_texcoord.xy * _Normal_ST.xy + _Normal_ST.zw;
|
|
float2 uv_NormalHands = packedInput.ase_texcoord.xy * _NormalHands_ST.xy + _NormalHands_ST.zw;
|
|
float clampResult32 = clamp( HandIntensity29 , 0.0 , 1.0 );
|
|
float3 unpack21 = UnpackNormalScale( tex2D( _NormalHands, uv_NormalHands ), clampResult32 );
|
|
unpack21.z = lerp( 1, unpack21.z, saturate(clampResult32) );
|
|
float clampResult53 = clamp( SkullIntensity51 , 0.0 , 1.0 );
|
|
float3 unpack50 = UnpackNormalScale( tex2D( _NormalTopSkull, SkullWave175 ), clampResult53 );
|
|
unpack50.z = lerp( 1, unpack50.z, saturate(clampResult53) );
|
|
float clampResult98 = clamp( SideHandIntensity75 , 0.0 , 1.0 );
|
|
float3 unpack96 = UnpackNormalScale( tex2D( _NormalsLeftHand, LeftHandWave103 ), clampResult98 );
|
|
unpack96.z = lerp( 1, unpack96.z, saturate(clampResult98) );
|
|
float3 layeredBlendVar18 = appendResult20;
|
|
float3 layeredBlend18 = ( lerp( lerp( lerp( UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ) , unpack21 , layeredBlendVar18.x ) , unpack50 , layeredBlendVar18.y ) , unpack96 , layeredBlendVar18.z ) );
|
|
float3 normalizeResult19 = normalize( layeredBlend18 );
|
|
|
|
float4 TVNoise214 = temp_output_209_0;
|
|
float2 temp_cast_2 = (_TilingGlow).xx;
|
|
float2 texCoord235 = packedInput.ase_texcoord.xy * temp_cast_2 + float2( 0,0 );
|
|
float simplePerlin2D237 = snoise( texCoord235*_TimeParameters.y );
|
|
simplePerlin2D237 = simplePerlin2D237*0.5 + 0.5;
|
|
float HandMaskNoiseEmission263 = clampResult259;
|
|
|
|
float2 uv_TV_MetallicSmoothness = packedInput.ase_texcoord.xy * _TV_MetallicSmoothness_ST.xy + _TV_MetallicSmoothness_ST.zw;
|
|
|
|
surfaceDescription.Albedo = lerpResult213.rgb;
|
|
surfaceDescription.Normal = normalizeResult19;
|
|
surfaceDescription.BentNormal = float3( 0, 0, 1 );
|
|
surfaceDescription.CoatMask = 0;
|
|
surfaceDescription.Metallic = 0;
|
|
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceDescription.Specular = 0;
|
|
#endif
|
|
|
|
surfaceDescription.Emission = ( ( ( ( TVNoise214 * _NoiseTint * _GlowIntensity ) * simplePerlin2D237 ) * ( 1.0 - HandMaskNoiseEmission263 ) ) * ScreenToggle242 ).rgb;
|
|
surfaceDescription.Smoothness = ( tex2D( _TV_MetallicSmoothness, uv_TV_MetallicSmoothness ).a * _BaseSmoothness );
|
|
surfaceDescription.Occlusion = 1;
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceDescription.SpecularAAScreenSpaceVariance = 0;
|
|
surfaceDescription.SpecularAAThreshold = 0;
|
|
#endif
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceDescription.SpecularOcclusion = 0;
|
|
#endif
|
|
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceDescription.Thickness = 1;
|
|
#endif
|
|
|
|
#ifdef _HAS_REFRACTION
|
|
surfaceDescription.RefractionIndex = 1;
|
|
surfaceDescription.RefractionColor = float3( 1, 1, 1 );
|
|
surfaceDescription.RefractionDistance = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceDescription.SubsurfaceMask = 1;
|
|
#endif
|
|
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceDescription.DiffusionProfile = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceDescription.Anisotropy = 1;
|
|
surfaceDescription.Tangent = float3( 1, 0, 0 );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceDescription.IridescenceMask = 0;
|
|
surfaceDescription.IridescenceThickness = 0;
|
|
#endif
|
|
|
|
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 "ShadowCaster"
|
|
Tags { "LightMode"="ShadowCaster" }
|
|
|
|
Cull [_CullMode]
|
|
ZWrite On
|
|
ZClip [_ZClip]
|
|
ZTest LEqual
|
|
ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#define SHADERPASS SHADERPASS_SHADOWS
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
//#define USE_LEGACY_UNITY_MATRIX_VARIABLES
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 interp00 : TEXCOORD0;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout AlphaSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(AlphaSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
#ifdef _ALPHATEST_SHADOW_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThresholdShadow );
|
|
#else
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh )
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.ase_tangent.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.ase_tangent.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS);
|
|
outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
o.ase_tangent = v.ase_tangent;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
|
|
o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( PackedVaryingsMeshToPS 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_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
|
|
float3 positionRWS = packedInput.interp00.xyz;
|
|
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
input.positionRWS = positionRWS;
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false );
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
|
|
AlphaSurfaceDescription surfaceDescription = (AlphaSurfaceDescription)0;
|
|
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _ALPHATEST_SHADOW_ON
|
|
surfaceDescription.AlphaClipThresholdShadow = 0.5;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
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 "SceneSelectionPass"
|
|
Tags { "LightMode"="SceneSelectionPass" }
|
|
ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
|
#define SCENESELECTIONPASS
|
|
#pragma editor_sync_compilation
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 interp00 : TEXCOORD0;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout SceneSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SceneSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh )
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.ase_tangent.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.ase_tangent.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS);
|
|
outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
o.ase_tangent = v.ase_tangent;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
|
|
o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( PackedVaryingsMeshToPS 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_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
|
|
float3 positionRWS = packedInput.interp00.xyz;
|
|
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
input.positionRWS = positionRWS;
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false );
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
|
|
SceneSurfaceDescription surfaceDescription = (SceneSurfaceDescription)0;
|
|
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
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 "DepthOnly"
|
|
Tags { "LightMode"="DepthOnly" }
|
|
|
|
Cull [_CullMode]
|
|
|
|
ZWrite On
|
|
|
|
Stencil
|
|
{
|
|
Ref [_StencilRefDepth]
|
|
WriteMask [_StencilWriteMaskDepth]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _ _DISABLE_DECALS
|
|
|
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
|
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
|
#pragma multi_compile _ WRITE_DECAL_BUFFER
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
sampler2D _Normal;
|
|
sampler2D _NormalHands;
|
|
sampler2D _NormalTopSkull;
|
|
sampler2D _NormalsLeftHand;
|
|
sampler2D _TV_MetallicSmoothness;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_TANGENT
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 interp00 : TEXCOORD0;
|
|
float3 interp01 : TEXCOORD1;
|
|
float4 interp02 : TEXCOORD2;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout SmoothSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
normalTS = surfaceDescription.Normal;
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SmoothSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
#if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl"
|
|
#endif
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh )
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.tangentOS.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.tangentOS.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
outputPackedVaryingsMeshToPS.ase_texcoord3.zw = 0;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
inputMesh.tangentOS = inputMesh.tangentOS ;
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w);
|
|
|
|
outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS);
|
|
outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
|
|
outputPackedVaryingsMeshToPS.interp01.xyz = normalWS;
|
|
outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS;
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.tangentOS = v.tangentOS;
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
#if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH)
|
|
#define SV_TARGET_DECAL SV_Target2
|
|
#elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH)
|
|
#define SV_TARGET_DECAL SV_Target2
|
|
#else
|
|
#define SV_TARGET_DECAL SV_Target0
|
|
#endif
|
|
void Frag( PackedVaryingsMeshToPS 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
|
|
#if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)
|
|
, out float4 outDecalBuffer : SV_TARGET_DECAL
|
|
#endif
|
|
#ifdef _DEPTHOFFSET_ON
|
|
, out float outputDepth : SV_Depth
|
|
#endif
|
|
|
|
)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
|
|
float3 positionRWS = packedInput.interp00.xyz;
|
|
float3 normalWS = packedInput.interp01.xyz;
|
|
float4 tangentWS = packedInput.interp02.xyzw;
|
|
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
|
|
input.positionRWS = positionRWS;
|
|
input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS);
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false );
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
|
|
SmoothSurfaceDescription surfaceDescription = (SmoothSurfaceDescription)0;
|
|
float2 uv_Masks = packedInput.ase_texcoord3.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2D( _Masks, uv_Masks );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float MaskG63 = tex2DNode45.g;
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 appendResult20 = (float3(MaskR15 , MaskG63 , MaskB84));
|
|
float2 uv_Normal = packedInput.ase_texcoord3.xy * _Normal_ST.xy + _Normal_ST.zw;
|
|
float2 uv_NormalHands = packedInput.ase_texcoord3.xy * _NormalHands_ST.xy + _NormalHands_ST.zw;
|
|
float HandIntensity29 = _HandIntensity;
|
|
float clampResult32 = clamp( HandIntensity29 , 0.0 , 1.0 );
|
|
float3 unpack21 = UnpackNormalScale( tex2D( _NormalHands, uv_NormalHands ), clampResult32 );
|
|
unpack21.z = lerp( 1, unpack21.z, saturate(clampResult32) );
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = packedInput.ase_texcoord3.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = packedInput.ase_texcoord3.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float SkullIntensity51 = _SkullIntensity;
|
|
float clampResult53 = clamp( SkullIntensity51 , 0.0 , 1.0 );
|
|
float3 unpack50 = UnpackNormalScale( tex2D( _NormalTopSkull, SkullWave175 ), clampResult53 );
|
|
unpack50.z = lerp( 1, unpack50.z, saturate(clampResult53) );
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = packedInput.ase_texcoord3.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float SideHandIntensity75 = _SideHandIntensity;
|
|
float clampResult98 = clamp( SideHandIntensity75 , 0.0 , 1.0 );
|
|
float3 unpack96 = UnpackNormalScale( tex2D( _NormalsLeftHand, LeftHandWave103 ), clampResult98 );
|
|
unpack96.z = lerp( 1, unpack96.z, saturate(clampResult98) );
|
|
float3 layeredBlendVar18 = appendResult20;
|
|
float3 layeredBlend18 = ( lerp( lerp( lerp( UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ) , unpack21 , layeredBlendVar18.x ) , unpack50 , layeredBlendVar18.y ) , unpack96 , layeredBlendVar18.z ) );
|
|
float3 normalizeResult19 = normalize( layeredBlend18 );
|
|
|
|
float2 uv_TV_MetallicSmoothness = packedInput.ase_texcoord3.xy * _TV_MetallicSmoothness_ST.xy + _TV_MetallicSmoothness_ST.zw;
|
|
|
|
surfaceDescription.Normal = normalizeResult19;
|
|
surfaceDescription.Smoothness = ( tex2D( _TV_MetallicSmoothness, uv_TV_MetallicSmoothness ).a * _BaseSmoothness );
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
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
|
|
|
|
#if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)
|
|
DecalPrepassData decalPrepassData;
|
|
decalPrepassData.geomNormalWS = surfaceData.geomNormalWS;
|
|
decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer();
|
|
EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer);
|
|
#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
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#define SHADERPASS SHADERPASS_MOTION_VECTORS
|
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
|
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
sampler2D _Normal;
|
|
sampler2D _NormalHands;
|
|
sampler2D _NormalTopSkull;
|
|
sampler2D _NormalsLeftHand;
|
|
sampler2D _TV_MetallicSmoothness;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
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
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout SmoothSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
normalTS = surfaceDescription.Normal;
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(SmoothSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
AttributesMesh ApplyMeshModification(AttributesMesh inputMesh, float3 timeParameters, inout PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS )
|
|
{
|
|
_TimeParameters.xyz = timeParameters;
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.ase_tangent.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.ase_tangent.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
outputPackedVaryingsMeshToPS.ase_texcoord3.zw = 0;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
inputMesh.normalOS = inputMesh.normalOS ;
|
|
return inputMesh;
|
|
}
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh)
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS = (PackedVaryingsMeshToPS)0;
|
|
AttributesMesh defaultMesh = inputMesh;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, outputPackedVaryingsMeshToPS);
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
|
|
float3 VMESHpositionRWS = positionRWS;
|
|
float4 VMESHpositionCS = TransformWorldToHClip(positionRWS);
|
|
|
|
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)
|
|
AttributesMesh previousMesh = defaultMesh;
|
|
previousMesh.positionOS = effectivePositionOS ;
|
|
PackedVaryingsMeshToPS test = (PackedVaryingsMeshToPS)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));
|
|
}
|
|
|
|
outputPackedVaryingsMeshToPS.vmeshPositionCS = VMESHpositionCS;
|
|
outputPackedVaryingsMeshToPS.vmeshInterp00.xyz = VMESHpositionRWS;
|
|
|
|
outputPackedVaryingsMeshToPS.vpassInterpolators0 = float3(VPASSpositionCS.xyw);
|
|
outputPackedVaryingsMeshToPS.vpassInterpolators1 = float3(VPASSpreviousPositionCS.xyw);
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_tangent : TANGENT;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh 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
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
o.ase_tangent = v.ase_tangent;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
|
|
o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag( PackedVaryingsMeshToPS 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);
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
|
|
SmoothSurfaceDescription surfaceDescription = (SmoothSurfaceDescription)0;
|
|
float2 uv_Masks = packedInput.ase_texcoord3.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2D( _Masks, uv_Masks );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float MaskG63 = tex2DNode45.g;
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 appendResult20 = (float3(MaskR15 , MaskG63 , MaskB84));
|
|
float2 uv_Normal = packedInput.ase_texcoord3.xy * _Normal_ST.xy + _Normal_ST.zw;
|
|
float2 uv_NormalHands = packedInput.ase_texcoord3.xy * _NormalHands_ST.xy + _NormalHands_ST.zw;
|
|
float HandIntensity29 = _HandIntensity;
|
|
float clampResult32 = clamp( HandIntensity29 , 0.0 , 1.0 );
|
|
float3 unpack21 = UnpackNormalScale( tex2D( _NormalHands, uv_NormalHands ), clampResult32 );
|
|
unpack21.z = lerp( 1, unpack21.z, saturate(clampResult32) );
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = packedInput.ase_texcoord3.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = packedInput.ase_texcoord3.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float SkullIntensity51 = _SkullIntensity;
|
|
float clampResult53 = clamp( SkullIntensity51 , 0.0 , 1.0 );
|
|
float3 unpack50 = UnpackNormalScale( tex2D( _NormalTopSkull, SkullWave175 ), clampResult53 );
|
|
unpack50.z = lerp( 1, unpack50.z, saturate(clampResult53) );
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = packedInput.ase_texcoord3.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float SideHandIntensity75 = _SideHandIntensity;
|
|
float clampResult98 = clamp( SideHandIntensity75 , 0.0 , 1.0 );
|
|
float3 unpack96 = UnpackNormalScale( tex2D( _NormalsLeftHand, LeftHandWave103 ), clampResult98 );
|
|
unpack96.z = lerp( 1, unpack96.z, saturate(clampResult98) );
|
|
float3 layeredBlendVar18 = appendResult20;
|
|
float3 layeredBlend18 = ( lerp( lerp( lerp( UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ) , unpack21 , layeredBlendVar18.x ) , unpack50 , layeredBlendVar18.y ) , unpack96 , layeredBlendVar18.z ) );
|
|
float3 normalizeResult19 = normalize( layeredBlend18 );
|
|
|
|
float2 uv_TV_MetallicSmoothness = packedInput.ase_texcoord3.xy * _TV_MetallicSmoothness_ST.xy + _TV_MetallicSmoothness_ST.zw;
|
|
|
|
surfaceDescription.Normal = normalizeResult19;
|
|
surfaceDescription.Smoothness = ( tex2D( _TV_MetallicSmoothness, uv_TV_MetallicSmoothness ).a * _BaseSmoothness );
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
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
|
|
}
|
|
|
|
|
|
Pass
|
|
{
|
|
|
|
Name "Forward"
|
|
Tags { "LightMode"="Forward" }
|
|
|
|
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
|
Cull [_CullModeForward]
|
|
ZTest [_ZTestDepthEqualForOpaque]
|
|
ZWrite [_ZWrite]
|
|
|
|
Stencil
|
|
{
|
|
Ref [_StencilRef]
|
|
WriteMask [_StencilWriteMask]
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
ZFail Keep
|
|
}
|
|
|
|
|
|
ColorMask [_ColorMaskTransparentVel] 1
|
|
|
|
HLSLPROGRAM
|
|
|
|
#define _SPECULAR_OCCLUSION_FROM_AO 1
|
|
#define TESSELLATION_ON 1
|
|
#pragma require tessellation tessHW
|
|
#pragma hull HullFunction
|
|
#pragma domain DomainFunction
|
|
#define ASE_FIXED_TESSELLATION
|
|
#define HAVE_MESH_MODIFICATION
|
|
#define ASE_SRP_VERSION 100600
|
|
|
|
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
|
|
#pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
|
|
#if !defined(DEBUG_DISPLAY) && defined(_ALPHATEST_ON)
|
|
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
|
#endif
|
|
|
|
#define SHADERPASS SHADERPASS_FORWARD
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
|
|
#pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
//#define UNITY_MATERIAL_LIT
|
|
|
|
#if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define OUTPUT_SPLIT_LIGHTING
|
|
#endif
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.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"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#ifdef DEBUG_DISPLAY
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
|
#endif
|
|
|
|
// CBuffer must be declared before Material.hlsl since it internaly uses _BlendMode now
|
|
CBUFFER_START( UnityPerMaterial )
|
|
float4 _ScreenHandsVDM_ST;
|
|
float4 _NoiseTint;
|
|
float4 _NormalHands_ST;
|
|
float4 _Normal_ST;
|
|
float4 _TVHandsTint;
|
|
float4 _TV_MetallicSmoothness_ST;
|
|
float4 _TopSkullTint;
|
|
float4 _SideHandTint;
|
|
float4 _Masks_ST;
|
|
float4 _Albedo_ST;
|
|
float _DisplacementMultiplier;
|
|
float _SideHandIntensity;
|
|
float _SkullIntensity;
|
|
float _ScreenColorTintBlend;
|
|
float _ScreenToggle;
|
|
float _HandIntensity;
|
|
float _NoiseTiling;
|
|
float _GlowIntensity;
|
|
float _TilingGlow;
|
|
float _BaseSmoothness;
|
|
float4 _EmissionColor;
|
|
float _AlphaCutoff;
|
|
float _RenderQueueType;
|
|
#ifdef _ADD_PRECOMPUTED_VELOCITY
|
|
float _AddPrecomputedVelocity;
|
|
#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 _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;
|
|
sampler2D _ScreenHandsVDM;
|
|
sampler2D _Masks;
|
|
sampler2D _TopSkullVDM;
|
|
sampler2D _LeftHandVDM;
|
|
sampler2D _Albedo;
|
|
sampler2D _NoiseFlipbook;
|
|
sampler2D _Normal;
|
|
sampler2D _NormalHands;
|
|
sampler2D _NormalTopSkull;
|
|
sampler2D _NormalsLeftHand;
|
|
sampler2D _TV_MetallicSmoothness;
|
|
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl"
|
|
#define HAS_LIGHTLOOP
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.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/Material/Decal/DecalUtilities.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
|
|
#define ASE_NEEDS_VERT_TANGENT
|
|
#define ASE_NEEDS_VERT_NORMAL
|
|
|
|
|
|
#if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE)
|
|
#define ASE_NEED_CULLFACE 1
|
|
#endif
|
|
|
|
struct AttributesMesh
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
#endif
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct PackedVaryingsMeshToPS
|
|
{
|
|
float4 positionCS : SV_Position;
|
|
float3 interp00 : TEXCOORD0;
|
|
float3 interp01 : TEXCOORD1;
|
|
float4 interp02 : TEXCOORD2;
|
|
float4 interp03 : TEXCOORD3;
|
|
float4 interp04 : TEXCOORD4;
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
float3 vpassPositionCS : TEXCOORD5;
|
|
float3 vpassPreviousPositionCS : TEXCOORD6;
|
|
#endif
|
|
float4 ase_texcoord7 : TEXCOORD7;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
|
|
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
|
|
float snoise( float2 v )
|
|
{
|
|
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
|
|
float2 i = floor( v + dot( v, C.yy ) );
|
|
float2 x0 = v - i + dot( i, C.xx );
|
|
float2 i1;
|
|
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
|
|
float4 x12 = x0.xyxy + C.xxzz;
|
|
x12.xy -= i1;
|
|
i = mod2D289( i );
|
|
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
|
|
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
|
|
m = m * m;
|
|
m = m * m;
|
|
float3 x = 2.0 * frac( p * C.www ) - 1.0;
|
|
float3 h = abs( x ) - 0.5;
|
|
float3 ox = floor( x + 0.5 );
|
|
float3 a0 = x - ox;
|
|
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
|
|
float3 g;
|
|
g.x = a0.x * x0.x + h.x * x0.y;
|
|
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
return 130.0 * dot( m, g );
|
|
}
|
|
|
|
|
|
void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS)
|
|
{
|
|
ZERO_INITIALIZE(SurfaceData, surfaceData);
|
|
|
|
surfaceData.specularOcclusion = 1.0;
|
|
|
|
// surface data
|
|
surfaceData.baseColor = surfaceDescription.Albedo;
|
|
surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
|
|
surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
|
|
surfaceData.metallic = surfaceDescription.Metallic;
|
|
surfaceData.coatMask = surfaceDescription.CoatMask;
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
|
|
#endif
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceData.thickness = surfaceDescription.Thickness;
|
|
#endif
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile);
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.specularColor = surfaceDescription.Specular;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.anisotropy = surfaceDescription.Anisotropy;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
|
|
surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
|
|
#endif
|
|
|
|
// refraction
|
|
#ifdef _HAS_REFRACTION
|
|
if( _EnableSSRefraction )
|
|
{
|
|
surfaceData.ior = surfaceDescription.RefractionIndex;
|
|
surfaceData.transmittanceColor = surfaceDescription.RefractionColor;
|
|
surfaceData.atDistance = surfaceDescription.RefractionDistance;
|
|
|
|
surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha );
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
else
|
|
{
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
surfaceDescription.Alpha = 1.0;
|
|
}
|
|
#else
|
|
surfaceData.ior = 1.0;
|
|
surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
|
|
surfaceData.atDistance = 1.0;
|
|
surfaceData.transmittanceMask = 0.0;
|
|
#endif
|
|
|
|
|
|
// material features
|
|
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_TRANSMISSION
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
|
|
#endif
|
|
#ifdef ASE_LIT_CLEAR_COAT
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
|
|
#endif
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
|
|
#endif
|
|
|
|
// others
|
|
#if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR)
|
|
surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) );
|
|
#endif
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
// normals
|
|
float3 normalTS = float3(0.0f, 0.0f, 1.0f);
|
|
normalTS = surfaceDescription.Normal;
|
|
GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants );
|
|
|
|
surfaceData.geomNormalWS = fragInputs.tangentToWorld[2];
|
|
surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz );
|
|
|
|
// decals
|
|
#if HAVE_DECALS
|
|
if( _EnableDecals )
|
|
{
|
|
DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], surfaceDescription.Alpha);
|
|
ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData);
|
|
}
|
|
#endif
|
|
|
|
bentNormalWS = surfaceData.normalWS;
|
|
|
|
#ifdef ASE_BENT_NORMAL
|
|
GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld );
|
|
#endif
|
|
surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS );
|
|
|
|
|
|
#if defined(_SPECULAR_OCCLUSION_CUSTOM)
|
|
#elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) );
|
|
#elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO)
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) );
|
|
#endif
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold );
|
|
#endif
|
|
|
|
// debug
|
|
#if defined(DEBUG_DISPLAY)
|
|
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)
|
|
{
|
|
surfaceData.metallic = 0;
|
|
}
|
|
ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData);
|
|
#endif
|
|
}
|
|
|
|
void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
|
|
{
|
|
#ifdef LOD_FADE_CROSSFADE
|
|
LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
#ifdef _DOUBLESIDED_ON
|
|
float3 doubleSidedConstants = _DoubleSidedConstants.xyz;
|
|
#else
|
|
float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 );
|
|
#endif
|
|
|
|
ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants );
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
builtinData.depthOffset = surfaceDescription.DepthOffset;
|
|
ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput );
|
|
#endif
|
|
|
|
float3 bentNormalWS;
|
|
BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS );
|
|
|
|
InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData );
|
|
|
|
#ifdef _ASE_BAKEDGI
|
|
builtinData.bakeDiffuseLighting = surfaceDescription.BakedGI;
|
|
#endif
|
|
#ifdef _ASE_BAKEDBACKGI
|
|
builtinData.backBakeDiffuseLighting = surfaceDescription.BakedBackGI;
|
|
#endif
|
|
|
|
builtinData.emissiveColor = surfaceDescription.Emission;
|
|
|
|
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
|
|
}
|
|
|
|
AttributesMesh ApplyMeshModification(AttributesMesh inputMesh, float3 timeParameters, inout PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS )
|
|
{
|
|
_TimeParameters.xyz = timeParameters;
|
|
float2 uv_ScreenHandsVDM = inputMesh.ase_texcoord.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2Dlod( _ScreenHandsVDM, float4( uv_ScreenHandsVDM, 0, 0.0) );
|
|
float4 appendResult5 = (float4(tex2DNode6.r , tex2DNode6.b , tex2DNode6.g , 0.0));
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = inputMesh.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 uv_Masks = inputMesh.ase_texcoord.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2Dlod( _Masks, float4( uv_Masks, 0, 0.0) );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float3 ase_worldTangent = TransformObjectToWorldDir(inputMesh.tangentOS.xyz);
|
|
float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float ase_vertexTangentSign = inputMesh.tangentOS.w * unity_WorldTransformParams.w;
|
|
float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
|
|
float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
|
|
float3 tangentTobjectDir4 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult5 * BasicNoise116 ) * MaskR15 ).xyz ), 0 ) ).xyz;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2Dlod( _TopSkullVDM, float4( SkullWave175, 0, 0.0) );
|
|
float4 appendResult36 = (float4(tex2DNode35.r , tex2DNode35.b , tex2DNode35.g , 0.0));
|
|
float MaskG63 = tex2DNode45.g;
|
|
float3 tangentTobjectDir38 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( appendResult36 * MaskG63 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult72 = lerp( ( tangentTobjectDir4 * _HandIntensity ) , ( tangentTobjectDir38 * _SkullIntensity ) , MaskG63);
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = inputMesh.ase_texcoord.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2Dlod( _LeftHandVDM, float4( LeftHandWave103, 0, 0.0) );
|
|
float4 appendResult78 = (float4(tex2DNode77.r , tex2DNode77.b , tex2DNode77.g , 0.0));
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 tangentTobjectDir82 = mul( GetWorldToObjectMatrix(), float4( mul( ase_tangentToWorldFast, ( ( appendResult78 * BasicNoise116 ) * MaskB84 ).xyz ), 0 ) ).xyz;
|
|
float3 lerpResult85 = lerp( lerpResult72 , ( tangentTobjectDir82 * _SideHandIntensity ) , MaskB84);
|
|
|
|
outputPackedVaryingsMeshToPS.ase_texcoord7.xy = inputMesh.ase_texcoord.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
outputPackedVaryingsMeshToPS.ase_texcoord7.zw = 0;
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
float3 defaultVertexValue = inputMesh.positionOS.xyz;
|
|
#else
|
|
float3 defaultVertexValue = float3( 0, 0, 0 );
|
|
#endif
|
|
float3 vertexValue = ( lerpResult85 * _DisplacementMultiplier );
|
|
|
|
#ifdef ASE_ABSOLUTE_VERTEX_POS
|
|
inputMesh.positionOS.xyz = vertexValue;
|
|
#else
|
|
inputMesh.positionOS.xyz += vertexValue;
|
|
#endif
|
|
inputMesh.normalOS = inputMesh.normalOS;
|
|
inputMesh.tangentOS = inputMesh.tangentOS;
|
|
return inputMesh;
|
|
}
|
|
|
|
PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh)
|
|
{
|
|
PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS = (PackedVaryingsMeshToPS)0;
|
|
AttributesMesh defaultMesh = inputMesh;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(inputMesh);
|
|
UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS );
|
|
|
|
inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, outputPackedVaryingsMeshToPS);
|
|
|
|
float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS);
|
|
float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS);
|
|
float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w);
|
|
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
float4 VPASSpreviousPositionCS;
|
|
float4 VPASSpositionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 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)
|
|
AttributesMesh previousMesh = defaultMesh;
|
|
previousMesh.positionOS = effectivePositionOS ;
|
|
PackedVaryingsMeshToPS test = (PackedVaryingsMeshToPS)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));
|
|
}
|
|
#endif
|
|
|
|
outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS);
|
|
outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
|
|
outputPackedVaryingsMeshToPS.interp01.xyz = normalWS;
|
|
outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS;
|
|
outputPackedVaryingsMeshToPS.interp03.xyzw = inputMesh.uv1;
|
|
outputPackedVaryingsMeshToPS.interp04.xyzw = inputMesh.uv2;
|
|
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
outputPackedVaryingsMeshToPS.vpassPositionCS = float3(VPASSpositionCS.xyw);
|
|
outputPackedVaryingsMeshToPS.vpassPreviousPositionCS = float3(VPASSpreviousPositionCS.xyw);
|
|
#endif
|
|
return outputPackedVaryingsMeshToPS;
|
|
}
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
struct VertexControl
|
|
{
|
|
float3 positionOS : INTERNALTESSPOS;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
float3 previousPositionOS : TEXCOORD4;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
float3 precomputedVelocity : TEXCOORD5;
|
|
#endif
|
|
#endif
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct TessellationFactors
|
|
{
|
|
float edge[3] : SV_TessFactor;
|
|
float inside : SV_InsideTessFactor;
|
|
};
|
|
|
|
VertexControl Vert ( AttributesMesh v )
|
|
{
|
|
VertexControl o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
o.positionOS = v.positionOS;
|
|
o.normalOS = v.normalOS;
|
|
o.tangentOS = v.tangentOS;
|
|
o.uv1 = v.uv1;
|
|
o.uv2 = v.uv2;
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
o.previousPositionOS = v.previousPositionOS;
|
|
#if defined (_ADD_PRECOMPUTED_VELOCITY)
|
|
o.precomputedVelocity = v.precomputedVelocity;
|
|
#endif
|
|
#endif
|
|
o.ase_texcoord = v.ase_texcoord;
|
|
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")]
|
|
PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
|
|
{
|
|
AttributesMesh o = (AttributesMesh) 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.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * 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;
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
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
|
|
#endif
|
|
o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * 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
|
|
PackedVaryingsMeshToPS Vert ( AttributesMesh v )
|
|
{
|
|
return VertexFunction( v );
|
|
}
|
|
#endif
|
|
|
|
void Frag(PackedVaryingsMeshToPS packedInput,
|
|
#ifdef OUTPUT_SPLIT_LIGHTING
|
|
out float4 outColor : SV_Target0,
|
|
out float4 outDiffuseLighting : SV_Target1,
|
|
OUTPUT_SSSBUFFER(outSSSBuffer)
|
|
#else
|
|
out float4 outColor : SV_Target0
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
, out float4 outMotionVec : SV_Target1
|
|
#endif
|
|
#endif
|
|
#ifdef _DEPTHOFFSET_ON
|
|
, out float outputDepth : SV_Depth
|
|
#endif
|
|
|
|
)
|
|
{
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
outMotionVec = float4(2.0, 0.0, 0.0, 0.0);
|
|
#endif
|
|
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput );
|
|
UNITY_SETUP_INSTANCE_ID( packedInput );
|
|
float3 positionRWS = packedInput.interp00.xyz;
|
|
float3 normalWS = packedInput.interp01.xyz;
|
|
float4 tangentWS = packedInput.interp02.xyzw;
|
|
|
|
FragInputs input;
|
|
ZERO_INITIALIZE(FragInputs, input);
|
|
input.tangentToWorld = k_identity3x3;
|
|
input.positionSS = packedInput.positionCS;
|
|
input.positionRWS = positionRWS;
|
|
input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS);
|
|
input.texCoord1 = packedInput.interp03.xyzw;
|
|
input.texCoord2 = packedInput.interp04.xyzw;
|
|
|
|
#if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT
|
|
input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false);
|
|
#elif SHADER_STAGE_FRAGMENT
|
|
#if defined(ASE_NEED_CULLFACE)
|
|
input.isFrontFace = IS_FRONT_VFACE(packedInput.cullFace, true, false);
|
|
#endif
|
|
#endif
|
|
half isFrontFace = input.isFrontFace;
|
|
|
|
input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy;
|
|
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize ();
|
|
|
|
PositionInputs posInput = GetPositionInput( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex );
|
|
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
|
|
|
GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0;
|
|
float2 uv_Albedo = packedInput.ase_texcoord7.xy * _Albedo_ST.xy + _Albedo_ST.zw;
|
|
float SkullIntensity51 = _SkullIntensity;
|
|
float2 temp_cast_0 = (_NoiseTiling).xx;
|
|
float2 texCoord13 = packedInput.ase_texcoord7.xy * temp_cast_0 + float2( 0,0 );
|
|
float simplePerlin2D11 = snoise( texCoord13*sin( _TimeParameters.x * 0.25 ) );
|
|
simplePerlin2D11 = simplePerlin2D11*0.5 + 0.5;
|
|
float BasicNoise116 = simplePerlin2D11;
|
|
float2 appendResult171 = (float2(( 0.11 * BasicNoise116 ) , ( BasicNoise116 * 0.04 )));
|
|
float2 texCoord172 = packedInput.ase_texcoord7.xy * float2( 1,1 ) + appendResult171;
|
|
float2 SkullWave175 = texCoord172;
|
|
float4 tex2DNode35 = tex2D( _TopSkullVDM, SkullWave175 );
|
|
float TopSkullColorMask66 = tex2DNode35.g;
|
|
float clampResult59 = clamp( ( ( SkullIntensity51 * 0.5 ) * TopSkullColorMask66 ) , 0.0 , 0.5 );
|
|
float4 lerpResult56 = lerp( tex2D( _Albedo, uv_Albedo ) , _TopSkullTint , clampResult59);
|
|
float SideHandIntensity75 = _SideHandIntensity;
|
|
float2 appendResult110 = (float2(( -0.01 * BasicNoise116 ) , ( simplePerlin2D11 * 0.04 )));
|
|
float2 texCoord99 = packedInput.ase_texcoord7.xy * float2( 1,1 ) + appendResult110;
|
|
float2 LeftHandWave103 = texCoord99;
|
|
float4 tex2DNode77 = tex2D( _LeftHandVDM, LeftHandWave103 );
|
|
float SideHandColorMask80 = tex2DNode77.g;
|
|
float clampResult93 = clamp( ( ( SideHandIntensity75 * 0.5 ) * SideHandColorMask80 ) , 0.0 , 0.5 );
|
|
float4 lerpResult94 = lerp( lerpResult56 , _SideHandTint , clampResult93);
|
|
float2 texCoord206 = packedInput.ase_texcoord7.xy * float2( 3,3 ) + float2( 0,0 );
|
|
// *** BEGIN Flipbook UV Animation vars ***
|
|
// Total tiles of Flipbook Texture
|
|
float fbtotaltiles205 = 2.0 * 2.0;
|
|
// Offsets for cols and rows of Flipbook Texture
|
|
float fbcolsoffset205 = 1.0f / 2.0;
|
|
float fbrowsoffset205 = 1.0f / 2.0;
|
|
// Speed of animation
|
|
float fbspeed205 = _TimeParameters.x * 12.0;
|
|
// UV Tiling (col and row offset)
|
|
float2 fbtiling205 = float2(fbcolsoffset205, fbrowsoffset205);
|
|
// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
|
|
// Calculate current tile linear index
|
|
float fbcurrenttileindex205 = round( fmod( fbspeed205 + 0.0, fbtotaltiles205) );
|
|
fbcurrenttileindex205 += ( fbcurrenttileindex205 < 0) ? fbtotaltiles205 : 0;
|
|
// Obtain Offset X coordinate from current tile linear index
|
|
float fblinearindextox205 = round ( fmod ( fbcurrenttileindex205, 2.0 ) );
|
|
// Multiply Offset X by coloffset
|
|
float fboffsetx205 = fblinearindextox205 * fbcolsoffset205;
|
|
// Obtain Offset Y coordinate from current tile linear index
|
|
float fblinearindextoy205 = round( fmod( ( fbcurrenttileindex205 - fblinearindextox205 ) / 2.0, 2.0 ) );
|
|
// Reverse Y to get tiles from Top to Bottom
|
|
fblinearindextoy205 = (int)(2.0-1) - fblinearindextoy205;
|
|
// Multiply Offset Y by rowoffset
|
|
float fboffsety205 = fblinearindextoy205 * fbrowsoffset205;
|
|
// UV Offset
|
|
float2 fboffset205 = float2(fboffsetx205, fboffsety205);
|
|
// Flipbook UV
|
|
half2 fbuv205 = texCoord206 * fbtiling205 + fboffset205;
|
|
// *** END Flipbook UV Animation vars ***
|
|
float2 uv_Masks = packedInput.ase_texcoord7.xy * _Masks_ST.xy + _Masks_ST.zw;
|
|
float4 tex2DNode45 = tex2D( _Masks, uv_Masks );
|
|
float MaskR15 = tex2DNode45.r;
|
|
float4 temp_output_209_0 = ( tex2D( _NoiseFlipbook, fbuv205 ) * MaskR15 );
|
|
float2 uv_ScreenHandsVDM = packedInput.ase_texcoord7.xy * _ScreenHandsVDM_ST.xy + _ScreenHandsVDM_ST.zw;
|
|
float4 tex2DNode6 = tex2D( _ScreenHandsVDM, uv_ScreenHandsVDM );
|
|
float myVarName244 = tex2DNode6.g;
|
|
float HandIntensity29 = _HandIntensity;
|
|
float clampResult259 = clamp( saturate( ( myVarName244 * ( HandIntensity29 * 0.7 ) ) ) , 0.0 , 0.9 );
|
|
float4 lerpResult252 = lerp( temp_output_209_0 , _TVHandsTint , ( clampResult259 * _ScreenColorTintBlend ));
|
|
float ScreenToggle242 = _ScreenToggle;
|
|
float ScreenToggleSlider283 = ( MaskR15 * ScreenToggle242 );
|
|
float4 lerpResult213 = lerp( lerpResult94 , lerpResult252 , ScreenToggleSlider283);
|
|
|
|
float MaskG63 = tex2DNode45.g;
|
|
float MaskB84 = tex2DNode45.b;
|
|
float3 appendResult20 = (float3(MaskR15 , MaskG63 , MaskB84));
|
|
float2 uv_Normal = packedInput.ase_texcoord7.xy * _Normal_ST.xy + _Normal_ST.zw;
|
|
float2 uv_NormalHands = packedInput.ase_texcoord7.xy * _NormalHands_ST.xy + _NormalHands_ST.zw;
|
|
float clampResult32 = clamp( HandIntensity29 , 0.0 , 1.0 );
|
|
float3 unpack21 = UnpackNormalScale( tex2D( _NormalHands, uv_NormalHands ), clampResult32 );
|
|
unpack21.z = lerp( 1, unpack21.z, saturate(clampResult32) );
|
|
float clampResult53 = clamp( SkullIntensity51 , 0.0 , 1.0 );
|
|
float3 unpack50 = UnpackNormalScale( tex2D( _NormalTopSkull, SkullWave175 ), clampResult53 );
|
|
unpack50.z = lerp( 1, unpack50.z, saturate(clampResult53) );
|
|
float clampResult98 = clamp( SideHandIntensity75 , 0.0 , 1.0 );
|
|
float3 unpack96 = UnpackNormalScale( tex2D( _NormalsLeftHand, LeftHandWave103 ), clampResult98 );
|
|
unpack96.z = lerp( 1, unpack96.z, saturate(clampResult98) );
|
|
float3 layeredBlendVar18 = appendResult20;
|
|
float3 layeredBlend18 = ( lerp( lerp( lerp( UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ) , unpack21 , layeredBlendVar18.x ) , unpack50 , layeredBlendVar18.y ) , unpack96 , layeredBlendVar18.z ) );
|
|
float3 normalizeResult19 = normalize( layeredBlend18 );
|
|
|
|
float4 TVNoise214 = temp_output_209_0;
|
|
float2 temp_cast_2 = (_TilingGlow).xx;
|
|
float2 texCoord235 = packedInput.ase_texcoord7.xy * temp_cast_2 + float2( 0,0 );
|
|
float simplePerlin2D237 = snoise( texCoord235*_TimeParameters.y );
|
|
simplePerlin2D237 = simplePerlin2D237*0.5 + 0.5;
|
|
float HandMaskNoiseEmission263 = clampResult259;
|
|
|
|
float2 uv_TV_MetallicSmoothness = packedInput.ase_texcoord7.xy * _TV_MetallicSmoothness_ST.xy + _TV_MetallicSmoothness_ST.zw;
|
|
|
|
surfaceDescription.Albedo = lerpResult213.rgb;
|
|
surfaceDescription.Normal = normalizeResult19;
|
|
surfaceDescription.BentNormal = float3( 0, 0, 1 );
|
|
surfaceDescription.CoatMask = 0;
|
|
surfaceDescription.Metallic = 0;
|
|
|
|
#ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
surfaceDescription.Specular = 0;
|
|
#endif
|
|
|
|
surfaceDescription.Emission = ( ( ( ( TVNoise214 * _NoiseTint * _GlowIntensity ) * simplePerlin2D237 ) * ( 1.0 - HandMaskNoiseEmission263 ) ) * ScreenToggle242 ).rgb;
|
|
surfaceDescription.Smoothness = ( tex2D( _TV_MetallicSmoothness, uv_TV_MetallicSmoothness ).a * _BaseSmoothness );
|
|
surfaceDescription.Occlusion = 1;
|
|
surfaceDescription.Alpha = 1;
|
|
|
|
#ifdef _ALPHATEST_ON
|
|
surfaceDescription.AlphaClipThreshold = _AlphaCutoff;
|
|
#endif
|
|
|
|
#ifdef _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
surfaceDescription.SpecularAAScreenSpaceVariance = 0;
|
|
surfaceDescription.SpecularAAThreshold = 0;
|
|
#endif
|
|
|
|
#ifdef _SPECULAR_OCCLUSION_CUSTOM
|
|
surfaceDescription.SpecularOcclusion = 0;
|
|
#endif
|
|
|
|
#if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION)
|
|
surfaceDescription.Thickness = 1;
|
|
#endif
|
|
|
|
#ifdef _HAS_REFRACTION
|
|
surfaceDescription.RefractionIndex = 1;
|
|
surfaceDescription.RefractionColor = float3( 1, 1, 1 );
|
|
surfaceDescription.RefractionDistance = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
surfaceDescription.SubsurfaceMask = 1;
|
|
#endif
|
|
|
|
#if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION )
|
|
surfaceDescription.DiffusionProfile = 0;
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_ANISOTROPY
|
|
surfaceDescription.Anisotropy = 1;
|
|
surfaceDescription.Tangent = float3( 1, 0, 0 );
|
|
#endif
|
|
|
|
#ifdef _MATERIAL_FEATURE_IRIDESCENCE
|
|
surfaceDescription.IridescenceMask = 0;
|
|
surfaceDescription.IridescenceThickness = 0;
|
|
#endif
|
|
|
|
#ifdef _ASE_BAKEDGI
|
|
surfaceDescription.BakedGI = 0;
|
|
#endif
|
|
#ifdef _ASE_BAKEDBACKGI
|
|
surfaceDescription.BakedBackGI = 0;
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
surfaceDescription.DepthOffset = 0;
|
|
#endif
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(surfaceDescription,input, V, posInput, surfaceData, builtinData);
|
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData);
|
|
|
|
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
|
|
|
|
outColor = float4(0.0, 0.0, 0.0, 0.0);
|
|
#ifdef DEBUG_DISPLAY
|
|
#ifdef OUTPUT_SPLIT_LIGHTING
|
|
outDiffuseLighting = 0;
|
|
ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer);
|
|
#endif
|
|
|
|
bool viewMaterial = false;
|
|
int bufferSize = _DebugViewMaterialArray[0].x;
|
|
if (bufferSize != 0)
|
|
{
|
|
bool needLinearToSRGB = false;
|
|
float3 result = float3(1.0, 0.0, 1.0);
|
|
|
|
for (int index = 1; index <= bufferSize; index++)
|
|
{
|
|
int indexMaterialProperty = _DebugViewMaterialArray[index].x;
|
|
|
|
if (indexMaterialProperty != 0)
|
|
{
|
|
viewMaterial = true;
|
|
|
|
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 (!viewMaterial)
|
|
{
|
|
if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR)
|
|
{
|
|
float3 result = float3(0.0, 0.0, 0.0);
|
|
|
|
GetPBRValidatorDebug(surfaceData, result);
|
|
|
|
outColor = float4(result, 1.0f);
|
|
}
|
|
else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW)
|
|
{
|
|
float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A);
|
|
outColor = result;
|
|
}
|
|
else
|
|
#endif
|
|
{
|
|
#ifdef _SURFACE_TYPE_TRANSPARENT
|
|
uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT;
|
|
#else
|
|
uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE;
|
|
#endif
|
|
|
|
LightLoopOutput lightLoopOutput;
|
|
LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput);
|
|
|
|
// Alias
|
|
float3 diffuseLighting = lightLoopOutput.diffuseLighting;
|
|
float3 specularLighting = lightLoopOutput.specularLighting;
|
|
|
|
diffuseLighting *= GetCurrentExposureMultiplier();
|
|
specularLighting *= GetCurrentExposureMultiplier();
|
|
|
|
#ifdef OUTPUT_SPLIT_LIGHTING
|
|
if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData))
|
|
{
|
|
outColor = float4(specularLighting, 1.0);
|
|
outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0);
|
|
}
|
|
else
|
|
{
|
|
outColor = float4(diffuseLighting + specularLighting, 1.0);
|
|
outDiffuseLighting = 0;
|
|
}
|
|
ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer);
|
|
#else
|
|
outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity);
|
|
outColor = EvaluateAtmosphericScattering(posInput, V, outColor);
|
|
#endif
|
|
|
|
#ifdef _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
float4 VPASSpositionCS = float4(packedInput.vpassPositionCS.xy, 0.0, packedInput.vpassPositionCS.z);
|
|
float4 VPASSpreviousPositionCS = float4(packedInput.vpassPreviousPositionCS.xy, 0.0, packedInput.vpassPreviousPositionCS.z);
|
|
|
|
bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0);
|
|
if (!forceNoMotion)
|
|
{
|
|
float2 motionVec = CalculateMotionVector(VPASSpositionCS, VPASSpreviousPositionCS);
|
|
EncodeMotionVector(motionVec * 0.5, outMotionVec);
|
|
outMotionVec.zw = 1.0;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
#ifdef DEBUG_DISPLAY
|
|
}
|
|
#endif
|
|
|
|
#ifdef _DEPTHOFFSET_ON
|
|
outputDepth = posInput.deviceDepth;
|
|
#endif
|
|
}
|
|
ENDHLSL
|
|
}
|
|
|
|
}
|
|
CustomEditor "Rendering.HighDefinition.LitShaderGraphGUI"
|
|
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18916
|
|
592;73;931;745;9549.533;4158.436;13.15998;False;False
|
|
Node;AmplifyShaderEditor.CommentaryNode;298;-4525.466,2521.156;Inherit;False;1044.41;393.6719;;5;10;12;13;11;116;Basic noise for fake anim, use whatever you need.;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;10;-4475.466,2683.829;Inherit;False;Property;_NoiseTiling;Noise Tiling;4;0;Create;True;0;0;0;False;0;False;1;1.2;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;13;-4316.979,2571.156;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SinTimeNode;12;-4284.188,2731.828;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.NoiseGeneratorNode;11;-4079.661,2644.248;Inherit;False;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;300;-3712.118,1860.387;Inherit;False;1295.137;427.7112;Setting some limits, avoiding seams - optional;8;174;173;168;169;170;171;172;175;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;116;-3705.06,2678.444;Inherit;False;BasicNoise;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;168;-3662.118,2007.377;Inherit;False;116;BasicNoise;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;299;-3291.272,2592.823;Inherit;False;961.709;427.7114;Setting some limits, avoiding seams - optional;7;108;111;112;107;110;99;103;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;174;-3470.356,2165.14;Inherit;False;Constant;_Float1;Float 1;19;0;Create;True;0;0;0;False;0;False;0.04;0.04;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;173;-3425.921,1910.387;Inherit;False;Constant;_Float3;Float 3;16;0;Create;True;0;0;0;False;0;False;0.11;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;34;-2546.062,1342.8;Inherit;False;1795.94;448.062;Screen Hand;12;182;5;181;7;4;16;48;17;29;8;244;6;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;111;-3267.837,2647.823;Inherit;False;Constant;_Float2;Float 2;14;0;Create;True;0;0;0;False;0;False;-0.01;-0.01;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;169;-3280.902,1973.098;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;170;-3262.902,2153.098;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;108;-3258.272,2897.576;Inherit;False;Constant;_Float0;Float 0;18;0;Create;True;0;0;0;False;0;False;0.04;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;112;-3026.819,2703.534;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;8;-1337.964,1653.288;Inherit;False;Property;_HandIntensity;Hand Intensity;1;0;Create;True;0;0;0;False;0;False;0;1.059;0;3;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;107;-3033.819,2885.534;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;171;-3136.902,2036.098;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;285;-2558.538,-2682.829;Inherit;False;1658.815;1343.374;;24;211;212;206;208;205;203;210;209;241;214;242;227;283;246;255;259;263;252;253;256;260;254;304;305;Noise and Screen Toggle;0.6792453,0.6247775,0.6247775,1;0;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;288;-2636.625,-1239.426;Inherit;False;1862.818;1242.385;;11;45;15;63;84;2;96;50;21;20;18;19;Normal Combine;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;110;-2907.818,2768.534;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;172;-2982.031,1987.432;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SamplerNode;6;-2519.142,1445.017;Inherit;True;Property;_ScreenHandsVDM;Screen Hands VDM;20;0;Create;True;0;0;0;False;0;False;-1;None;821049934f0b08f43b59f0e83855b872;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;29;-1002.548,1650.583;Inherit;False;HandIntensity;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;71;-2265.984,1944.756;Inherit;False;1405.517;500.1821;Top Skull;9;40;39;38;37;36;54;41;35;51;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;206;-2510.236,-2626.039;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;3,3;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;175;-2640.981,2007.929;Inherit;False;SkullWave;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;212;-2418.346,-2344.583;Inherit;False;Constant;_Float5;Float 5;17;0;Create;True;0;0;0;False;0;False;12;12;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;40;-1451.203,2222.564;Inherit;False;Property;_SkullIntensity;Skull Intensity;2;0;Create;True;0;0;0;False;0;False;0;0.3;0;1.5;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;99;-2775.953,2759.746;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;208;-2425.938,-2441.429;Inherit;False;Constant;_Float4;Float 4;18;0;Create;True;0;0;0;False;0;False;2;6;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;244;-2169.768,1659.385;Inherit;False;myVarName;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;45;-2586.625,-1180.15;Inherit;True;Property;_Masks;Masks;8;0;Create;True;0;0;0;False;0;False;-1;9670904ec41723446943d2bfc39209fa;9670904ec41723446943d2bfc39209fa;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SimpleTimeNode;211;-2387.946,-2230.482;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;254;-2261.681,-1455.458;Inherit;False;29;HandIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;95;-2225.563,2605.475;Inherit;False;1405.516;500.1832;Side Hand;12;117;83;82;81;79;118;78;80;76;77;75;74;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.SamplerNode;35;-2215.984,1994.756;Inherit;True;Property;_TopSkullVDM;Top Skull VDM;21;0;Create;True;0;0;0;False;0;False;-1;None;6c5beca9a2811f54e8e341880e84b0d3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;74;-1465.784,2886.284;Inherit;False;Property;_SideHandIntensity;Side Hand Intensity;3;0;Create;True;0;0;0;False;0;False;0;1.5;0;1.5;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;63;-2248.896,-1107.629;Inherit;False;MaskG;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;15;-2253.031,-1189.426;Inherit;False;MaskR;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;103;-2553.563,2745.606;Inherit;False;LeftHandWave;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;51;-1109.332,2302.521;Inherit;False;SkullIntensity;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;260;-2006.069,-1529.694;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.7;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;246;-2277.068,-1657.024;Inherit;True;244;myVarName;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;70;-2509.243,-3879.968;Inherit;False;1080.007;507.1975;;7;56;57;59;60;67;65;58;Top Skull Color;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.TFHCFlipBookUVAnimation;205;-2179.741,-2488.422;Inherit;False;0;0;6;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;75;-1068.911,2963.241;Inherit;False;SideHandIntensity;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;17;-1948.042,1700.561;Inherit;False;15;MaskR;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;182;-1967.172,1608.192;Inherit;False;116;BasicNoise;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;5;-1951.265,1421.653;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;84;-2245.4,-1006.252;Inherit;False;MaskB;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;255;-1819.381,-1641.306;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;203;-1886.771,-2413.138;Inherit;True;Property;_NoiseFlipbook;Noise Flipbook;16;0;Create;True;0;0;0;False;0;False;-1;None;12c89afe141ffb44db0961b50bfb0d10;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;210;-1941.535,-2218.95;Inherit;False;15;MaskR;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;66;-1842.012,2328.938;Inherit;False;TopSkullColorMask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;58;-2459.242,-3574.189;Inherit;False;51;SkullIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;77;-2175.563,2655.475;Inherit;True;Property;_LeftHandVDM;Left Hand VDM;22;0;Create;True;0;0;0;False;0;False;-1;None;bb176a5ceabe4274b8868f4a3c27d7ca;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.CommentaryNode;87;-2195.11,-3288.74;Inherit;False;1080.007;507.1975;;7;92;94;93;91;89;90;88;Side Hands Color;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;41;-2196.209,2210.148;Inherit;False;63;MaskG;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;78;-1822.435,2672.445;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;36;-1822.028,2029.083;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;239;-2513.243,176.0331;Inherit;False;1588.513;776.5707;Comment;14;270;265;271;238;266;237;264;218;217;219;236;235;221;234;Noise Glow;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;76;-2158.156,2887.868;Inherit;False;84;MaskB;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ComponentMaskNode;48;-1739.656,1686.291;Inherit;False;True;False;False;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;117;-1811.314,2818.095;Inherit;False;116;BasicNoise;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;181;-1672.673,1445.23;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;1;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;80;-1801.59,2989.658;Inherit;False;SideHandColorMask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;209;-1488.53,-2327.071;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;67;-2246.855,-3598.525;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;65;-2359.05,-3488.771;Inherit;False;66;TopSkullColorMask;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ComponentMaskNode;54;-1836.52,2189.116;Inherit;False;False;True;False;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;88;-2145.11,-2982.961;Inherit;False;75;SideHandIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SaturateNode;256;-1561.254,-1644.977;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;214;-1158.511,-2389.336;Inherit;False;TVNoise;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;118;-1641.688,2681.256;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.ComponentMaskNode;79;-1800.099,2895.836;Inherit;False;False;True;False;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-1529.042,1446.396;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;234;-2463.243,675.1545;Inherit;False;Property;_TilingGlow;Tiling Glow;5;0;Create;True;0;0;0;False;0;False;1;4;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;90;-2044.919,-2897.542;Inherit;False;80;SideHandColorMask;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;37;-1636.828,2027.89;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;241;-2369.934,-2093.861;Inherit;False;Property;_ScreenToggle;Screen Toggle;0;0;Create;True;0;0;0;False;0;False;0;0.2;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;259;-1400.961,-1666.205;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0.9;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;60;-2088.913,-3588.666;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;89;-1932.724,-3007.297;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;287;-2551.284,-4316.573;Inherit;False;370;280;;1;1;Base Albedo;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;297;-2570.086,-676.3178;Inherit;False;508.3955;681.277;This is optional, increasing it here because we're blending in the effect.;8;53;98;176;114;32;97;52;30;;0.6981132,0.530157,0.3852794,1;0;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;97;-2506.661,-156.1489;Inherit;False;75;SideHandIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;81;-1505.407,2690.61;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;221;-2322.818,481.376;Inherit;False;Property;_GlowIntensity;Glow Intensity;17;1;[HDR];Create;True;0;0;0;False;0;False;0;0.33;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;59;-1907.707,-3604.189;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0.5;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;52;-2530.627,-397.2189;Inherit;False;51;SkullIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;302;-271.9519,1624.287;Inherit;False;1027.477;547.8003;Blend it all;6;85;86;72;64;306;307;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.ColorNode;219;-2347.196,306.9973;Inherit;False;Property;_NoiseTint;Noise Tint;18;1;[HDR];Create;True;0;0;0;False;0;False;0,0,0,0;1.014418,1.157659,1.54717,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SamplerNode;1;-2501.284,-4266.573;Inherit;True;Property;_Albedo;Albedo;7;0;Create;True;0;0;0;False;0;False;-1;None;fee3d6c66c9f7fc4294caf4caefc054e;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.TransformDirectionNode;38;-1415.953,2011.614;Inherit;False;Tangent;Object;False;Fast;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
|
|
Node;AmplifyShaderEditor.SinTimeNode;236;-2271.965,723.1533;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;217;-2327.82,226.0331;Inherit;False;214;TVNoise;1;0;OBJECT;;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;91;-1774.784,-2997.438;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode;57;-2221.236,-3829.968;Inherit;False;Property;_TopSkullTint;Top Skull Tint;10;0;Create;True;0;0;0;False;0;False;0,0,0,0;0.5188676,0.4674706,0.4674706,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.TransformDirectionNode;4;-1323.958,1467.479;Inherit;False;Tangent;Object;False;Fast;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;242;-1967.658,-2095.633;Inherit;False;ScreenToggle;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;235;-2304.756,562.4815;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;30;-2532.086,-594.8367;Inherit;False;29;HandIntensity;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;263;-1145.273,-1513.932;Inherit;False;HandMaskNoiseEmission;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;32;-2268.815,-628.3178;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TransformDirectionNode;82;-1314.532,2674.333;Inherit;False;Tangent;Object;False;Fast;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
|
|
Node;AmplifyShaderEditor.ColorNode;92;-1907.106,-3238.74;Inherit;False;Property;_SideHandTint;Side Hand Tint;11;0;Create;True;0;0;0;False;0;False;0,0,0,0;0.9622641,0.5155641,0.3131886,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-1037.568,1454.148;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;64;-221.9519,1873.805;Inherit;False;63;MaskG;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;114;-2522.542,-247.285;Inherit;False;103;LeftHandWave;1;0;OBJECT;;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;93;-1593.576,-3012.961;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0.5;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.NoiseGeneratorNode;237;-2067.434,635.5734;Inherit;False;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LerpOp;56;-1611.237,-3719.968;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;305;-1464.403,-1510.935;Inherit;False;Property;_ScreenColorTintBlend;Screen Color Tint Blend;23;0;Create;True;0;0;0;False;0;False;0;0.5647059;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;218;-2017.575,276.691;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;176;-2305.229,-479.6079;Inherit;False;175;SkullWave;1;0;OBJECT;;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;53;-2256.354,-387.5309;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;98;-2244.691,-156.0409;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;227;-1689.071,-2103.113;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;264;-2031.002,493.4278;Inherit;False;263;HandMaskNoiseEmission;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;39;-1022.468,2022.998;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SamplerNode;96;-2015.594,-230.9689;Inherit;True;Property;_NormalsLeftHand;Normals Left Hand;13;0;Create;True;0;0;0;False;0;False;-1;38c34d9a83dd163439364888ad5eda23;38c34d9a83dd163439364888ad5eda23;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;86;38.78738,1930.225;Inherit;True;84;MaskB;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LerpOp;72;27.25992,1680.393;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;83;-982.0464,2683.718;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;304;-1218.403,-1737.935;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;20;-1760.275,-1096.382;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;238;-1867.982,307.9666;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;293;-737.998,413.5149;Inherit;False;620.886;437.3818;Could be improved, use your own! Get the masks already available.;3;262;261;202;Base Smoothness;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.CommentaryNode;303;-792.7374,-2101.889;Inherit;False;540.4291;332.2577;Blend it all;2;213;284;;1,1,1,1;0;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;283;-1528.719,-2018.949;Inherit;False;ScreenToggleSlider;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;50;-2014.889,-455.0049;Inherit;True;Property;_NormalTopSkull;Normal Top Skull;9;0;Create;True;0;0;0;False;0;False;-1;None;c3039ffc5e0516b44b5b7b599a16367d;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.SamplerNode;2;-2040.353,-896.5031;Inherit;True;Property;_Normal;Normal;12;0;Create;True;0;0;0;False;0;False;-1;None;70c247db5b217844dab975e0fe9786a8;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.OneMinusNode;266;-1742.002,460.4278;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode;253;-1728.019,-1899.992;Inherit;False;Property;_TVHandsTint;TV Hands Tint;19;0;Create;True;0;0;0;False;0;False;0,0,0,0;0.745283,0.745283,0.745283,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.LerpOp;94;-1338.384,-3138.265;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SamplerNode;21;-2031.967,-680.7849;Inherit;True;Property;_NormalHands;Normal Hands;6;0;Create;True;0;0;0;False;0;False;-1;1d75b14f4f330394b905e928ac14c061;1d75b14f4f330394b905e928ac14c061;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.LerpOp;85;283.7429,1674.287;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;261;-665.5458,734.897;Inherit;False;Property;_BaseSmoothness;Base Smoothness;15;0;Create;True;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LayeredBlendNode;18;-1356.766,-693.5529;Inherit;True;6;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;284;-742.7374,-1885.632;Inherit;False;283;ScreenToggleSlider;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;265;-1470.274,358.0676;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.LerpOp;252;-1118.935,-1882.047;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.WireNode;286;-689.8911,-2694.679;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;271;-1704.88,583.0054;Inherit;False;242;ScreenToggle;1;0;OBJECT;;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;202;-687.998,528.3009;Inherit;True;Property;_TV_MetallicSmoothness;TV_MetallicSmoothness;14;0;Create;True;0;0;0;False;0;False;-1;5d7beef2bf536ce4787fd5b796ced093;5d7beef2bf536ce4787fd5b796ced093;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;307;311.9513,1943.607;Inherit;False;Property;_DisplacementMultiplier;Displacement Multiplier;24;0;Create;True;0;0;0;False;0;False;1;0.1;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.NormalizeNode;19;-1041.806,-695.7999;Inherit;True;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;306;514.0184,1762.282;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.LerpOp;213;-434.3083,-2051.889;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;270;-1202.153,395.645;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;262;-279.1122,463.5149;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.WireNode;291;328.1295,-990.9935;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.WireNode;294;858.2775,-673.355;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.WireNode;292;616.3345,-816.6332;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.WireNode;289;495.8597,-1295.232;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.WireNode;290;498.6301,-1603.874;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;281;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentDepthPostpass;0;9;TransparentDepthPostpass;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;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-23;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=TransparentDepthPostpass;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;278;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;Distortion;0;6;Distortion;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;False;False;False;False;False;False;False;False;False;False;True;True;0;True;-9;255;False;-1;255;True;-9;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;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;277;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;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;-23;False;False;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=MotionVectors;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;275;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;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;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;274;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;ShadowCaster;0;2;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;-23;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;279;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentBackface;0;7;TransparentBackface;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;1;0;True;-18;0;True;-19;1;0;True;-20;0;True;-21;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;False;True;True;True;True;True;0;True;-35;False;False;False;False;False;False;False;True;0;True;-22;True;0;True;-28;False;True;1;LightMode=TransparentBackface;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;282;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;Forward;0;10;Forward;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;1;0;True;-18;0;True;-19;1;0;True;-20;0;True;-21;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-25;False;False;False;True;True;True;True;True;0;True;-35;False;False;False;False;False;True;True;0;True;-3;255;False;-1;255;True;-4;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;-22;True;0;True;-27;False;True;1;LightMode=Forward;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;276;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;DepthOnly;0;4;DepthOnly;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;-23;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;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;272;1632.362,-1538.453;Float;False;True;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;ASESampleShaders/TV/Vector Displacement Mapping;53b46d85872c5b24c8f4f0a1c3fe4c87;True;GBuffer;0;0;GBuffer;35;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;-23;False;False;False;False;False;False;False;False;False;True;True;0;True;-12;255;False;-1;255;True;-11;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;False;True;0;True;-13;False;True;1;LightMode=GBuffer;False;False;0;;0;0;Standard;42;Surface Type;0; Rendering Pass;1; Refraction Model;0; Blending Mode;0; Blend Preserves Specular;1; Receive Fog;1; Back Then Front Rendering;0; Transparent Depth Prepass;0; Transparent Depth Postpass;0; Transparent Writes Motion Vector;0; Distortion;0; Distortion Mode;0; Distortion Depth Test;1; ZWrite;0; Z Test;4;Double-Sided;0;Alpha Clipping;0; Use Shadow Threshold;0;Material Type,InvertActionOnDeselection;0; Energy Conserving Specular;1; Transmission;1;Receive Decals;1;Receives SSR;1;Receive SSR Transparent;0;Motion Vectors;1; Add Precomputed Velocity;0;Specular AA;0;Specular Occlusion Mode;1;Override Baked GI;0;Depth Offset;0;DOTS Instancing;0;LOD CrossFade;0;Tessellation;1; Phong;0; Strength;0.5,False,-1; Type;0; Tess;7,False,-1; Min;10,False,-1; Max;25,False,-1; Edge Length;16,False,-1; Max Displacement;25,False,-1;Vertex Position;1;0;11;True;True;True;True;True;True;False;False;False;False;True;False;;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;273;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;META;0;1;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;;0;0;Standard;0;False;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;280;1341.016,209.2481;Float;False;False;-1;2;Rendering.HighDefinition.LitShaderGraphGUI;0;2;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentDepthPrepass;0;8;TransparentDepthPrepass;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;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;-23;False;False;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;3;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;False;False;True;1;LightMode=TransparentDepthPrepass;False;False;0;;0;0;Standard;0;False;0
|
|
WireConnection;13;0;10;0
|
|
WireConnection;11;0;13;0
|
|
WireConnection;11;1;12;2
|
|
WireConnection;116;0;11;0
|
|
WireConnection;169;0;173;0
|
|
WireConnection;169;1;168;0
|
|
WireConnection;170;0;168;0
|
|
WireConnection;170;1;174;0
|
|
WireConnection;112;0;111;0
|
|
WireConnection;112;1;116;0
|
|
WireConnection;107;0;11;0
|
|
WireConnection;107;1;108;0
|
|
WireConnection;171;0;169;0
|
|
WireConnection;171;1;170;0
|
|
WireConnection;110;0;112;0
|
|
WireConnection;110;1;107;0
|
|
WireConnection;172;1;171;0
|
|
WireConnection;29;0;8;0
|
|
WireConnection;175;0;172;0
|
|
WireConnection;99;1;110;0
|
|
WireConnection;244;0;6;2
|
|
WireConnection;35;1;175;0
|
|
WireConnection;63;0;45;2
|
|
WireConnection;15;0;45;1
|
|
WireConnection;103;0;99;0
|
|
WireConnection;51;0;40;0
|
|
WireConnection;260;0;254;0
|
|
WireConnection;205;0;206;0
|
|
WireConnection;205;1;208;0
|
|
WireConnection;205;2;208;0
|
|
WireConnection;205;3;212;0
|
|
WireConnection;205;5;211;0
|
|
WireConnection;75;0;74;0
|
|
WireConnection;5;0;6;1
|
|
WireConnection;5;1;6;3
|
|
WireConnection;5;2;6;2
|
|
WireConnection;84;0;45;3
|
|
WireConnection;255;0;246;0
|
|
WireConnection;255;1;260;0
|
|
WireConnection;203;1;205;0
|
|
WireConnection;66;0;35;2
|
|
WireConnection;77;1;103;0
|
|
WireConnection;78;0;77;1
|
|
WireConnection;78;1;77;3
|
|
WireConnection;78;2;77;2
|
|
WireConnection;36;0;35;1
|
|
WireConnection;36;1;35;3
|
|
WireConnection;36;2;35;2
|
|
WireConnection;48;0;17;0
|
|
WireConnection;181;0;5;0
|
|
WireConnection;181;1;182;0
|
|
WireConnection;80;0;77;2
|
|
WireConnection;209;0;203;0
|
|
WireConnection;209;1;210;0
|
|
WireConnection;67;0;58;0
|
|
WireConnection;54;0;41;0
|
|
WireConnection;256;0;255;0
|
|
WireConnection;214;0;209;0
|
|
WireConnection;118;0;78;0
|
|
WireConnection;118;1;117;0
|
|
WireConnection;79;0;76;0
|
|
WireConnection;16;0;181;0
|
|
WireConnection;16;1;48;0
|
|
WireConnection;37;0;36;0
|
|
WireConnection;37;1;54;0
|
|
WireConnection;259;0;256;0
|
|
WireConnection;60;0;67;0
|
|
WireConnection;60;1;65;0
|
|
WireConnection;89;0;88;0
|
|
WireConnection;81;0;118;0
|
|
WireConnection;81;1;79;0
|
|
WireConnection;59;0;60;0
|
|
WireConnection;38;0;37;0
|
|
WireConnection;91;0;89;0
|
|
WireConnection;91;1;90;0
|
|
WireConnection;4;0;16;0
|
|
WireConnection;242;0;241;0
|
|
WireConnection;235;0;234;0
|
|
WireConnection;263;0;259;0
|
|
WireConnection;32;0;30;0
|
|
WireConnection;82;0;81;0
|
|
WireConnection;7;0;4;0
|
|
WireConnection;7;1;8;0
|
|
WireConnection;93;0;91;0
|
|
WireConnection;237;0;235;0
|
|
WireConnection;237;1;236;4
|
|
WireConnection;56;0;1;0
|
|
WireConnection;56;1;57;0
|
|
WireConnection;56;2;59;0
|
|
WireConnection;218;0;217;0
|
|
WireConnection;218;1;219;0
|
|
WireConnection;218;2;221;0
|
|
WireConnection;53;0;52;0
|
|
WireConnection;98;0;97;0
|
|
WireConnection;227;0;210;0
|
|
WireConnection;227;1;242;0
|
|
WireConnection;39;0;38;0
|
|
WireConnection;39;1;40;0
|
|
WireConnection;96;1;114;0
|
|
WireConnection;96;5;98;0
|
|
WireConnection;72;0;7;0
|
|
WireConnection;72;1;39;0
|
|
WireConnection;72;2;64;0
|
|
WireConnection;83;0;82;0
|
|
WireConnection;83;1;74;0
|
|
WireConnection;304;0;259;0
|
|
WireConnection;304;1;305;0
|
|
WireConnection;20;0;15;0
|
|
WireConnection;20;1;63;0
|
|
WireConnection;20;2;84;0
|
|
WireConnection;238;0;218;0
|
|
WireConnection;238;1;237;0
|
|
WireConnection;283;0;227;0
|
|
WireConnection;50;1;176;0
|
|
WireConnection;50;5;53;0
|
|
WireConnection;266;0;264;0
|
|
WireConnection;94;0;56;0
|
|
WireConnection;94;1;92;0
|
|
WireConnection;94;2;93;0
|
|
WireConnection;21;5;32;0
|
|
WireConnection;85;0;72;0
|
|
WireConnection;85;1;83;0
|
|
WireConnection;85;2;86;0
|
|
WireConnection;18;0;20;0
|
|
WireConnection;18;1;2;0
|
|
WireConnection;18;2;21;0
|
|
WireConnection;18;3;50;0
|
|
WireConnection;18;4;96;0
|
|
WireConnection;265;0;238;0
|
|
WireConnection;265;1;266;0
|
|
WireConnection;252;0;209;0
|
|
WireConnection;252;1;253;0
|
|
WireConnection;252;2;304;0
|
|
WireConnection;286;0;94;0
|
|
WireConnection;19;0;18;0
|
|
WireConnection;306;0;85;0
|
|
WireConnection;306;1;307;0
|
|
WireConnection;213;0;286;0
|
|
WireConnection;213;1;252;0
|
|
WireConnection;213;2;284;0
|
|
WireConnection;270;0;265;0
|
|
WireConnection;270;1;271;0
|
|
WireConnection;262;0;202;4
|
|
WireConnection;262;1;261;0
|
|
WireConnection;291;0;270;0
|
|
WireConnection;294;0;306;0
|
|
WireConnection;292;0;262;0
|
|
WireConnection;289;0;19;0
|
|
WireConnection;290;0;213;0
|
|
WireConnection;272;0;290;0
|
|
WireConnection;272;1;289;0
|
|
WireConnection;272;6;291;0
|
|
WireConnection;272;7;292;0
|
|
WireConnection;272;11;294;0
|
|
ASEEND*/
|
|
//CHKSM=EA7400778FA2F7904C92023B6D255CE27C99B712 |