471 lines
18 KiB
Plaintext
471 lines
18 KiB
Plaintext
//Stylized Water 2
|
|
//Staggart Creations (http://staggart.xyz)
|
|
//Copyright protected under Unity Asset Store EULA
|
|
|
|
%asset_version%
|
|
%unity_version%
|
|
%compiler_version%
|
|
%fog_integration%
|
|
|
|
%shader_name%
|
|
{
|
|
Properties
|
|
{
|
|
//Rendering
|
|
[Toggle] _ZWrite("Depth writing", Float) = 0
|
|
[Toggle] _ZClip("Camera frustum clipping", Float) = 1
|
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull faces", Float) = 2
|
|
[MaterialEnum(Simple, 0,Advanced, 1)] _ShadingMode("Shading mode", Float) = 1
|
|
|
|
[MaterialEnum(Mesh UV,0,World XZ projected ,1)]_WorldSpaceUV("UV Coordinates", Float) = 1
|
|
_Direction("Animation direction", Vector) = (0,-1,0,0)
|
|
_Speed("Animation Speed", Float) = 1
|
|
|
|
_SlopeAngleThreshold("Angle° threshold", Range(0 , 90)) = 15
|
|
_SlopeAngleFalloff("Angle° falloff", Range(15 , 90)) = 25
|
|
_SlopeStretching("Slope UV stretch", Range(0 , 1)) = 0.5
|
|
_SlopeSpeed("Slope speed multiplier", Float) = 2
|
|
_SlopeFoam("River slope foam", Range(0 , 3)) = 1
|
|
|
|
//Color + Transparency
|
|
[HDR]_BaseColor("Deep", Color) = (0, 0.44, 0.62, 1)
|
|
[HDR]_ShallowColor("Shallow", Color) = (0.1, 0.9, 0.89, 0.02)
|
|
[PowerSlider(3)] _ColorAbsorption("Color Absorption", Range(0 , 1)) = 0
|
|
_WaveTint("Wave tint", Range( -0.1 , 0.1)) = 0
|
|
[HDR]_HorizonColor("Horizon", Color) = (0.84, 1, 1, 0.15)
|
|
_HorizonDistance("Horizon Distance", Range(0.01 , 32)) = 8
|
|
[Toggle] _VertexColorDepth("Vertex color (G) depth", Float) = 0
|
|
_DepthVertical("View Depth", Range(0.01 , 16)) = 4
|
|
_DepthHorizontal("Vertical Height Depth", Range(0.01 , 8)) = 1
|
|
[Toggle] _DepthExp("Exponential Blend", Float) = 1
|
|
_EdgeFade("Edge Fade", Float) = 0.1
|
|
_ShadowStrength("Shadow Strength", Range(0 , 1)) = 1
|
|
|
|
//_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.9
|
|
//_Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
|
|
|
_TranslucencyStrength("Translucency Strength", Range(0 , 3)) = 1
|
|
_TranslucencyStrengthDirect("Translucency Strength (Direct)", Range(0 , 0.5)) = 0.05
|
|
_TranslucencyExp("Translucency Exponent", Range(1 , 32)) = 4
|
|
_TranslucencyCurvatureMask("Translucency Curvature mask", Range(0, 1)) = 0.75
|
|
_TranslucencyReflectionMask("Translucency Reflection mask", Range(0, 1)) = 1
|
|
|
|
//Underwater
|
|
_CausticsBrightness("Brightness", Float) = 2
|
|
_CausticsChromance("Chromance", Range(0, 1)) = 1
|
|
_CausticsTiling("Tiling", Float) = 0.5
|
|
_CausticsSpeed("Speed multiplier", Float) = 0.1
|
|
_CausticsDistortion("Distortion", Range(0, 1)) = 0.15
|
|
[NoScaleOffset][SingleLineTexture]_CausticsTex("Texture", 2D) = "black" {}
|
|
|
|
_UnderwaterSurfaceSmoothness("Underwater Surface Smoothness", Range(0, 1)) = 0.8
|
|
_UnderwaterRefractionOffset("Underwater Refraction Offset", Range(0, 1)) = 0.2
|
|
|
|
_RefractionStrength("Refraction Strength", Range(0, 1)) = 0.1
|
|
_RefractionChromaticAberration("Refraction Chromatic Aberration)", Range(0, 1)) = 1
|
|
|
|
//Intersection Foam
|
|
[MaterialEnum(Depth Texture,0,Vertex Color (R),1,Depth Texture and Vertex Color,2)] _IntersectionSource("Intersection source", Float) = 0
|
|
[MaterialEnum(None,0,Sharp,1,Smooth,2)] _IntersectionStyle("Intersection style", Float) = 1
|
|
|
|
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
|
|
_IntersectionColor("Color", Color) = (1,1,1,1)
|
|
_IntersectionLength("Distance", Range(0.01 , 5)) = 2
|
|
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
|
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
|
_IntersectionTiling("Noise Tiling", float) = 0.2
|
|
_IntersectionDistortion("Distortion", Range(0 , 1)) = 0.2
|
|
_IntersectionSpeed("Speed multiplier", float) = 0.1
|
|
_IntersectionRippleDist("Ripple distance", float) = 32
|
|
_IntersectionRippleStrength("Ripple Strength", Range(0 , 1)) = 0.5
|
|
|
|
//Surface Foam
|
|
[NoScaleOffset][SingleLineTexture]_FoamTex("Foam Mask", 2D) = "black" {}
|
|
_FoamColor("Color", Color) = (1,1,1,1)
|
|
_FoamSpeed("Speed multiplier", float) = 0.1
|
|
_FoamSubSpeed("Speed multiplier (sub-layer)", float) = -0.25
|
|
_FoamBaseAmount("Base amount", Range(0 , 1)) = 0
|
|
_FoamClipping("Clipping", Range(0 , 0.999)) = 0
|
|
_FoamWaveAmount("Wave crest amount", Range(0 , 2)) = 0
|
|
_FoamTiling("Tiling", Vector) = (0.1, 0.1, 0, 0)
|
|
_FoamSubTiling("Tiling (sub-layer)", float) = 0.5
|
|
_FoamDistortion("Distortion", Range(0, 3)) = 0
|
|
[Toggle] _VertexColorFoam("Vertex color (A) foam", Float) = 0
|
|
|
|
[NoScaleOffset][SingleLineTexture] _FoamTexDynamic("Foam (Dynamic)", 2D) = "black" {}
|
|
_FoamTilingDynamic("Tiling (Dynamic)", float) = 0.1
|
|
_FoamSubTilingDynamic("Tiling (sub-layer)", float) = 2
|
|
_FoamSpeedDynamic("Speed multiplier", float) = 0.1
|
|
_FoamSubSpeedDynamic("Speed multiplier (sub-layer)", float) = -0.1
|
|
|
|
//Normals
|
|
[NoScaleOffset][Normal][SingleLineTexture]_BumpMap("Normals", 2D) = "bump" {}
|
|
[NoScaleOffset][Normal][SingleLineTexture]_BumpMapSlope("Normals (River slopes)", 2D) = "bump" {}
|
|
_NormalTiling("Tiling", Vector) = (0.5, 0.5, 0, 0)
|
|
_NormalSubTiling("Tiling (sub-layer)", Float) = 0.5
|
|
_NormalStrength("Strength", Range(0 , 1)) = 0.135
|
|
_NormalSpeed("Speed multiplier", Float) = 1
|
|
_NormalSubSpeed("Speed multiplier (sub-layer)", Float) = -0.5
|
|
|
|
[NoScaleOffset][Normal][SingleLineTexture]_BumpMapLarge("Normals (Distance)", 2D) = "bump" {}
|
|
_DistanceNormalsFadeDist("Distance normals blend (Start/End)", Vector) = (100, 300, 0, 0)
|
|
_DistanceNormalsTiling("Distance normals: Tiling multiplier", Float) = 0.15
|
|
|
|
_SparkleIntensity("Sparkle Intensity", Range(0 , 10)) = 00
|
|
_SparkleSize("Sparkle Size", Range( 0 , 1)) = 0.280
|
|
|
|
//Light Reflections
|
|
[PowerSlider(0.1)] _SunReflectionSize("Sun Size", Range(0 , 1)) = 0.5
|
|
_SunReflectionStrength("Sun Strength", Float) = 10
|
|
_SunReflectionDistortion("Sun Distortion", Range(0 ,2)) = 0.49
|
|
_PointSpotLightReflectionStrength("Point/spot light strength", Float) = 10
|
|
[PowerSlider(0.1)] _PointSpotLightReflectionSize("Point/spot light size", Range(0 , 1)) = 0
|
|
_PointSpotLightReflectionDistortion("Point/spot light distortion", Range(0, 1)) = 0.5
|
|
|
|
//World Reflections
|
|
_ReflectionStrength("Strength", Range(0, 1)) = 1
|
|
_ReflectionDistortion("Distortion", Range(0, 1)) = 0.05
|
|
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
|
|
_ReflectionFresnel("Curvature mask", Range(0.01, 20)) = 5
|
|
_ReflectionLighting("Lighting influence", Range(0, 1)) = 0
|
|
_PlanarReflection("Planar Reflections", 2D) = "" {} //Instanced
|
|
_PlanarReflectionsEnabled("Planar Enabled", float) = 0 //Instanced
|
|
|
|
//Waves
|
|
_WaveSpeed("Speed", Float) = 2
|
|
_WaveHeight("Height", Range(0 , 10)) = 0.25
|
|
[Toggle] _VertexColorWaveFlattening("Vertex color (B) wave flattening", Float) = 0
|
|
|
|
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.5
|
|
_WaveDistance("Distance", Range(0 , 1)) = 0.8
|
|
_WaveFadeDistance("Wave fade distance (Start/End)", Vector) = (150, 300, 0, 0)
|
|
|
|
_WaveSteepness("Steepness", Range(0 , 5)) = 0.1
|
|
_WaveCount("Count", Range(1 , 5)) = 1
|
|
_WaveDirection("Direction", vector) = (1,1,1,1)
|
|
|
|
//Keyword states
|
|
[ToggleOff(_UNLIT)] _LightingOn("Enable lighting", Float) = 1
|
|
[ToggleOff(_RECEIVE_SHADOWS_OFF)] _ReceiveShadows("Recieve Shadows", Float) = 1
|
|
|
|
[Toggle(_FLAT_SHADING)] _FlatShadingOn("Flat shading", Float) = 0
|
|
[Toggle(_TRANSLUCENCY)] _TranslucencyOn("Enable translucency shading", Float) = 1
|
|
[Toggle(_REFRACTION)] _RefractionOn("_REFRACTION", Float) = 1
|
|
[Toggle(_RIVER)] _RiverModeOn("River Mode", Float) = 0
|
|
[Toggle(_CAUSTICS)] _CausticsOn("Caustics ON", Float) = 1
|
|
[ToggleOff(_SPECULARHIGHLIGHTS_OFF)] _SpecularReflectionsOn("Specular Reflections", Float) = 1
|
|
[ToggleOff(_ENVIRONMENTREFLECTIONS_OFF)] _EnvironmentReflectionsOn("Environment Reflections", Float) = 1
|
|
[Toggle(_NORMALMAP)] _NormalMapOn("Normal maps", Float) = 1
|
|
[Toggle(_DISTANCE_NORMALS)] _DistanceNormalsOn("Distance normal map", Float) = 1
|
|
[Toggle(_FOAM)] _FoamOn("Foam", Float) = 1
|
|
[Toggle(_DISABLE_DEPTH_TEX)] _DisableDepthTexture("Disable depth texture", Float) = 0
|
|
[Toggle(_WAVES)] _WavesOn("_WAVES", Float) = 0
|
|
[Toggle] _ReceiveDynamicEffects("Receive Dynamic Effects", Float) = 1
|
|
|
|
%tessellation_properties%
|
|
|
|
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0,5|1|1", Vector) = (0, 0, 0, 0)
|
|
|
|
//Purely here so the _BaseColor gets multiplied with a white color during lightmapping
|
|
[MainTexture] [HideInInspector] _BaseMap("Albedo", 2D) = "white" {}
|
|
|
|
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"RenderType" = "Transparent"
|
|
"RenderPipeline" = "UniversalPipeline"
|
|
"UniversalMaterialType" = "Lit"
|
|
"IgnoreProjector" = "True"
|
|
"Queue" = "Transparent+%render_queue_offset%"
|
|
}
|
|
|
|
HLSLINCLUDE
|
|
//Custom directives:
|
|
%custom_directives%
|
|
|
|
//Curved World 2020 directives:
|
|
//#pragma shader_feature_local CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE CURVEDWORLD_BEND_TYPE_LITTLEPLANET_Y
|
|
//#define CURVEDWORLD_BEND_ID_1
|
|
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
|
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
|
|
|
//Triggers a "DX3D11 swapchain error" crash
|
|
//#pragma editor_sync_compilation
|
|
|
|
ENDHLSL
|
|
|
|
Pass
|
|
{
|
|
Name "ForwardLit"
|
|
Tags { "LightMode"="UniversalForward" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZWrite [_ZWrite]
|
|
Cull [_Cull]
|
|
ZTest LEqual
|
|
ZClip [_ZClip]
|
|
|
|
%stencil%
|
|
|
|
HLSLPROGRAM
|
|
%pragma_target%
|
|
%pragma_renderers%
|
|
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#if UNITY_VERSION >= 202220
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#endif
|
|
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
|
|
// Material Keywords
|
|
#pragma shader_feature_local _NORMALMAP
|
|
#pragma shader_feature_local _WAVES
|
|
#pragma shader_feature_local _FLAT_SHADING
|
|
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
|
#pragma shader_feature_local _RIVER
|
|
#pragma shader_feature_local_fragment _DISABLE_DEPTH_TEX
|
|
#pragma shader_feature_local_fragment _REFRACTION
|
|
#pragma shader_feature_local_fragment _ADVANCED_SHADING
|
|
#pragma shader_feature_local_fragment _UNLIT
|
|
#pragma shader_feature_local_fragment _CAUSTICS
|
|
#pragma shader_feature_local_fragment _DISTANCE_NORMALS
|
|
#pragma shader_feature_local_fragment _FOAM
|
|
#pragma shader_feature_local_fragment _TRANSLUCENCY
|
|
#pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
|
|
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
|
|
#pragma shader_feature_local_fragment _ _SHARP_INERSECTION _SMOOTH_INTERSECTION
|
|
|
|
//Multi-compile variants for installed extensions
|
|
%multi_compile underwater rendering%
|
|
%multi_compile dynamic effects%
|
|
|
|
#if _RIVER
|
|
#undef _WAVES
|
|
#undef UNDERWATER_ENABLED
|
|
#endif
|
|
|
|
//Required to differentiate between skybox and scene geometry
|
|
#if UNDERWATER_ENABLED
|
|
#undef _DISABLE_DEPTH_TEX
|
|
#endif
|
|
|
|
#include_library "Libraries/URP.hlsl"
|
|
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
|
|
|
//Tying specific features and operations to advanced shading
|
|
#if _ADVANCED_SHADING
|
|
#define RESAMPLE_REFRACTION_DEPTH 1
|
|
#define PHYSICAL_REFRACTION 1
|
|
//#define HQ_CAUSTICS 1
|
|
|
|
#if _REFRACTION //Requires opaque texture
|
|
#define COLOR_ABSORPTION 1
|
|
#endif
|
|
|
|
//Mask caustics by shadows cast on scene geometry. Doubles the shadow sampling cost
|
|
//Note: needs depth texture to reconstruct the world position from depth
|
|
#if _CAUSTICS && defined(MAIN_LIGHT_CALCULATE_SHADOWS) && !_DISABLE_DEPTH_TEX
|
|
#define SCENE_SHADOWMASK 1
|
|
#endif
|
|
|
|
#if !_DISABLE_DEPTH_TEX && _CAUSTICS || UNDERWATER_ENABLED
|
|
//Compose a mask for pixels against the skybox
|
|
#define DEPTH_MASK 1
|
|
#endif
|
|
#endif
|
|
|
|
//Universal Pipeline keywords
|
|
%multi_compile_shadows%
|
|
%multi_compile_light_cookies%
|
|
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS //URP 11+
|
|
|
|
//URP 12+ only (2021.2+)
|
|
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
|
|
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
|
|
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
|
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
|
#pragma multi_compile _ _CLUSTERED_RENDERING
|
|
|
|
//URP 14+ (2022.2+)
|
|
#pragma multi_compile _ _FORWARD_PLUS
|
|
|
|
#if UNITY_VERSION >= 202220
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
|
#endif
|
|
|
|
//URP 15+ (2023.1+)
|
|
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
|
|
|
|
//Unity defined keywords
|
|
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED //Surface normals are animated, so pointless
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#if UNITY_VERSION >= 202310
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
|
|
#endif
|
|
|
|
//Defines
|
|
#define SHADERPASS_FORWARD
|
|
|
|
%tessellation_directives%
|
|
|
|
#include_library "Libraries/Input.hlsl"
|
|
|
|
#include_library "Libraries/Common.hlsl"
|
|
|
|
//Fog rendering (integration)
|
|
%define_fog_integration%
|
|
%include_fog_integration_library%
|
|
#include_library "Libraries/Fog.hlsl"
|
|
|
|
#include_library "Libraries/Waves.hlsl"
|
|
#include_library "Libraries/Lighting.hlsl"
|
|
#include_library "Libraries/Reflections.hlsl"
|
|
|
|
#ifdef UNDERWATER_ENABLED
|
|
#include_library "Underwater/UnderwaterFog.hlsl"
|
|
#include_library "Underwater/UnderwaterShading.hlsl"
|
|
#endif
|
|
|
|
#include_library "Libraries/Features.hlsl"
|
|
#include_library "Libraries/Foam.hlsl"
|
|
#include_library "Libraries/Caustics.hlsl"
|
|
|
|
#ifdef DYNAMIC_EFFECTS_ENABLED
|
|
#include_library "DynamicEffects/DynamicEffects.hlsl"
|
|
#endif
|
|
|
|
#include_library "Libraries/Vertex.hlsl"
|
|
|
|
#if defined(TESSELLATION_ON)
|
|
#include_library "Libraries/Tesselation.hlsl"
|
|
#define VertexOutput VertexControl
|
|
#else
|
|
#define VertexOutput Varyings
|
|
#endif
|
|
|
|
#pragma vertex Vertex
|
|
VertexOutput Vertex(Attributes v)
|
|
{
|
|
#if defined(TESSELLATION_ON)
|
|
return VertexTessellation(v);
|
|
#else
|
|
return LitPassVertex(v);
|
|
#endif
|
|
}
|
|
|
|
#pragma fragment ForwardPassFragment
|
|
#include_library "Libraries/ForwardPass.hlsl"
|
|
|
|
//#include "UnityCG.cginc" //Test
|
|
#if defined(UNITY_SHADER_VARIABLES_INCLUDED) || defined(UNITY_CG_INCLUDED)
|
|
#error "Fatal error: a shader library from the Built-in Render Pipeline was compiled into the shader. This is most likely caused by the fog integration, make absolutely sure it is URP-compatible!"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
//Currently unused, except for custom render passes (such as depth texture injection)
|
|
Pass
|
|
{
|
|
Name "Depth or Displacement"
|
|
Tags { "LightMode" = "DepthOnly" }
|
|
|
|
ZWrite On
|
|
//ColorMask RG
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
%pragma_target%
|
|
%pragma_renderers%
|
|
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#if UNITY_VERSION >= 202220
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#endif
|
|
|
|
#include_library "Libraries/URP.hlsl"
|
|
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
|
|
|
#pragma shader_feature_local_fragment _WAVES
|
|
#pragma multi_compile _ WATER_DISPLACEMENT_PASS
|
|
|
|
#if !WATER_DISPLACEMENT_PASS
|
|
#define SHADERPASS_DEPTHONLY
|
|
#endif
|
|
|
|
#if WATER_DISPLACEMENT_PASS
|
|
#define SHADERPASS_DISPLACEMENT
|
|
#endif
|
|
|
|
#include_library "Libraries/Input.hlsl"
|
|
|
|
#include_library "Libraries/Common.hlsl"
|
|
#include_library "Libraries/Fog.hlsl"
|
|
#include_library "Libraries/Waves.hlsl"
|
|
|
|
%multi_compile dynamic effects%
|
|
#ifdef DYNAMIC_EFFECTS_ENABLED
|
|
#include_library "DynamicEffects/DynamicEffects.hlsl"
|
|
#endif
|
|
|
|
#include_library "Libraries/Vertex.hlsl"
|
|
|
|
#pragma vertex Vertex
|
|
Varyings Vertex(Attributes v)
|
|
{
|
|
return LitPassVertex(v);
|
|
}
|
|
|
|
#pragma fragment DepthOnlyFragment
|
|
float4 DepthOnlyFragment(Varyings input, FRONT_FACE_TYPE vFace : FRONT_FACE_SEMANTIC) : SV_TARGET
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID(input);
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
|
|
|
float depth = input.positionCS.z;
|
|
|
|
#if defined(SHADERPASS_DISPLACEMENT)
|
|
float3 offset = 0;
|
|
float3 positionWS = input.positionWS.xyz;
|
|
|
|
#if _WAVES
|
|
float2 uv = GetSourceUV(input.uv.xy, positionWS.xz, _WorldSpaceUV);
|
|
float4 vertexColor = input.color; //Mask already applied in vertex shader
|
|
WaveInfo waves = GetWaveInfo(uv, positionWS, TIME * _WaveSpeed, _WaveHeight, lerp(1, 0, vertexColor.b), _WaveFadeDistance.x, _WaveFadeDistance.y);
|
|
|
|
offset.y += waves.position.y;
|
|
#endif
|
|
|
|
#if DYNAMIC_EFFECTS_ENABLED
|
|
float4 dynamicEffectsData = SampleDynamicEffectsData(positionWS.xyz);
|
|
|
|
offset.y += dynamicEffectsData.r;
|
|
#endif
|
|
|
|
depth = positionWS.y + offset.y;
|
|
#endif
|
|
|
|
return float4(depth, vFace, 0, 0);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
|
|
CustomEditor "StylizedWater2.MaterialUI"
|
|
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
|
} |