Vertically offsetting glyph columns by a random fraction of the height of a glyph when the volumetric mode is on, to prevent odd visual alignments

This commit is contained in:
Rezmason
2022-09-30 00:11:22 -07:00
parent 7e2acde979
commit d85594a46c
2 changed files with 6 additions and 0 deletions

View File

@@ -34,6 +34,9 @@ void main() {
vDepth = quadDepth;
}
vec2 position = (aPosition * vec2(1., glyphVerticalSpacing) + aCorner * vec2(density, 1.)) * quadSize;
if (volumetric) {
position.y += rand(vec2(aPosition.x, 1.)) * quadSize.y;
}
vec4 pos = vec4((position - 0.5) * 2.0, quadDepth, 1.0);
// Convert the world space position to screen space

View File

@@ -388,6 +388,9 @@ fn computeEffect (simTime : f32, isFirstFrame : bool, glyphPos : vec2<f32>, scre
// Calculate the vertex's world space position
var worldPosition = quadPosition * vec2<f32>(1.0, config.glyphVerticalSpacing);
worldPosition += quadCorner * vec2<f32>(config.density, 1.0);
if (volumetric) {
worldPosition.y += randomFloat(vec2(quadPosition.x, 1.0));
}
worldPosition /= quadGridSize;
worldPosition = (worldPosition - 0.5) * 2.0;