mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user