feat(antialias): AA geomètric a les línies amb edge attribute i smoothstep

Afegim antialias geomètric (sense MSAA) al pipeline de línies aprofitant
que la línia ja es construeix com a quad extruït a CPU:

- LineVertex: nou camp edge_dist (±1 als laterals del quad, 0 al centre).
- pushLine: extrudeix 0.5px extra per banda (AA_PADDING) per allotjar el
  fade sense menjar gruix nominal.
- line.vert: passa l'edge_dist al fragment com a varying.
- line.frag: alpha *= 1 - smoothstep(0.7, 1.0, |edge_dist|) — fade Hermite
  C¹ als bords, sense banding.

AA actiu per defecte. El toggle a runtime (F5) ve en el commit següent.
This commit is contained in:
2026-05-20 20:25:12 +02:00
parent 6063309932
commit b10f2da647
5 changed files with 150 additions and 119 deletions
+5 -2
View File
@@ -14,10 +14,12 @@ layout(set = 1, binding = 0) uniform UBO {
vec2 _padding; // alineamiento a 16 bytes
} ubo;
layout(location = 0) in vec2 in_position; // píxeles lógicos
layout(location = 1) in vec4 in_color; // RGBA 0..1
layout(location = 0) in vec2 in_position; // píxeles lógicos
layout(location = 1) in vec4 in_color; // RGBA 0..1
layout(location = 2) in float in_edge_dist; // ±1 als laterals, 0 al centre
layout(location = 0) out vec4 frag_color;
layout(location = 1) out float frag_edge_dist;
void main() {
// Píxeles lógicos -> NDC (-1..+1)
@@ -26,4 +28,5 @@ void main() {
ndc.y = -ndc.y;
gl_Position = vec4(ndc, 0.0, 1.0);
frag_color = in_color;
frag_edge_dist = in_edge_dist;
}