The cursor channel of the rain pass is now propagated in isolation to the effect passes.

This commit is contained in:
Rezmason
2022-09-15 23:33:47 -07:00
parent 17a615eec7
commit 6969514c9b
9 changed files with 48 additions and 33 deletions

View File

@@ -15,7 +15,7 @@ void main() {
vec3 bgColor = texture2D(backgroundTex, vUV).rgb;
// Combine the texture and bloom, then blow it out to reveal more of the image
float brightness = pow(getBrightness(vUV).r, 1.5);
vec4 brightness = getBrightness(vUV);
gl_FragColor = vec4(bgColor * brightness, 1.0);
gl_FragColor = vec4(bgColor * (brightness.r + brightness.g * 2.0), 1.0);
}

View File

@@ -7,7 +7,7 @@ uniform sampler2D palette;
uniform float bloomStrength;
uniform float ditherMagnitude;
uniform float time;
uniform vec3 backgroundColor;
uniform vec3 backgroundColor, cursorColor;
varying vec2 vUV;
highp float rand( const in vec2 uv, const in float t ) {
@@ -26,11 +26,16 @@ void main() {
vec4 brightnessRGB = getBrightness(vUV);
// Combine the texture and bloom
float brightness = brightnessRGB.r + brightnessRGB.g + brightnessRGB.b;
vec2 brightness = brightnessRGB.rg;
// Dither: subtract a random value from the brightness
brightness = brightness - rand( gl_FragCoord.xy, time ) * ditherMagnitude;
// Map the brightness to a position in the palette texture
gl_FragColor = texture2D( palette, vec2(brightness, 0.0)) + vec4(backgroundColor, 0.0);
gl_FragColor = vec4(
texture2D( palette, vec2(brightness.r, 0.0)).rgb
+ min(cursorColor * brightness.g, 1.0)
+ backgroundColor,
1.0
);
}

View File

@@ -9,13 +9,14 @@ uniform float numColumns, numRows;
uniform sampler2D glyphTex;
uniform float glyphHeightToWidth, glyphSequenceLength, glyphEdgeCrop;
uniform float baseContrast, baseBrightness;
uniform float brightnessOverride, brightnessThreshold, cursorBrightness;
uniform float brightnessOverride, brightnessThreshold;
uniform vec2 glyphTextureGridSize;
uniform vec2 slantVec;
uniform float slantScale;
uniform bool isPolar;
uniform bool showDebugView;
uniform bool volumetric;
uniform bool isolateCursor;
varying vec2 vUV;
varying vec4 vShine, vSymbol, vEffect;
@@ -57,24 +58,26 @@ vec2 getUV(vec2 uv) {
return uv;
}
float getBrightness(float brightness, float cursor, float multipliedEffects, float addedEffects) {
vec2 getBrightness(float brightness, float cursor, float multipliedEffects, float addedEffects) {
if (!isolateCursor) {
cursor = 0.;
}
brightness = (1.0 - brightness) * baseContrast + baseBrightness;
// Modes that don't fade glyphs set their actual brightness here
if (brightnessOverride > 0. && brightness > brightnessThreshold) {
if (brightnessOverride > 0. && brightness > brightnessThreshold && cursor == 0.) {
brightness = brightnessOverride;
}
brightness *= multipliedEffects;
brightness += addedEffects;
brightness = max(cursor * cursorBrightness, brightness);
// In volumetric mode, distant glyphs are dimmer
if (volumetric && !showDebugView) {
brightness = brightness * min(1., vDepth);
}
return brightness;
return vec2(brightness * (1. - cursor), brightness * cursor);
}
vec2 getSymbolUV(float index) {
@@ -107,7 +110,7 @@ void main() {
vec4 symbolData = volumetric ? vSymbol : texture2D(symbolState, uv);
vec4 effectData = volumetric ? vEffect : texture2D(effectState, uv);
float brightness = getBrightness(shineData.r, shineData.g, effectData.r, effectData.g);
vec2 brightness = getBrightness(shineData.r, shineData.g, effectData.r, effectData.g);
float symbol = getSymbol(uv, symbolData.r);
if (showDebugView) {
@@ -122,6 +125,6 @@ void main() {
1.
);
} else {
gl_FragColor = vec4(brightness * symbol, 0., 0., 0.);
gl_FragColor = vec4(brightness * symbol, 0., 0.);
}
}

View File

@@ -7,7 +7,7 @@ uniform float bloomStrength;
uniform sampler2D stripes;
uniform float ditherMagnitude;
uniform float time;
uniform vec3 backgroundColor;
uniform vec3 backgroundColor, cursorColor;
varying vec2 vUV;
highp float rand( const in vec2 uv, const in float t ) {
@@ -25,10 +25,15 @@ vec4 getBrightness(vec2 uv) {
void main() {
vec3 color = texture2D(stripes, vUV).rgb;
// Combine the texture and bloom
float brightness = getBrightness(vUV).r;
vec4 brightness = getBrightness(vUV);
// Dither: subtract a random value from the brightness
brightness = brightness - rand( gl_FragCoord.xy, time ) * ditherMagnitude;
gl_FragColor = vec4(color * brightness + backgroundColor, 1.0);
gl_FragColor = vec4(
color * brightness.r
+ min(cursorColor * brightness.g, 1.0)
+ backgroundColor,
1.0
);
}