Files
UltimateFishing2020/Assets/Shader/Lux Water_WaterSurface.shader
2026-03-04 10:03:45 +08:00

154 lines
8.5 KiB
GLSL

Shader "Lux Water/WaterSurface" {
Properties {
[Enum(Off,0,On,1)] _ZWrite ("ZWrite", Float) = 1
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
[Enum(UnityEngine.Rendering.CullMode)] _Culling ("Culling", Float) = 0
[Space(5)] [Toggle(ORTHO_SUPPORT)] _OrthoSpport ("Enable Orthographic Support", Float) = 0
[Space(5)] [Toggle(EFFECT_BUMP)] _UVSpaceMappingEnabled ("UV Space Texture Mapping", Float) = 0
[Enum(Along U, 0, Along V, 1)] _UVDirection (" UV Direction", Float) = 0
[Space(5)] [Toggle(USINGWATERVOLUME)] _UsesWaterVolume ("Uses Water Volume", Float) = 0
_WaterSurfaceYPos (" Water Surface Position (Y)", Float) = 0
[Space(5)] _MaxDirLightDepth ("Directional Lighting Fade Range", Float) = 64
_MaxFogLightDepth ("Fog Lighting Fade Range", Float) = 64
[Header(Basic Properties)] [Space(8)] _Glossiness (" Smoothness", Range(0, 1)) = 0.92
_SpecColor (" Specular", Vector) = (0.15,0.15,0.15,1)
[Space(5)] _InvFade (" Edge Blend Factor", Range(0.001, 6)) = 1
[Space(5)] _DetailDistance (" Detail Distance", Float) = 600
_DetailFadeRange (" Detail Fade Range", Float) = 200
[Header(Reflections)] [Space(8)] [Toggle(GEOM_TYPE_MESH)] _PlanarEnabled (" Enable Planar Reflections", Float) = 0
[HideInInspector] _LuxWater_ReflectionTex ("ReflectionTex", 2D) = "gray" {}
[Space(5)] _FresnelPower (" Fresnel Power", Range(1, 5)) = 5
_ReflectionStrength (" Strength", Range(0, 1)) = 1
_ReflectionGlossiness (" Smoothness", Range(0, 1)) = 1
_ReflectionBumpScale (" Bump Scale", Range(0, 1)) = 0.3
[Space(5)] _WaterIOR (" Underwater IOR", Range(1.1, 1.4)) = 1.3333
[HDR] _UnderWaterReflCol (" Underwater Reflection Tint", Vector) = (1,1,1,0)
[Header(Underwater Fog)] [Space(8)] _Color (" Fog Color", Vector) = (1,1,1,1)
[LuxWaterVectorThreeDrawerNoSpace] _DepthAtten (" - Depth", Vector) = (0,32,1,0)
[LuxWaterHelpDrawer] _Help ("Fade Start (X) Fade Range (Y) Density (Z)", Float) = 0
_Density (" - View Depth", Range(0, 4)) = 0.1
_FogAbsorptionCancellation (" Absorption Cancellation", Range(0, 1)) = 1
[Header(Light Absorption)] [Space(8)] _AbsorptionStrength (" Strength", Range(0, 1)) = 1
_AbsorptionHeight (" - Depth", Range(0, 8)) = 1
_AbsorptionMaxHeight (" - Max Depth", Float) = 60
_AbsorptionDepth (" - View Depth", Range(0, 0.4)) = 0.07
_AbsorptionColorStrength (" Color Absorption", Range(0, 1)) = 0.5
[Header(Subsurface Scattering)] [Space(8)] _TranslucencyColor (" Color", Vector) = (0.1,0.2,0.3,0)
_ScatteringPower (" Power", Range(0.1, 16)) = 8
_ScatteringNormalInfluence (" Distortion", Range(0.01, 0.5)) = 0.1
_ScatterOcclusion (" Occlusion", Range(0.001, 1)) = 0.03
[Space(4)] _TranslucencyIntensity (" Intensity (Water)", Float) = 4
_FoamTranslucencyIntensity (" Intensity (Foam)", Float) = 4
[Header(Underwater Scattering)] [Space(8)] _UnderwaterScatteringIntensity (" Intensity", Range(0, 8)) = 2
[Header(Normals)] [Space(8)] [NoScaleOffset] _BumpMap (" Normal Map", 2D) = "bump" {}
[Header( Far Normal)] [Space(8)] [LuxWaterVectorFourDrawer] _FarBumpSampleParams (" Far Normal", Vector) = (0.25,100,1,1)
[LuxWaterHelpDrawer] _Help ("Tiling (X) Distance (Y) Scale (Z, 0-1) Speed (W)", Float) = 0
[Header( Detail Normals)] [Space(8)] [LuxWaterVectorThreeDrawer] _BumpScale (" Scale", Vector) = (1,0.5,0.25,0)
[LuxWaterVectorFourGFDrawer] _BumpTiling (" Tiling", Vector) = (1,0.5,0.478,0.1)
[LuxWaterVectorFourGFDrawer] _BumpSpeed (" Speed", Vector) = (1.7,1,0,1)
[LuxWaterVectorFourGFDrawer] _BumpRotation (" Rotation", Vector) = (0,8,32,0)
[HideInInspector] _FinalBumpSpeed01 (" Final BumpSpeed01", Vector) = (0,0,0,0)
[HideInInspector] _FinalBumpSpeed23 (" Final BumpSpeed23", Vector) = (0,0,0,0)
[Space(5)] _Refraction (" Refraction", Range(0, 1024)) = 512
[Header(Foam)] [Space(8)] [Toggle(GEOM_TYPE_BRANCH_DETAIL)] _FoamEnabled (" Enable Foam", Float) = 1
[ShowIf(GEOM_TYPE_BRANCH_DETAIL)] [NoScaleOffset] _MainTex (" Normal (RGB) Mask (A)", 2D) = "white" {}
_FoamTiling (" Tiling", Float) = 0.1
[Space(5)] _FoamColor (" Color (RGB) Opacity (A)", Vector) = (0.7,0.7,0.7,0.8)
_FoamSmoothness (" Smoothness", Range(0, 1)) = 0.1
_FoamScale (" Scale", Range(0, 40)) = 20
_FoamSpeed (" Speed", Float) = 0.9
_FoamParallax (" Parallax", Range(0, 0.1)) = 0.03
_FoamNormalScale (" Normal Scale", Float) = 1
_FoamSoftIntersectionFactor (" Edge Blend Factor", Range(0, 3)) = 1
_FoamNormalMaskScale (" Mask by Normal", Range(0, 20)) = 5
[Space(5)] _SlopeAwareFoam (" Slope aware Foam", Range(0, 20)) = 0
_SlopeToMask (" Suppress Mask by Normal", Range(0, 10)) = 1
_FoamFinalErosion (" Final Foam Erosion", Range(0, 1)) = 0.375
[Header(Gerstner Foam)] [Space(8)] _FoamCaps (" Foam Caps", Range(0, 4)) = 0.5
_GerstnerElevationFactor (" Mask by Elevation", Range(0, 1)) = 1
[Space(5)] _DeepFoamCoverage (" Deep Foam Caps", Range(0.01, 3)) = 1
_DeepFoamColor (" Deep Foam Color (RGB) Opacity (A)", Vector) = (0.7,0.7,0.7,0.5)
_UnderwaterFoamParallax (" Deep Foam Parallax", Range(0, 0.1)) = 0.06
_DeepFoamTiling (" Deep Foam Tiling", Float) = 0.637
_DeepFoamBlur (" Deep Foam Blur", Range(0, 8)) = 0
[Header(Caustics)] [Space(8)] [Toggle(GEOM_TYPE_FROND)] _CausticsEnabled (" Enable Caustics", Float) = 1
[Toggle(GEOM_TYPE_LEAF)] _CausticMode (" Normals from GBuffer", Float) = 1
[NoScaleOffset] _CausticTex (" Caustics (R) Noise (GB)", 2D) = "black" {}
_CausticsTiling (" Tiling", Float) = 0.1
[Space(5)] _CausticsScale (" Scale", Range(0, 8)) = 2
_CausticsSpeed (" Speed", Float) = 0.9
_CausticsSelfDistortion (" Distortion", Float) = 0.2
[Header(Advanced Options)] [Space(8)] [KeywordEnum(None, Point, MSAA_4x)] _PixelSnap (" Pixel Snapping", Float) = 0
[Header(Gerstner Waves)] [Space(8)] [Toggle(_GERSTNERDISPLACEMENT)] _GerstnerEnabled (" Enable Gerstner Waves", Float) = 0
[Space(5)] [LuxWaterVectorFourDrawer] _GAmplitude (" Amplitude", Vector) = (0.3,0.35,0.25,0.25)
[Space(24)] [LuxWaterVectorFourDrawer] _GFrequency (" Frequency", Vector) = (1.3,1.35,1.25,1.25)
[LuxWaterGFDrawer] _GGlobalFrequency (" Global Factor", Float) = 1
[HideInInspector] _GFinalFrequency (" Final Frequency", Vector) = (1.3,1.35,1.25,1.25)
[LuxWaterVectorFourDrawer] _GSteepness (" Steepness", Vector) = (1,1,1,1)
[Space(24)] [LuxWaterVectorFourDrawer] _GSpeed (" Speed", Vector) = (1.2,1.375,1.1,1.5)
[LuxWaterGFDrawer] _GGlobalSpeed (" Global Factor", Float) = 1
[HideInInspector] _GFinalSpeed (" Final Speed", Vector) = (1.2,1.375,1.1,1.5)
[LuxWaterVectorFourDrawer] _GRotation (" Rotation", Vector) = (0,8,32,0)
[LuxWaterGFDrawer] _GGlobalRotation (" Global Factor", Float) = 0
[HideInInspector] _GDirectionAB (" Direction AB", Vector) = (0.3,0.85,0.85,0.25)
[HideInInspector] _GDirectionCD (" Direction CD", Vector) = (0.1,0.9,0.5,0.5)
[Space(5)] [LuxWaterVectorThreeDrawer] _GerstnerVertexIntensity (" Final Displacement", Vector) = (1,1,1,0)
[Space(10)] _GerstnerNormalIntensity (" Normal Scale", Range(0, 8)) = 0.05
[Header(Secondary Gerstner Waves)] [Space(8)] [LuxWaterVectorFourDrawer] _GerstnerSecondaryWaves (" Factors", Vector) = (0,4.3,0.3,1.65)
[LuxWaterHelpDrawer] _Help ("Amplitude (X) Frequency (Y) Steepness (Z) Speed (W)", Float) = 0
[Space(8)] _LuxWater_Extrusion ("Extrusion from Normal Projectors", Float) = 0
}
//DummyShaderTextExporter
SubShader{
Tags { "RenderType"="Opaque" }
LOD 200
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
float4x4 unity_ObjectToWorld;
float4x4 unity_MatrixVP;
float4 _MainTex_ST;
struct Vertex_Stage_Input
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
struct Vertex_Stage_Output
{
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
};
Vertex_Stage_Output vert(Vertex_Stage_Input input)
{
Vertex_Stage_Output output;
output.uv = (input.uv.xy * _MainTex_ST.xy) + _MainTex_ST.zw;
output.pos = mul(unity_MatrixVP, mul(unity_ObjectToWorld, input.pos));
return output;
}
Texture2D<float4> _MainTex;
SamplerState sampler_MainTex;
float4 _Color;
struct Fragment_Stage_Input
{
float2 uv : TEXCOORD0;
};
float4 frag(Fragment_Stage_Input input) : SV_TARGET
{
return _MainTex.Sample(sampler_MainTex, input.uv.xy) * _Color;
}
ENDHLSL
}
}
//CustomEditor "LuxWaterMaterialEditor"
}