Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: renderOrder of <Svg> meshes #1938

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

cyango
Copy link

@cyango cyango commented Apr 25, 2024

Why

component was showing a weird z-fighting on camera orbit

What

Fixed the render order of the meshes.

Discussion here: https://discord.com/channels/740090768164651008/741751532592038022/1227336884255064195

With this change the SVG with complex paths is showing correctly now.
Copy link

vercel bot commented Apr 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2024 2:53pm

@cyango
Copy link
Author

cyango commented Apr 27, 2024

After testing on more use cases, this seems to not be a good solution. Using renderOrder like that makes wierd behaviour of SVG showing on top of everything in the camera planes. Also not sure how to fix this.

This seems to show correctly and not overlap on other svg meshes
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

<shapeGeometry args={[shape]} />
<meshBasicMaterial
color={path.userData!.style.fill}
opacity={path.userData!.style.fillOpacity}
transparent={true}
Copy link
Member

Choose a reason for hiding this comment

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

Why remove transparent? It does affect grouping during sorting, but is that any relevant here?

Copy link
Author

Choose a reason for hiding this comment

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

From my experiments this was the only way i found to avoid the render order issues.

Copy link
Member

Choose a reason for hiding this comment

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

I'll investigate merging the geometries here. Definitely an issue with sorting, not z-fighting exactly.

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.

None yet

2 participants