From 2dfd6322587eb095a5a4f7b22d70e1abcc14d5e3 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 31 Mar 2025 21:50:39 -0700 Subject: 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. --- shatter_wave.cginc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shatter_wave.cginc') 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; -- cgit v1.2.3