Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Sep 7, 2025

Related

What

Uses the newly established Drawables sorting mechanism to implement classic far to near rendering for all types of meshes.

Comes with image comparison tests for all archetypes where this is possible now, plus some unit tests to test the updated mesh renderer draw data buildup & drawable emission.

output_video.mp4

Bunch of limitations still:

  • no support for vertex color based transparency
  • no support for texture based transparency
  • ux wise color overrride for making things transparent isn't great: if you have multiple instanced colored differently then you end up having the same color on everything suddenly. Maybe needs Opacity property like images in addition?

pre-checkin:

Copy link

github-actions bot commented Sep 7, 2025

Latest documentation preview deployed successfully.

Result Commit Link
cdd2918 https://landing-nkwhlatf7-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

@Wumpf Wumpf added 🔺 re_renderer rendering, graphics, GPU 📺 re_viewer affects re_viewer itself 🍏 primitives Relating to Rerun primitives include in changelog labels Sep 7, 2025
Copy link

github-actions bot commented Sep 7, 2025

Web viewer built successfully.

Result Commit Link Manifest
cdd2918 https://rerun.io/viewer/pr/11132 +nightly +main

Note: This comment is updated whenever you push a commit.

{{1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {-1.0f, 1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}}
)
.with_triangle_indices({{0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}})
.with_triangle_indices({{0, 2, 1}, {0, 3, 1}, {0, 3, 2}, {1, 3, 2}})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes the winding order ccw so that if you make them transparent they don't look awful

/// Adapter shared with all tests.
///
/// Devices are not re-used since we want to isolate wgpu resources.
static TEST_ADAPTER: LazyLock<wgpu::Adapter> = LazyLock::new(|| {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could go into a separate PR. But on my Windows box this turned out necessary for executing the new tests - there seems to be some race condition in wgpu (or my driver?) when spamming creation of new adapters in parallel. (also, it's slow ;))
Worth deeper investigation from a wgpu pov, but need to isolate it first

Copy link
Member

@jprochazk jprochazk Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by: Recently saw a similarly shaped problem elsewhere, but on a different platform (loading libdrm amdgpu in parallel tests). The problem was calling dlopen/LoadLibrary in parallel. Putting it behind a lock was the solution there also

@Wumpf Wumpf force-pushed the andreas/mesh-transparency branch from 32d964a to db50197 Compare September 8, 2025 06:49
@Wumpf Wumpf force-pushed the andreas/re_renderer/sorting branch from 1d6ebe8 to 6e814ac Compare September 8, 2025 09:42
@Wumpf Wumpf force-pushed the andreas/mesh-transparency branch from db50197 to 521c697 Compare September 8, 2025 10:01
/// If there are multiple [archetypes.InstancePoses3D] instances logged to the same entity as a mesh,
/// an instance of the mesh will be drawn for each transform.
///
/// The viewer draws meshes always two-sided. However, for transparency ordering
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by: Are there plans to expose an option to disable this? I was a bit surprised that the meshes in the demo posted on socials were two-sided 🤔 (Sorry if this is already answered elsewhere and I missed it)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did miss it, it's even linked in the PR description #1741 disregard! 🤦

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I should also link the issue here

Base automatically changed from andreas/re_renderer/sorting to main September 9, 2025 09:47
@Wumpf Wumpf force-pushed the andreas/mesh-transparency branch from 521c697 to 573e8c8 Compare September 9, 2025 09:50
@IsseW
Copy link
Member

IsseW commented Sep 9, 2025

I noticed opacity of images in 3d is fully broken here:
Screenshot 2025-09-09 at 17 18 31

It is broken in the current version too, but you can see meshes through them:
Screenshot 2025-09-09 at 17 18 58

Since it was already quite broken I think it makes sense to put this in an issue.

@Wumpf
Copy link
Member Author

Wumpf commented Sep 9, 2025

good callout. I think we can mitigate it a bit by drawing the images last in the opaque phase until we do the right thing and put transparent images on the transparent phase & take their draw order into account. There's some trickiness on how we combine 2D draw order in 3D, but I'm sure we'll figure something out

@Wumpf
Copy link
Member Author

Wumpf commented Sep 9, 2025

filed an issue here

should link it in the code

@IsseW
Copy link
Member

IsseW commented Sep 9, 2025

I think these changes look good!

So after going through the checkboxes, and the things you wanted to note down in code this should be good to go.

@Wumpf Wumpf force-pushed the andreas/mesh-transparency branch from 720da4a to cdd2918 Compare September 12, 2025 11:36
@Wumpf
Copy link
Member Author

Wumpf commented Sep 12, 2025

URDF example works just fine with this!

happy.urdf.mp4

@Wumpf Wumpf merged commit 2718727 into main Sep 12, 2025
47 of 52 checks passed
@Wumpf Wumpf deleted the andreas/mesh-transparency branch September 12, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 🍏 primitives Relating to Rerun primitives 🔺 re_renderer rendering, graphics, GPU 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants