From 1a97861fedc043b909809434f8349ed1e8898426 Mon Sep 17 00:00:00 2001 From: Rezmason Date: Fri, 22 Oct 2021 22:56:11 -0700 Subject: [PATCH] Resurrections version now vertically spaces the glyphs (groan). --- TODO.txt | 16 ++++++---------- js/config.js | 10 +++++----- js/rainPass.js | 1 + shaders/rainPass.vert | 4 ++-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/TODO.txt b/TODO.txt index 56404f5..deb6f28 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,23 +1,19 @@ TODO: Improve forkability + Refactor rainPass.compute's sin(sqrt(5)) stuff, there must be a clearer expression - Document every variable, method, and section of the main function in rainPass.compute - Maybe rewrite it? Make the time based stuff easier to read? - - Write a document (and include images) that explains the underlying principle of the rain pass - - Is the pipeline stuff just too bizarre? - + Write an explanation of the rain pass (and include images) + Compute + Volumetric quads + Fullscreen quad and spacial mapping + MSDFs Resurrection Modified glyph order? New glyphs? Good luck with that, champ - - - Audio Synthesize raindrop sound Use WebAudio to mess with it diff --git a/js/config.js b/js/config.js index b4dccb9..3e4a571 100644 --- a/js/config.js +++ b/js/config.js @@ -38,6 +38,7 @@ const defaults = { fallSpeed: 1, // The speed the raindrops progress downwards glyphEdgeCrop: 0.0, // The border around a glyph in a font texture that should be cropped out glyphHeightToWidth: 1, // The aspect ratio of glyphs + glyphVerticalSpacing: 1, // The ratio of the vertical distance between glyphs to their height hasSun: false, // Makes the glyphs more radiant. Admittedly not very technical. hasThunder: false, // An effect that adds dramatic lightning flashes isPolar: false, // Whether the glyphs arc across the screen or sit in a standard grid @@ -74,7 +75,7 @@ const versions = { cycleFrameSkip: 6, cycleStyleName: "cycleRandomly", cursorEffectThreshold: 0.64, - brightnessOverride: 0.25, + brightnessOverride: 0.22, brightnessThreshold: -1.0, fallSpeed: 0.65, glyphEdgeCrop: 0.15, @@ -132,12 +133,11 @@ const versions = { ...defaults, ...fonts.matrixcode, resurrectingCodeRatio: 0.25, + glyphVerticalSpacing: 1.25, effect: "resurrections", - width: 100, + numColumns: 100, volumetric: true, - density: 1.5, - fallSpeed: 1.2, - raindropLength: 1.25, + cycleSpeed: 0.5, }, }; versions.throwback = versions.operator; diff --git a/js/rainPass.js b/js/rainPass.js index f8e33c6..6e0a3cf 100644 --- a/js/rainPass.js +++ b/js/rainPass.js @@ -108,6 +108,7 @@ export default (regl, config) => { ...extractEntries(config, [ // vertex "forwardSpeed", + "glyphVerticalSpacing", // fragment "glyphEdgeCrop", "isPolar", diff --git a/shaders/rainPass.vert b/shaders/rainPass.vert index e8a764a..636eee9 100644 --- a/shaders/rainPass.vert +++ b/shaders/rainPass.vert @@ -4,7 +4,7 @@ attribute vec2 aPosition, aCorner; uniform sampler2D lastState; uniform float density; uniform vec2 quadSize; -uniform float glyphHeightToWidth; +uniform float glyphHeightToWidth, glyphVerticalSpacing; uniform mat4 camera, transform; uniform vec2 screenSize; uniform float time, animationSpeed, forwardSpeed; @@ -32,7 +32,7 @@ void main() { quadDepth = fract(vGlyph.b + time * animationSpeed * forwardSpeed); vGlyph.b = quadDepth; } - vec2 position = (aPosition + aCorner * vec2(density, 1.)) * quadSize; + vec2 position = (aPosition * vec2(1., glyphVerticalSpacing) + aCorner * vec2(density, 1.)) * quadSize; vec4 pos = vec4((position - 0.5) * 2.0, quadDepth, 1.0); // "Resurrected" columns are in the green channel,