136 lines
4.7 KiB
Plaintext
136 lines
4.7 KiB
Plaintext
Shader "zzwater/ocean_tess"
|
|
{
|
|
Properties
|
|
{
|
|
_Direction("Animation direction", Vector) = (0,-1,0,0)
|
|
_Speed("Animation Speed", Float) = 1
|
|
_AmbientStrength("Ambient strength", Range(0, 1)) = 0.5
|
|
|
|
//Tessellation
|
|
_TessValue("Max subdivisions", Range(1, 64)) = 16
|
|
_TessMin("Start Distance", Float) = 0
|
|
_TessMax("End Distance", Float) = 15
|
|
|
|
//Color + Transparency
|
|
[Toggle(_LIGHT_COLOR)] _LightColorOn("Main Light Color On", float) = 0
|
|
[HDR]_BaseColor("Deep", Color) = (0, 0.44, 0.62, 1)
|
|
[HDR]_ShallowColor("Shallow", Color) = (0.1, 0.9, 0.89, 0.02)
|
|
[HDR]_HorizonColor("Horizon", Color) = (0.84, 1, 1, 0.15)
|
|
_HorizonDistance("Horizon Distance", Range(0.01 , 32)) = 8
|
|
_DepthVertical("View Depth", Range(0.01 , 16)) = 4
|
|
_DepthHorizontal("Vertical Height Depth", Range(0.01 , 8)) = 1
|
|
_EdgeFade("Edge Fade", Float) = 0.1
|
|
_TranslucencyStrengthDirect("Translucency Strength (Direct)", Range(0 , 0.5)) = 0.05
|
|
|
|
|
|
//Reflection + Refraction
|
|
[Toggle(_REFRACTION)] _RefractionOn("Refraction On", float) = 0
|
|
_ReflectionStrength("Reflection Strength", Range(0, 2)) = 1
|
|
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
|
|
_ReflectionFresnel("Reflection Curvature mask", Range(0.01, 20)) = 5
|
|
_RefractionStrength("Refraction Strength", Range(0, 1)) = 0.1
|
|
|
|
//Intersection
|
|
[Toggle(_INTERSECTION)] _IntersectionOn("Intersection On", float) = 0
|
|
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
|
|
_IntersectionTiling("Noise Tiling", float) = 0.2
|
|
_IntersectionColor("Foam Color", Color) = (1,1,1,1)
|
|
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
|
|
_IntersectionClipping("Intersection Cutoff", Vector) = (0.5, 1, 0, 0)
|
|
_IntersectionFalloff("Intersection Falloff", Range(0.01 , 1)) = 0.5
|
|
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
|
|
|
|
// Wave foam
|
|
[Toggle(_WAVE_FOAM)] _WaveFoamOn("Wave Foam On", float) = 0
|
|
_WaveMesureMin("Wave Mesure Min", float) = 0
|
|
_WaveMesureMax("Wave Mesure Max", float) = 0.3
|
|
_WaveFoamClipping("Wave Cutoff", Vector) = (0.9, 1, 0, 0)
|
|
|
|
|
|
// Caustics
|
|
[Toggle(_CAUSTICS)] _CausticsOn("Caustics On", float) = 0
|
|
[NoScaleOffset][SingleLineTexture]_CausticsTex("Caustics RGB", 2D) = "black" {}
|
|
_CausticsBrightness("Brightness", Float) = 2
|
|
_CausticsTiling("Tiling", Float) = 0.5
|
|
_CausticsSpeed("Speed multiplier", Float) = 0.1
|
|
_CausticsClipping("Caustics Cutoff (Y)dis (X)dep", Vector) = (6,0.3,0,0)
|
|
|
|
|
|
//waves
|
|
_WaveSpeed("Wave Speed", Float) = 2
|
|
_WaveHeight("Wave Height", Range(0 , 10)) = 0.25
|
|
|
|
_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)
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"RenderType" = "Transparent"
|
|
"RenderPipeline" = "UniversalPipeline"
|
|
"UniversalMaterialType" = "Lit"
|
|
"IgnoreProjector" = "True"
|
|
"Queue" = "Transparent+0"
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "ForwardLit"
|
|
Tags { "LightMode"="UniversalForward" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZWrite On
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZClip On
|
|
|
|
HLSLPROGRAM
|
|
|
|
#pragma target 4.6
|
|
#pragma exclude_renderers gles
|
|
|
|
#define TESSELLATION_ON
|
|
#pragma require tessellation tessHW
|
|
#pragma hull Hull
|
|
#pragma domain Domain
|
|
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#include "Packages/zzwater/shaders/libs/URP.hlsl"
|
|
#include "Packages/zzwater/shaders/libs/Common.hlsl"
|
|
#include "Packages/zzwater/shaders/libs/Input.hlsl"
|
|
#include "Packages/zzwater/shaders/libs/Waves.hlsl"
|
|
|
|
|
|
#pragma shader_feature_local_fragment _LIGHT_COLOR
|
|
#pragma shader_feature_local_fragment _REFRACTION
|
|
#pragma shader_feature_local_fragment _INTERSECTION
|
|
#pragma shader_feature_local_fragment _WAVE_FOAM
|
|
#pragma shader_feature_local_fragment _CAUSTICS
|
|
|
|
//Fog rendering (integration)
|
|
#define UnityFog
|
|
#pragma multi_compile_fog
|
|
|
|
#pragma vertex VertexTessellation
|
|
#include "Packages/zzwater/shaders/libs/Tesselation.hlsl"
|
|
|
|
|
|
#pragma fragment ForwardPassFragment
|
|
#include "Packages/zzwater/shaders/libs/ForwardPass.hlsl"
|
|
|
|
ENDHLSL
|
|
|
|
}
|
|
}
|
|
FallBack "Diffuse"
|
|
}
|