mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Improving the "debug view" by basing it on rain time, so it's unaffected by the base brightness and contrast
This commit is contained in:
@@ -62,7 +62,7 @@ const defaults = {
|
|||||||
bloomStrength: 0.7, // The intensity of the bloom
|
bloomStrength: 0.7, // The intensity of the bloom
|
||||||
bloomSize: 0.4, // The amount the bloom calculation is scaled
|
bloomSize: 0.4, // The amount the bloom calculation is scaled
|
||||||
highPassThreshold: 0.1, // The minimum brightness that is still blurred
|
highPassThreshold: 0.1, // The minimum brightness that is still blurred
|
||||||
cycleSpeed: 0.2, // The speed glyphs change
|
cycleSpeed: 0.4, // The speed glyphs change
|
||||||
cycleFrameSkip: 1, // The global minimum number of frames between glyphs cycling
|
cycleFrameSkip: 1, // The global minimum number of frames between glyphs cycling
|
||||||
cycleStyleName: "cycleFasterWhenDimmed", // The way glyphs cycle, either proportional to their brightness or randomly
|
cycleStyleName: "cycleFasterWhenDimmed", // The way glyphs cycle, either proportional to their brightness or randomly
|
||||||
baseBrightness: -0.5, // The brightness of the glyphs, before any effects are applied
|
baseBrightness: -0.5, // The brightness of the glyphs, before any effects are applied
|
||||||
|
|||||||
@@ -93,13 +93,12 @@ void main() {
|
|||||||
float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0., 1.);
|
float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0., 1.);
|
||||||
|
|
||||||
if (showDebugView) {
|
if (showDebugView) {
|
||||||
brightness *= 2.;
|
|
||||||
gl_FragColor = vec4(
|
gl_FragColor = vec4(
|
||||||
vec3(
|
vec3(
|
||||||
shine.b,
|
shine.b,
|
||||||
vec2(
|
vec2(
|
||||||
brightness,
|
1.0 - (shine.g * 3.0),
|
||||||
clamp(0., 1., pow(brightness * 0.9, 6.0))
|
1.0 - (shine.g * 10.0)
|
||||||
) * (1.0 - shine.b)
|
) * (1.0 - shine.b)
|
||||||
) * alpha,
|
) * alpha,
|
||||||
1.
|
1.
|
||||||
|
|||||||
@@ -63,11 +63,7 @@ float getRainTime(float simTime, vec2 glyphPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getBrightness(float rainTime) {
|
float getBrightness(float rainTime) {
|
||||||
float value = 1. - fract(rainTime);
|
return (1. - fract(rainTime)) * baseContrast + baseBrightness;
|
||||||
if (loops) {
|
|
||||||
value = 1. - fract(rainTime);
|
|
||||||
}
|
|
||||||
return value * baseContrast + baseBrightness;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional effects
|
// Additional effects
|
||||||
@@ -151,7 +147,7 @@ vec4 computeResult(float simTime, bool isFirstFrame, vec2 glyphPos, vec2 screenP
|
|||||||
brightness = mix(previousBrightness, brightness, brightnessDecay);
|
brightness = mix(previousBrightness, brightness, brightnessDecay);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 result = vec4(brightness, 0., cursor, effect);
|
vec4 result = vec4(brightness, fract(rainTime), cursor, effect);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,8 +146,7 @@ fn getRainTime(simTime : f32, glyphPos : vec2<f32>) -> f32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn getBrightness(rainTime : f32) -> f32 {
|
fn getBrightness(rainTime : f32) -> f32 {
|
||||||
var value = 1.0 - fract(rainTime);
|
return (1.0 - fract(rainTime)) * config.baseContrast + config.baseBrightness;
|
||||||
return value * config.baseContrast + config.baseBrightness;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getCycleSpeed(brightness : f32) -> f32 {
|
fn getCycleSpeed(brightness : f32) -> f32 {
|
||||||
@@ -244,7 +243,7 @@ fn computeShine (simTime : f32, isFirstFrame : bool, glyphPos : vec2<f32>, scree
|
|||||||
brightness = mix(previousBrightness, brightness, config.brightnessDecay);
|
brightness = mix(previousBrightness, brightness, config.brightnessDecay);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = vec4<f32>(brightness, 0.0, cursor, effect);
|
var result = vec4<f32>(brightness, fract(rainTime), cursor, effect);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,16 +442,15 @@ fn getSymbolUV(symbol : i32) -> vec2<f32> {
|
|||||||
var output : FragOutput;
|
var output : FragOutput;
|
||||||
|
|
||||||
if (bool(config.showDebugView)) {
|
if (bool(config.showDebugView)) {
|
||||||
brightness *= 2.0;
|
|
||||||
output.color = vec4<f32>(
|
output.color = vec4<f32>(
|
||||||
vec3<f32>(
|
vec3<f32>(
|
||||||
cell.shine.b,
|
cell.shine.b,
|
||||||
vec2<f32>(
|
vec2<f32>(
|
||||||
brightness,
|
1.0 - (cell.shine.g * 3.0),
|
||||||
clamp(0.0, 1.0, pow(brightness * 0.9, 6.0))
|
1.0 - (cell.shine.g * 10.0)
|
||||||
) * (1.0 - cell.shine.b)
|
) * (1.0 - cell.shine.b)
|
||||||
) * alpha,
|
) * alpha,
|
||||||
1.0
|
1.
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
output.color = vec4<f32>(input.channel * brightness * alpha, 1.0);
|
output.color = vec4<f32>(input.channel * brightness * alpha, 1.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user