Changing my mind a little about how to render the "behind the scenes" version of the effect, in regular and volumetric mode.

An isometric perspective would be neat.
This commit is contained in:
Rezmason
2021-11-08 09:29:04 -08:00
parent bd17549619
commit 11bba1020d
4 changed files with 8 additions and 9 deletions

View File

@@ -179,9 +179,9 @@ vec4 computeResult(bool isFirstFrame, vec4 previousResult, vec2 glyphPos, vec2 s
vec4 result = vec4(brightness, cycle, depth, effect);
// Better use of the blue channel, for demonstrating how the glyph cycle works
// Better use of the alpha channel, for demonstrating how the glyph cycle works
if (showComputationTexture) {
result.b = min(1., localCycleSpeed);
result.a = min(1., localCycleSpeed);
}
return result;

View File

@@ -79,7 +79,7 @@ void main() {
float alpha = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);
if (showComputationTexture) {
gl_FragColor = vec4(glyph.rgb - alpha, 1.0);
gl_FragColor = vec4(glyph.r - alpha, glyph.g * alpha, glyph.a - alpha, 1.0);
} else {
gl_FragColor = vec4(vChannel * brightness * alpha, 1.0);
}

View File

@@ -9,7 +9,6 @@ uniform mat4 camera, transform;
uniform vec2 screenSize;
uniform float time, animationSpeed, forwardSpeed;
uniform bool volumetric;
uniform bool showComputationTexture;
uniform float resurrectingCodeRatio;
varying vec2 vUV;
varying vec3 vChannel;
@@ -28,7 +27,7 @@ void main() {
// Calculate the world space position
float quadDepth = 0.0;
if (volumetric && !showComputationTexture) {
if (volumetric) {
quadDepth = fract(vGlyph.b + time * animationSpeed * forwardSpeed);
vGlyph.b = quadDepth;
}

View File

@@ -253,9 +253,9 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
var result = vec4<f32>(brightness, cycle, depth, effect);
// Better use of the blue channel, for demonstrating how the glyph cycle works
// Better use of the alpha channel, for demonstrating how the glyph cycle works
if (bool(config.showComputationTexture)) {
result.b = min(1.0, localCycleSpeed);
result.a = min(1.0, localCycleSpeed);
}
return result;
@@ -311,7 +311,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
// Calculate the quad's depth
var quadDepth = 0.0;
if (volumetric && !bool(config.showComputationTexture)) {
if (volumetric) {
quadDepth = fract(vGlyph.b + time.seconds * config.animationSpeed * config.forwardSpeed);
vGlyph.b = quadDepth;
}
@@ -424,7 +424,7 @@ fn getSymbolUV(glyphCycle : f32) -> vec2<f32> {
var output : FragOutput;
if (bool(config.showComputationTexture)) {
output.color = vec4<f32>(glyph.rgb - alpha, 1.0);
output.color = vec4<f32>(glyph.r - alpha, glyph.g * alpha, glyph.a - alpha, 1.0);
} else {
output.color = vec4<f32>(input.channel * brightness * alpha, 1.0);
}