From 9ddc32a4c37abaab8fb22e44a1fbacb225e89943 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 4 Dec 2024 16:17:33 +0100 Subject: [PATCH 1/3] Fix outlines for lines having more preceived aliasing since 0.20 --- crates/viewer/re_renderer/shader/lines.wgsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/viewer/re_renderer/shader/lines.wgsl b/crates/viewer/re_renderer/shader/lines.wgsl index 3f830e682d0d..9b0ff722fef1 100644 --- a/crates/viewer/re_renderer/shader/lines.wgsl +++ b/crates/viewer/re_renderer/shader/lines.wgsl @@ -370,10 +370,12 @@ fn fs_main_picking_layer(in: VertexOut) -> @location(0) vec4u { @fragment fn fs_main_outline_mask(in: VertexOut) -> @location(0) vec2u { // Output is an integer target, can't use coverage therefore. - // But we still want to discard fragments where coverage is low. - // Since the outline extends a bit, a very low cut off tends to look better. + // But we still want to discard fragments where coverage is too low, otherwise + // we'd not handle rounded corners etc. correctly. + // Note that `compute_coverage` may already give coverage values below 1.0 along the + // "main body of the line", not just the caps. var coverage = compute_coverage(in); - if coverage < 1.0 { + if coverage <= 0.0 { discard; } return batch.outline_mask_ids; From 883da4361c611d3ca5ab37e0332aeb363990aca1 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 4 Dec 2024 16:38:36 +0100 Subject: [PATCH 2/3] rust change to trigger a ci web build --- crates/build/re_types_builder/src/codegen/cpp/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/build/re_types_builder/src/codegen/cpp/mod.rs b/crates/build/re_types_builder/src/codegen/cpp/mod.rs index 24f91b5d9bf5..79da26aba780 100644 --- a/crates/build/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/build/re_types_builder/src/codegen/cpp/mod.rs @@ -2182,7 +2182,7 @@ fn quote_archetype_field_type(hpp_includes: &mut Includes, obj_field: &ObjectFie quote! { Collection<#elem_type> } } // TODO(andreas): This should emit `MonoCollection` which will be a constrained version of `Collection`. - // (simply adapting `MonoCollection` breaks some existing code, so this not entirely trivial to do. + // (Simply adapting `MonoCollection` breaks some existing code, so this not entirely trivial to do. // Designing constraints for `MonoCollection` is harder still) Type::Object(fqname) => quote_fqname_as_type_path(hpp_includes, fqname), _ => panic!("Only vectors and objects are allowed in archetypes."), From 9f7a138de7cb825ba0631db23f86b0ab7edb515a Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 5 Dec 2024 10:26:42 +0100 Subject: [PATCH 3/3] improve coverage handling for outlien masks of points (experimentation based) --- crates/viewer/re_renderer/shader/depth_cloud.wgsl | 7 +++---- crates/viewer/re_renderer/shader/point_cloud.wgsl | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/viewer/re_renderer/shader/depth_cloud.wgsl b/crates/viewer/re_renderer/shader/depth_cloud.wgsl index b2784acc7bb4..6ec20abab2e2 100644 --- a/crates/viewer/re_renderer/shader/depth_cloud.wgsl +++ b/crates/viewer/re_renderer/shader/depth_cloud.wgsl @@ -202,11 +202,10 @@ fn fs_main_picking_layer(in: VertexOut) -> @location(0) vec4u { @fragment fn fs_main_outline_mask(in: VertexOut) -> @location(0) vec2u { - // Output is an integer target, can't use coverage therefore. - // But we still want to discard fragments where coverage is low. - // Since the outline extends a bit, a very low cut off tends to look better. + // Output is an integer target so we can't use coverage even though + // the target is anti-aliased. let coverage = sphere_quad_coverage(in.pos_in_world, in.point_radius, in.point_pos_in_world); - if coverage < 1.0 { + if coverage <= 0.5 { discard; } return depth_cloud_info.outline_mask_id; diff --git a/crates/viewer/re_renderer/shader/point_cloud.wgsl b/crates/viewer/re_renderer/shader/point_cloud.wgsl index 1d9c441b6468..0cd1cf312e42 100644 --- a/crates/viewer/re_renderer/shader/point_cloud.wgsl +++ b/crates/viewer/re_renderer/shader/point_cloud.wgsl @@ -173,11 +173,10 @@ fn fs_main_picking_layer(in: VertexOut) -> @location(0) vec4u { @fragment fn fs_main_outline_mask(in: VertexOut) -> @location(0) vec2u { - // Output is an integer target, can't use coverage therefore. - // But we still want to discard fragments where coverage is low. - // Since the outline extends a bit, a very low cut off tends to look better. + // Output is an integer target so we can't use coverage even though + // the target is anti-aliased. let coverage = coverage(in.world_position, in.radius, in.point_center); - if coverage < 1.0 { + if coverage <= 0.5 { discard; } return batch.outline_mask;