Cursors are now much more robustly detected, and the debug view— previously called the computation texture— now resembles BUF's behind-the-scenes VFX footage. Isolated the isometric camera option from the debug view

This commit is contained in:
Rezmason
2022-09-08 23:12:58 -07:00
parent 77d6176fd5
commit ed49105c69
8 changed files with 55 additions and 43 deletions

View File

@@ -13,7 +13,7 @@ uniform vec2 glyphTextureGridSize;
uniform vec2 slantVec;
uniform float slantScale;
uniform bool isPolar;
uniform bool showComputationTexture;
uniform bool showDebugView;
uniform bool volumetric;
varying vec2 vUV;
@@ -76,7 +76,7 @@ void main() {
brightness = max(shine.b * cursorBrightness, brightness);
brightness = max(shine.a, brightness);
// In volumetric mode, distant glyphs are dimmer
if (volumetric) {
if (volumetric && !showDebugView) {
brightness = brightness * min(1., vDepth);
}
@@ -92,12 +92,18 @@ void main() {
float sigDist = median3(dist) - 0.5;
float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0., 1.);
if (showComputationTexture) {
vec4 debugColor = vec4(shine.r - alpha, shine.g * alpha, shine.a - alpha, 1.);
if (volumetric) {
debugColor.g = debugColor.g * 0.9 + 0.1;
}
gl_FragColor = debugColor;
if (showDebugView) {
brightness *= 2.;
gl_FragColor = vec4(
vec3(
shine.b,
vec2(
brightness,
clamp(0., 1., pow(brightness * 0.9, 6.0))
) * (1.0 - shine.b)
) * alpha,
1.
);
} else {
gl_FragColor = vec4(vChannel * brightness * alpha, 1.);
}

View File

@@ -55,11 +55,11 @@ float getRainTime(float simTime, vec2 glyphPos) {
columnSpeedOffset = 0.5;
}
float columnTime = columnTimeOffset + simTime * fallSpeed * columnSpeedOffset;
return (glyphPos.y * 0.01 + columnTime) / raindropLength;
return wobble((glyphPos.y * 0.01 + columnTime) / raindropLength);
}
float getBrightness(float rainTime) {
float value = 1. - fract(wobble(rainTime));
float value = 1. - fract(rainTime);
if (loops) {
value = 1. - fract(rainTime);
}
@@ -122,10 +122,12 @@ float applyRippleEffect(float effect, float simTime, vec2 screenPos) {
// Main function
vec4 computeResult(float simTime, bool isFirstFrame, vec2 glyphPos, vec2 screenPos, vec4 previous, vec4 previousBelow) {
vec4 computeResult(float simTime, bool isFirstFrame, vec2 glyphPos, vec2 screenPos, vec4 previous) {
// Determine the glyph's local time.
float rainTime = getRainTime(simTime, glyphPos);
float rainTimeBelow = getRainTime(simTime, glyphPos + vec2(0., -1.));
float cursor = fract(rainTime) < fract(rainTimeBelow) ? 1.0 : 0.0;
// Rain time is the backbone of this effect.
@@ -139,9 +141,6 @@ vec4 computeResult(float simTime, bool isFirstFrame, vec2 glyphPos, vec2 screenP
float effect = 0.;
effect = applyRippleEffect(effect, simTime, screenPos); // Round or square ripples across the grid
float previousBrightnessBelow = previousBelow.r;
float cursor = brightness > previousBrightnessBelow ? 1.0 : 0.0;
// Blend the glyph's brightness with its previous brightness, so it winks on and off organically
if (!isFirstFrame) {
float previousBrightness = previous.r;
@@ -158,6 +157,5 @@ void main() {
vec2 glyphPos = gl_FragCoord.xy;
vec2 screenPos = glyphPos / vec2(numColumns, numRows);
vec4 previous = texture2D( previousShineState, screenPos );
vec4 previousBelow = texture2D( previousShineState, screenPos + vec2(0., -1. / numRows));
gl_FragColor = computeResult(simTime, isFirstFrame, glyphPos, screenPos, previous, previousBelow);
gl_FragColor = computeResult(simTime, isFirstFrame, glyphPos, screenPos, previous);
}

View File

@@ -13,7 +13,7 @@ uniform sampler2D previousSymbolState, shineState;
uniform float numColumns, numRows;
uniform float time, tick, cycleFrameSkip;
uniform float animationSpeed, cycleSpeed;
uniform bool loops, showComputationTexture;
uniform bool loops, showDebugView;
uniform float glyphSequenceLength;
uniform int cycleStyle;