diff options
| author | yum <yum.food.vr@gmail.com> | 2025-03-31 21:50:39 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-03-31 21:50:39 -0700 |
| commit | 2dfd6322587eb095a5a4f7b22d70e1abcc14d5e3 (patch) | |
| tree | 76b6f84628e07c722b74ce58b34e70d672e9541d /shatter_wave.cginc | |
| parent | 3f1915bbd0e6176e625c484cf24a460cc88bfeac (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.cginc | 7 |
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;
|
