Jump to content
  • Advertisement
Sign in to follow this  
Max Power

Identifying polygons of one mesh inside another mesh?

This topic is 887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I'm doing a lot of procedural mesh manipulation for a game with a flexible character generator.

 

The clothing I have for the base meshes (they are from Mixamo Fuse) produces a lot of clipping errors. I think I could do something about this by identifying the faces of the base body that are located within a specific clothing mesh, but I don't know what sort of algorithm can achieve this. As far as I know, every clothing mesh has a continuous surface without any holes. I want a body polygon removed when all three vertices are inside the clothing mesh. How can I tell?...

Share this post


Link to post
Share on other sites
Advertisement

Would probably be easier to just not render the base body when clothed, and only render hands, head, feet.. Requires splitting the base body but should be easy enough :)

Share this post


Link to post
Share on other sites

Generally you'd need to do a bunch of vertex-in-mesh tests which can be of wildly different cost (although not necessarily complexity) depending on what kind of geometry you're dealing with (eg if your geometry is concave or convex). If I had to what you outlined myself and I was using something like PhysX, I'd generate low resolution collision meshes that are "good enough" and let the physics API do the tests for me (hopefully on the GPU). PhysX returns points of intersection, which you could then use to extrapolate the faces to conduct more thorough tests. Alternatively you could roll your own BVH of convex collision meshes to quickly approximate which faces are likely the offending ones and then do more elaborate tests.

 

That being said, if I understand your description correctly, what you mean by clipping is essentially Z-fighting. In such a case (and I don't know the first thing about the format you're working with), have you tried tried good old polygon offsetting or simply scaling up the clothing mesh by a small margin? :) If this is the case, then removing some faces will not fix your problem, because your clothing and body geometries probably do not have perfectly overlapping faces, which would either generate holes in your body mesh or leave faces that are still partially Z-fighting the clothing.

 

Depending on a couple of factors, such as the type of clothing and the hardware you're going for, as a somewhat more general approach, you might try rendering your character model in two passes - first the base mesh and then the clothing mesh with either depth testing disabled or, if reading from the depth buffer is not available, by emulating depth bias in the shader (eg if what your favorite API provides is not sufficient).

Edited by irreversible

Share this post


Link to post
Share on other sites

Thanks for all answers and sorry for not replying. I have been very busy with the matter and I realised I am not quite ready for your suggestions yet. I made so many algorithms to create procedural and interpolated character meshes and clothing, but I need some more time to bring it all together in an actual run-time character generator with proper GUI and everything. Once I finished that, I can do some intensive testing with all kinds of combinations to see how big the problem really is and if perhaps only a few meshes cause problems, and whether those problems can be fixed with some manual editing inside blender. I will probably come back to this in a little while. Thanks again. This will be the most epic character generator in gaming history by the way :p

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!