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

panics when I try to pick & mesh glitch #395

Closed
GodGotzi opened this issue Sep 15, 2023 · 5 comments
Closed

panics when I try to pick & mesh glitch #395

GodGotzi opened this issue Sep 15, 2023 · 5 comments

Comments

@GodGotzi
Copy link

I display some custom meshes with Trimesh from three-d-assets crate.

    let trimesh = TriMesh {
        positions: Positions::F64(positions),
        colors: Some(colors),
        normals: Some(normals),
        ..Default::default()
    };

create my model

    let model = Gm {
        geometry: Mesh::new(context, &trimesh),
        material: construct_filament_material(),
    };
pub fn construct_filament_material() -> PhysicalMaterial {
    PhysicalMaterial {
        name: "default".to_string(),
        ..Default::default()
    }
}

The rendering works just fine:.
At the time I call the function pick with this geometry I got this panic

image
thanks for your help

@asny
Copy link
Owner

asny commented Sep 19, 2023

Thanks for reporting 🙏 Just wanted to let you know that I'm looking at it. However, I can't reproduce (it's probably a difference in shader compilers, some compilers are more aggressive to remove unused variables), but it sort of makes sense. The color attribute is not used when picking, so it shouldn't be sent.

@asny
Copy link
Owner

asny commented Sep 23, 2023

@GodGotzi Can I get you to test if #398 fixes the issue?

@GodGotzi
Copy link
Author

GodGotzi commented Sep 23, 2023

@GodGotzi Can I get you to test if #398 fixes the issue?

works

Thank you for quickly resolving this issue; it now works smoothly. However, I have another question that is not related to the issue at hand. Parts of my meshes occasionally glitch, and I'm not sure what could be causing it. Once again, thanks for promptly fixing the problem.

glitch:

2023-09-23_22-51-05.mp4

I am building my own slicer for 3d printing to display gcode.
What I think is happening is that some layers get transparent and now I am able to see the purple infill.
Is this some sort of mechanism to get more performance for the renderer or is that something else?

@GodGotzi GodGotzi changed the title panics when I try to pick panics when I try to pick & mesh glitch Sep 23, 2023
@GodGotzi
Copy link
Author

So I started to change my depth buffer values from the default of 24, but with any other bit value the application crashes. For example with 32

@asny
Copy link
Owner

asny commented Oct 7, 2023

Thank you for quickly resolving this issue; it now works smoothly.

Great, thanks for testing 👍 I'll make a new release with the fix.

Parts of my meshes occasionally glitch, and I'm not sure what could be causing it.

Could it be that the triangles that you're trying to render are smaller than a pixel when you zoom out? If they are, then some of them will not be covering the center of a pixel and will not be drawn and it then looks like there's holes in the mesh. You could try to use MSAA (see the multisample example) but I'm not sure that will solve all issues. I think the good solution would be to adjust your triangle mesh.

So I started to change my depth buffer values from the default of 24, but with any other bit value the application crashes. For example with 32

What did you change exactly, this value? It works for me, so I need more information to be able to debug that. Also please make sure that your system support 32 bit depth buffers.

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

No branches or pull requests

2 participants