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

StaticGeometryGenerator shouldn't automatically traverse children meshes #442

Open
minitoine opened this issue Jul 18, 2022 · 5 comments
Open

Comments

@minitoine
Copy link
Contributor

Hello,

meshes.forEach( object => {
object.traverse( c => {
if ( c.isMesh ) {
finalMeshes.push( c );
}
} );
} );

I see in your code that when you create a StaticGeometryGenerator with a SkinnedMesh, for example, you traverse the object to gather children meshes. Shouldn't this behavior be optional?
I mean, you could want to build a static geometry of a skinnedMesh without incorporating children meshes of the scene graph.

@gkjohnson
Copy link
Owner

Hello! Can you describe your use case? Meshes are not typically included as children of other meshes / skinned meshes.

@minitoine
Copy link
Contributor Author

For my specific case, I’m developing a custom editor (such as three editor) where it is possible to manipulate SkinnedMeshes via an ik system. To ease the creation/manipulation of ik chains, I’m attaching small target objets to specific parts of the skinnedmeshes.

As I am also using a custom rendering engine to render the scene as SVG, I need the StaticGeometryGenerator (was using ThreeBufferUtils before your class) to apply the bones transform to the geometry and create a HalfEdgeStructure from that.

Since the geometries get merged in the generator, I do have artefacts in my HalfEdgeStructure.

Of course, I can detach the objects before generate and reattach them afterwards, but I would say that you should provide the option to generate a new buffer for the skinned mesh only, even if it’s not the default option.

I can create a PR if you want.

@gkjohnson
Copy link
Owner

gkjohnson commented Jul 18, 2022

Perhaps it makes sense to ignore any meshes that are set to visible = false, then, to support a use case like this? What do you think?

@minitoine
Copy link
Contributor Author

Hello. That might be a solution, but don't you think it's going to make things more complex than a simple flag/option?

@gkjohnson
Copy link
Owner

Probably - I was just suggesting another alternative. I think we can add a StaticGeometryGenerator.recursive flag that toggles this behavior if you want to make a PR!

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