Hide specific mesh faces?

Hi there, I’m looking to hide or flip the normals of faces underneath clothing to combat the problem of mesh faces interpenetrating with the clothing.

I could flip them in 3DS Max before exporting, sure, but I want to have interchangeable clothing so the solution needs to be more modular and on-the-fly.

I could have a ray shoot from each face and if it touches clothing have it hide of flip itself, but I’m not sure how to access this information. Is there a mesh C++ api? Or is there a material-based thing I can do?

Thank you!

As a material-only solution, you could ensure the vertices for all the faces you want to hide have some exact vertex color value and then have an Opactiy Mask which does an If node for that exact value. The pixel shader will give you the average of the 3 verts, so it should only match if all 3 verts have the color.

Alternatively you could use WorldPositionOffset to move the vertices behind the camera which is quicker as the verts would be culled and the pixel shader would never run, but that has the disadvantage that it operates on a vertex level rather than a triangle level.

Hi JackP, this only works if I know what the vertices are beforehand, correct? In such a case I’m just pre-determining what will and won’t be visible. I can just flip the faces in my 3d package. I don’t believe this accounts for the clothing being interchangeable. Am I correct in that assessment?

Correct. It’s not the general solution you’re looking for. I suggest you re-post your question specifically about triangles penetrating clothing and perhaps someone from animation team has a better suggestion.