diff --git a/src/utils/media-highlight-frag.glsl b/src/utils/media-highlight-frag.glsl index d47ac0b131c9d2294c64e8b9eb1b29d99c71d299..82214980d57847926b5a1edbb8c9deef01b4721e 100644 --- a/src/utils/media-highlight-frag.glsl +++ b/src/utils/media-highlight-frag.glsl @@ -6,20 +6,22 @@ if (hubs_HighlightInteractorOne || hubs_HighlightInteractorTwo) { float line = mod(hubs_Time / 3000.0 * size, size * 2.0) + hubs_SweepParams.s - size / 2.0; if (hubs_WorldPosition.y < line) { - // Highlight with an sweeping gradient + // Highlight with a sweeping gradient. ratio = max(0.0, 1.0 - (line - hubs_WorldPosition.y) / size * 3.0); } } - float pulse = sin(hubs_Time / 1000.0) + 1.0; // Highlight with a gradient falling off with distance. + float pulse = 9.0 + 3.0 * (sin(hubs_Time / 1000.0) + 1.0); + if (hubs_HighlightInteractorOne) { float dist1 = distance(hubs_WorldPosition, hubs_InteractorOnePos); - ratio += -min(1.0, pow(dist1 * (9.0 + 3.0 * pulse), 3.0)) + 1.0; + ratio += -min(1.0, pow(dist1 * pulse, 3.0)) + 1.0; } + if (hubs_HighlightInteractorTwo) { float dist2 = distance(hubs_WorldPosition, hubs_InteractorTwoPos); - ratio += -min(1.0, pow(dist2 * (9.0 + 3.0 * pulse), 3.0)) + 1.0; + ratio += -min(1.0, pow(dist2 * pulse, 3.0)) + 1.0; } ratio = min(1.0, ratio);