Skip to content

Conversation

@gkjohnson
Copy link
Collaborator

Related issue: #27349, #26916

Description

A quick try at enabling the Line2 to write the line segments depth buffer as capsule shapes so they more sensibly intersect with other scene objects. Unfortunately I'm not sure how to make this work cleanly with alpha-to-coverage to make sure the edges have clean AA without calling the previous intersect function along with the new depth function which would have performance implications. We could add a separate toggle, though, but I don't love that. I'll leave this here for now in case someone else has some ideas.

Demo here. You can toggle the new depth write with the "capsule depth" option.

Before After
image image

@mrdoob
Copy link
Owner

mrdoob commented Dec 22, 2023

Looks great! The problem is that we lose antialiasing?

@mrdoob mrdoob added this to the r161 milestone Dec 22, 2023
@mrdoob
Copy link
Owner

mrdoob commented Dec 22, 2023

/ping @WestLangley

@gkjohnson
Copy link
Collaborator Author

The problem is that we lose antialiasing?

The problem is that when using the function to determine capsule intersection it doesn't give the right information needed to determine alpha-to-coverage anti aliasing. The solution that came to mind was to run both capsule intersection functions but that felt messy / slow.

It needs a bit more work but it's possible there's another way to determine the AA value - I just need to think about it more. Here is what I was thinking for a more fully featured version of this if other are interested in picking it up:

  • AA + capsule depth write for world-space lines
  • AA + capsule depth write for screen space lines
  • Ensure capsule depth write is provided as an optional field on the material
  • Update raycasting to report the capsule surface as the intersection point

@mrdoob mrdoob modified the milestones: r161, r162 Jan 31, 2024
@mrdoob mrdoob modified the milestones: r162, r163 Feb 29, 2024
@mrdoob mrdoob modified the milestones: r163, r164 Mar 29, 2024
@mrdoob mrdoob modified the milestones: r164, r165 Apr 25, 2024
@mrdoob mrdoob modified the milestones: r165, r166 May 31, 2024
@mrdoob mrdoob modified the milestones: r166, r167 Jun 28, 2024
@mrdoob mrdoob modified the milestones: r167, r168 Jul 25, 2024
@mrdoob mrdoob modified the milestones: r168, r169 Aug 30, 2024
@mrdoob mrdoob modified the milestones: r169, r170 Sep 26, 2024
@mrdoob mrdoob modified the milestones: r170, r171 Oct 31, 2024
@mrdoob mrdoob modified the milestones: r171, r172 Nov 29, 2024
@mrdoob mrdoob modified the milestones: r172, r173 Dec 31, 2024
@mrdoob mrdoob modified the milestones: r173, r174 Jan 31, 2025
@mrdoob mrdoob modified the milestones: r174, r175 Feb 27, 2025
@mrdoob mrdoob modified the milestones: r175, r176 Mar 28, 2025
@mrdoob mrdoob modified the milestones: r176, r177 Apr 24, 2025
@mrdoob mrdoob modified the milestones: r177, r178 May 30, 2025
@mrdoob mrdoob modified the milestones: r178, r179 Jun 30, 2025
@mrdoob mrdoob modified the milestones: r179, r180 Aug 1, 2025
@mrdoob mrdoob modified the milestones: r180, r181 Sep 3, 2025
@mrdoob mrdoob modified the milestones: r181, r182 Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants