Skip to content
Snippets Groups Projects
Commit 850be3d3 authored by Brian Peiris's avatar Brian Peiris
Browse files

Minor shader refactor

parent 8de33886
No related branches found
No related tags found
No related merge requests found
if (hubs_HighlightInteractorOne || hubs_HighlightInteractorTwo) { if (hubs_HighlightInteractorOne || hubs_HighlightInteractorTwo) {
float dist1, dist2; float ratio = 0.0;
if (hubs_HighlightInteractorOne) {
dist1 = distance(hubs_WorldPosition, hubs_InteractorOnePos);
}
if (hubs_HighlightInteractorTwo) {
dist2 = distance(hubs_WorldPosition, hubs_InteractorTwoPos);
}
if (hubs_EnableSweepingEffect) { if (hubs_EnableSweepingEffect) {
float size = hubs_SweepParams.t - hubs_SweepParams.s; float size = hubs_SweepParams.t - hubs_SweepParams.s;
float line = mod(hubs_Time / 3000.0 * size, size * 2.0) + hubs_SweepParams.s - size / 2.0; float line = mod(hubs_Time / 3000.0 * size, size * 2.0) + hubs_SweepParams.s - size / 2.0;
float ratio = 0.0;
if (hubs_WorldPosition.y < line) { if (hubs_WorldPosition.y < line) {
// Highlight with an sweeping gradient // Highlight with an sweeping gradient
ratio = max(0.0, 1.0 - (line - hubs_WorldPosition.y) / size * 3.0); ratio = max(0.0, 1.0 - (line - hubs_WorldPosition.y) / size * 3.0);
...@@ -23,9 +14,11 @@ if (hubs_HighlightInteractorOne || hubs_HighlightInteractorTwo) { ...@@ -23,9 +14,11 @@ if (hubs_HighlightInteractorOne || hubs_HighlightInteractorTwo) {
float pulse = sin(hubs_Time / 1000.0) + 1.0; float pulse = sin(hubs_Time / 1000.0) + 1.0;
// Highlight with a gradient falling off with distance. // Highlight with a gradient falling off with distance.
if (hubs_HighlightInteractorOne) { 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 * (9.0 + 3.0 * pulse), 3.0)) + 1.0;
} }
if (hubs_HighlightInteractorTwo) { 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 * (9.0 + 3.0 * pulse), 3.0)) + 1.0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment