diff options
| author | yum <yum.food.vr@gmail.com> | 2024-10-23 00:32:44 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-10-23 00:32:44 -0700 |
| commit | 4eb21bddb139677268c9abd28e06e5f4dbe69f6e (patch) | |
| tree | 07542b000c18562d28ac25d77538d89f4c81a44e /tooner_lighting.cginc | |
| parent | dd46f7e166eabee42564b6dfe4c0a4e1d54b5e7d (diff) | |
Add gerstner water gimmick
Diffstat (limited to 'tooner_lighting.cginc')
| -rw-r--r-- | tooner_lighting.cginc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 63cd69d..5d055c0 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -9,6 +9,7 @@ #include "disinfo.cginc" #include "eyes.cginc" #include "fog.cginc" +#include "gerstner.cginc" #include "globals.cginc" #include "halos.cginc" #include "interpolators.cginc" @@ -91,8 +92,6 @@ v2f vert(appdata v) #if defined(_TROCHOID) { -#define PI 3.14159265 -#define TAU PI * 2.0 float theta = v.uv0.x * TAU; float r0 = length(v.vertex.xyz); v.vertex.xyz = trochoid_map(theta, r0, v.vertex.z); @@ -159,6 +158,12 @@ v2f vert(appdata v) v.vertex.xyz = p; } #endif +#if defined(_GIMMICK_GERSTNER_WATER) + { + GerstnerParams p = getGerstnerParams(); + v.vertex.xyz = gerstner_vert(v.vertex.xyz, p); + } +#endif o.pos = UnityObjectToClipPos(v.vertex); o.worldPos = mul(unity_ObjectToWorld, v.vertex); @@ -1291,6 +1296,12 @@ float4 effect(inout v2f i, out float depth) i.objPos.xyz = trochoid_map(theta, r0, z); } #endif +#if defined(_GIMMICK_GERSTNER_WATER) + { + GerstnerParams p = getGerstnerParams(); + i.normal = UnityObjectToWorldNormal(gerstner_frag(i.objPos.xyz, p)); + } +#endif #if defined(_UVSCROLL) float2 orig_uv = i.uv0; @@ -1684,8 +1695,6 @@ float4 effect(inout v2f i, out float depth) #if defined(_RIM_LIGHTING0) || defined(_RIM_LIGHTING1) || defined(_RIM_LIGHTING2) || defined(_RIM_LIGHTING3) { -#define PI 3.14159265 - #if defined(_RIM_LIGHTING0) { float3 rl_view_dir = VIEW_DIR(_Rim_Lighting0_Center_Eye_Fix); |
