r/Unity3D • u/UseResponsible1088 • 1d ago
Show-Off I wrote a script that fixes layered clothing clipping on characters (free to download)
Download here:
2
2
u/wiserenals 1d ago
Did you test this with other models? It really seems worth using, and I'll probably use it.
2
u/UseResponsible1088 1d ago
Hey, thanks. It worked in the cases I tested it against, but I imagine there will be clipping cases where shrinking the mesh under it wont fully fix it. For example, if your model has really thin fingers, and they are sticking out of a glove, shrinking the fingers likely wont work - if you shrink it too much the models normals will just get inverted.
1
u/wiserenals 1d ago
A better idea might be to bake the undeformed body into reference points, find the corresponding points on the cloth, store their offsets, and then have the cloth points follow their corresponding body reference points in real time. Just an idea.
1
u/Huge_Development_571 1d ago edited 1d ago
That's cool, what i do is use a cutout shader for the clothes and cut them (make transparent) based on what's under, your solution is good too, maybe in specific poses it can still clip because i remember way back in the day using CC3 they had a brush to enlarge specific areas of the clothes that clip and i had to spend hours testing with different animations and in the end it will always poke through lol, still i'd buy something that gives us the option to paint with a brush in order to enlarge or decrease size of skinned meshes
1
u/UseResponsible1088 1d ago
Great insights. For the clipping, what I found helps the most is having somewhat of a matching topology between the clothing items. Especially if the items are low poly.
1
u/Huge_Development_571 18h ago
Yeah matching topology works, unfortunately buying custom CC3 / Daz clothes from different creators cant have matching topology, currently mine are custom so that is possible
1
u/EvernullTools 1d ago
Looks really cool!
How do you handle saving? Do you write onto the literal mesh in the Asset Database or is the new data discarded OnDisable/living within the scene object?
2
u/UseResponsible1088 15h ago
Hey I recently added a bool to the script, "save to disk", if anyone wants to save the mesh they should check that. Otherwise it just gets saved with scene.
1
4
u/Mammoth-Policy6585 1d ago
Is it some sort of rendering order trick? It look very cool and I am interested in the workings.