summaryrefslogtreecommitdiffstats
path: root/shatter_wave.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-03-31 21:50:39 -0700
committeryum <yum.food.vr@gmail.com>2025-03-31 21:50:39 -0700
commit2dfd6322587eb095a5a4f7b22d70e1abcc14d5e3 (patch)
tree76b6f84628e07c722b74ce58b34e70d672e9541d /shatter_wave.cginc
parent3f1915bbd0e6176e625c484cf24a460cc88bfeac (diff)
Overhaul wrapped lighting
Now: * k=0 -> lambertian * k=0.5 -> half lambertian * k=1.0 -> flat All three points should be energy conserving, but I haven't done the actual analysis yet.
Diffstat (limited to 'shatter_wave.cginc')
-rw-r--r--shatter_wave.cginc7
1 files changed, 5 insertions, 2 deletions
diff --git a/shatter_wave.cginc b/shatter_wave.cginc
index f86a6ac..d65741f 100644
--- a/shatter_wave.cginc
+++ b/shatter_wave.cginc
@@ -15,7 +15,7 @@ void shatterWaveVert(inout float3 objPos, float3 objNormal, float3 objTangent) {
float3 wave_axis2 = normalize(_Shatter_Wave_Direction2);
float3 wave_axis3 = normalize(_Shatter_Wave_Direction3);
float4x3 wave_axes = float4x3(wave_axis0, wave_axis1, wave_axis2, wave_axis3);
-
+
float4 projDots = mul(wave_axes, objPos);
// Equivalent code:
// float4 projDots = float4(
@@ -24,7 +24,7 @@ void shatterWaveVert(inout float3 objPos, float3 objNormal, float3 objTangent) {
// dot(objPos, wave_axis2),
// dot(objPos, wave_axis3)
// );
-
+
float4x3 objPos_proj = float4x3(
projDots.x * wave_axis0,
projDots.y * wave_axis1,
@@ -67,6 +67,9 @@ void shatterWaveVert(inout float3 objPos, float3 objNormal, float3 objTangent) {
_Shatter_Wave_Time_Offset * _Shatter_Wave_Period -
_Time[0] * _Shatter_Wave_Speed * .3,
_Shatter_Wave_Period) - _Shatter_Wave_Period * 0.5;
+ } else {
+ wave_t = _Time[0] * _Shatter_Wave_Speed;
+ wave_t = fmod(wave_t + _Shatter_Wave_Time_Offset * _Shatter_Wave_Period, _Shatter_Wave_Period) - _Shatter_Wave_Period * 0.5;
}
#else
float4 wave_t = _Time[0] * _Shatter_Wave_Speed;