summaryrefslogtreecommitdiffstats
path: root/tooner_lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-10-24 18:45:29 -0700
committeryum <yum.food.vr@gmail.com>2024-10-24 18:45:29 -0700
commit1705cd25f5bcd796a560bcce22ef91d190a94900 (patch)
tree122c80d25228e2e7c83fa720982576535223ebab /tooner_lighting.cginc
parent09aa66c9c13965105133ca000da4d2c37d455877 (diff)
add water stuff
Diffstat (limited to 'tooner_lighting.cginc')
-rw-r--r--tooner_lighting.cginc27
1 files changed, 17 insertions, 10 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index 87cf2e4..bcad86a 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -219,7 +219,7 @@ v2f vert(appdata v)
// maxvertexcount == the number of vertices we create
#if defined(_CLONES)
-[maxvertexcount(45)]
+[maxvertexcount(15)]
#else
[maxvertexcount(3)]
#endif
@@ -1296,15 +1296,6 @@ float4 effect(inout v2f i, out float depth)
i.objPos.xyz = trochoid_map(theta, r0, z);
}
#endif
-#if defined(_GIMMICK_GERSTNER_WATER)
-#if defined(_EXPLODE)
- if (_Explode_Phase < 1E-6)
-#endif
- {
- GerstnerParams p = getGerstnerParams();
- i.normal = UnityObjectToWorldNormal(gerstner_frag(i.objPos.xyz, p));
- }
-#endif
#if defined(_UVSCROLL)
float2 orig_uv = i.uv0;
@@ -1319,6 +1310,22 @@ float4 effect(inout v2f i, out float depth)
float4 albedo = _Color;
#endif // _BASECOLOR_MAP
+#if defined(_GIMMICK_GERSTNER_WATER)
+#if defined(_EXPLODE)
+ if (_Explode_Phase < 1E-6)
+#endif
+ {
+ GerstnerParams p = getGerstnerParams();
+ GerstnerFragResult r = gerstner_frag(i.objPos.xyz, p);
+ i.normal = UnityObjectToWorldNormal(r.normal);
+ i.tangent = float4(UnityObjectToWorldDir(r.tangent.xyz), r.tangent.w);
+#if defined(_GIMMICK_GERSTNER_WATER_COLOR_RAMP)
+ albedo.xyz *= r.color;
+ albedo.w = 1;
+#endif
+ }
+#endif
+
#if defined(_UVSCROLL)
if (uv_scroll_mask) {
float uv_scroll_alpha = _UVScroll_Alpha.SampleBias(linear_repeat_s, orig_uv, _Global_Sample_Bias);