[A] wave foam
This commit is contained in:
@@ -107,14 +107,14 @@ Material:
|
||||
- _GlossyReflections: 0
|
||||
- _HorizonDistance: 26.6
|
||||
- _InterscetionSpeed: 1
|
||||
- _IntersectionClipping: 0.735
|
||||
- _IntersectionClipping: 0.407
|
||||
- _IntersectionDurationMulti: 1
|
||||
- _IntersectionDurationMulti1: 3.45
|
||||
- _IntersectionDurationMulti2: 1.45
|
||||
- _IntersectionFalloff: 0.451
|
||||
- _IntersectionLength: 1.43
|
||||
- _IntersectionSpeed: -0.21
|
||||
- _IntersectionTiling: 1.27
|
||||
- _IntersectionDurationMulti1: 2.53
|
||||
- _IntersectionDurationMulti2: 0.83
|
||||
- _IntersectionFalloff: 0.73
|
||||
- _IntersectionLength: 2.03
|
||||
- _IntersectionSpeed: 0.2
|
||||
- _IntersectionTiling: 0.82
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
@@ -133,31 +133,37 @@ Material:
|
||||
- _Surface: 0
|
||||
- _TessMax: 15
|
||||
- _TessMin: 0
|
||||
- _TessValue: 19.2
|
||||
- _TessValue: 16
|
||||
- _TranslucencyCurvatureMask: 0.708
|
||||
- _TranslucencyExp: 10
|
||||
- _TranslucencyReflectionMask: 0.764
|
||||
- _TranslucencyStrength: 0.7
|
||||
- _TranslucencyStrengthDirect: 0.443
|
||||
- _WaveCount: 3
|
||||
- _WaveDistance: 0.764
|
||||
- _WaveHeight: 0.17
|
||||
- _WaveCount: 2
|
||||
- _WaveDistance: 0.808
|
||||
- _WaveFoamBaseLvl: -2.66
|
||||
- _WaveFoamClipping: 0.328
|
||||
- _WaveFoamExp: 5
|
||||
- _WaveFoamLength: 1
|
||||
- _WaveHeight: 0.23
|
||||
- _WaveMesureMax: -2.51
|
||||
- _WaveMesureMin: -2.68
|
||||
- _WaveNormalStr: 0.2
|
||||
- _WaveSpeed: 1.2
|
||||
- _WaveSteepness: 3.76
|
||||
- _WaveSpeed: 1
|
||||
- _WaveSteepness: 3.65
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.01619794, g: 0.20062576, b: 0.26415092, a: 0.9490196}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Direction: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _Direction: {r: 0.66, g: -1, b: 0, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, a: 1}
|
||||
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _IntersectionColor: {r: 0.9622642, g: 0.9577252, b: 0.9577252, a: 1}
|
||||
- _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 0.9372549}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveDirection: {r: 1, g: 1, b: 1, a: 2}
|
||||
- _WaveFadeDistance: {r: 0, g: 200, b: 0, a: 0}
|
||||
- _WaveFadeDistance: {r: 100, g: 200, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &1635733923474585344
|
||||
MonoBehaviour:
|
||||
|
||||
@@ -34,8 +34,8 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
filterMode: 0
|
||||
aniso: 3
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
|
||||
@@ -96,23 +96,34 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
|
||||
water.alpha *= water.edgeFade;
|
||||
|
||||
|
||||
// Wave Mesure
|
||||
|
||||
|
||||
float waveMesure = (positionWS.y - _WaveMesureMin) / (_WaveMesureMax - _WaveMesureMin);
|
||||
|
||||
float2 nUV = positionWS.xz * _IntersectionTiling;
|
||||
float foamTexNoise = SAMPLE_TEXTURE2D(_IntersectionNoise, sampler_IntersectionNoise, nUV + TIME_VERTEX/_IntersectionTiling * _IntersectionSpeed).r;
|
||||
|
||||
// remap wave from [_WaveFoamClipping,1] to [0,1]
|
||||
float waveFoamNoise = (waveMesure - _WaveFoamClipping) / (1 - _WaveFoamClipping) * foamTexNoise;
|
||||
//return float4(waveFoamNoise.xxx, 1);
|
||||
|
||||
/* ========
|
||||
// Intercection
|
||||
=========== */
|
||||
|
||||
|
||||
float interSecGradient = 1-saturate(exp(scene.verticalDepth) / _IntersectionLength);
|
||||
float sine1 = sin(_TimeParameters.x * _IntersectionDurationMulti1 + positionWS.x - interSecGradient );
|
||||
float sine2 = sin(_TimeParameters.x * _IntersectionDurationMulti2 + positionWS.z - interSecGradient );
|
||||
float sine = sine1 * sine2 * interSecGradient;
|
||||
float intersecMesure = waveMesure * interSecGradient;
|
||||
|
||||
float2 nUV = positionWS.xz * _IntersectionTiling;
|
||||
float dist = saturate(interSecGradient / _IntersectionFalloff);
|
||||
|
||||
float noise = SAMPLE_TEXTURE2D(_IntersectionNoise, sampler_IntersectionNoise, nUV + TIME_VERTEX/_IntersectionTiling * _IntersectionSpeed).r;
|
||||
noise = saturate(noise + sine) * dist + dist;
|
||||
noise = smoothstep(_IntersectionClipping, 1, noise);
|
||||
//noise = step(_IntersectionClipping, noise);
|
||||
float inersecNoise = saturate(foamTexNoise + intersecMesure) * dist + dist;
|
||||
inersecNoise = smoothstep(_IntersectionClipping, 1, inersecNoise);
|
||||
|
||||
|
||||
float noise = saturate(inersecNoise + waveFoamNoise);
|
||||
|
||||
water.albedo.rgb = lerp(water.albedo.rgb, _IntersectionColor.rgb, noise);
|
||||
water.alpha = saturate(water.alpha + interSecGradient);
|
||||
@@ -131,7 +142,7 @@ float4 ForwardPassFragment(Varyings input) : SV_Target
|
||||
float cosTheta = saturate(dot(normalWS, viewDir));
|
||||
water.reflectionMask = pow(max(0.0, 1.000293 - cosTheta), _ReflectionFresnel) * _ReflectionStrength;
|
||||
|
||||
water.albedo = lerp(water.albedo, water.reflections.rgb, water.reflectionMask);
|
||||
water.albedo = lerp(water.albedo, water.reflections.rgb, water.reflectionMask - noise);
|
||||
|
||||
|
||||
// =================== Make ApplyLight simple =========================
|
||||
|
||||
@@ -39,8 +39,12 @@ CBUFFER_START(UnityPerMaterial)
|
||||
half _IntersectionSpeed;
|
||||
half _IntersectionClipping;
|
||||
half _IntersectionFalloff;
|
||||
half _IntersectionDurationMulti1;
|
||||
half _IntersectionDurationMulti2;
|
||||
|
||||
// Wave foam
|
||||
half _WaveMesureMin;
|
||||
half _WaveMesureMax;
|
||||
half _WaveFoamClipping;
|
||||
|
||||
|
||||
|
||||
//Waves
|
||||
|
||||
@@ -28,10 +28,13 @@ Shader "zzwater/ocean"
|
||||
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
|
||||
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionDurationMulti1("Intersection Duration Multi 1", Range(0.01, 10)) = 0.5
|
||||
_IntersectionDurationMulti2("Intersection Duration Multi 2", Range(0.01, 10)) = 0.5
|
||||
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
|
||||
|
||||
// Wave foam
|
||||
_WaveMesureMin("Wave Mesure Min", float) = 0
|
||||
_WaveMesureMax("Wave Mesure Max", float) = 0.3
|
||||
_WaveFoamClipping("Wave Cutoff", Range(0.01,1)) = 1
|
||||
|
||||
|
||||
//waves
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
|
||||
@@ -34,10 +34,13 @@ Shader "zzwater/ocean_tess"
|
||||
_IntersectionSpeed("Intersection Speed Multi", Float) = 1
|
||||
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
||||
_IntersectionDurationMulti1("Intersection Duration Multi 1", Range(0.01, 10)) = 0.5
|
||||
_IntersectionDurationMulti2("Intersection Duration Multi 2", Range(0.01, 10)) = 0.5
|
||||
_IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2
|
||||
|
||||
// Wave foam
|
||||
_WaveMesureMin("Wave Mesure Min", float) = 0
|
||||
_WaveMesureMax("Wave Mesure Max", float) = 0.3
|
||||
_WaveFoamClipping("Wave Cutoff", Range(0.01,1)) = 1
|
||||
|
||||
|
||||
//waves
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
|
||||
Reference in New Issue
Block a user