Ripped clothing with standard cutout shader?

I made a zombie using Adobe Fuse CC. It’s all rigged and all.

I went ahead and put th character into photoshop to rip up the clothing. The way I did that was I basically textured the opacity map of the clothing that the zombie was wearing. Once I decided it looked good, I took that opacity map and added a layer mask in the diffuse map of each clothing. That layer mask serves as an alpha channel. I copy pasted the opacity map and put it into the layer mask. I did this because unity reads transparency from the alpha channel of a diffuse (and can be set by changing the rendering mode of the standard shader to cutout). There isn’t a shader that unity has built in that supports opacity maps.

Now since I have done that, I also repeated this process for the zombies body. I masked out body parts that were fully covered by clothing and revealed body parts that would show under the ripped holes of the clothing. Again I used the standard shader > cutout renderer.

My question is, do I really need to mask out parts of the body that can’t be seen? That process is really tedious and I only did it because I thought “hey, maybe if I mask out parts of the body that is covered by clothing, it will conserve memory”.

But is this true? Even when setting some parts transparent with standard cutout?
I believe physics calculations, lighting and shadows would still be active, even on the parts of the body that are transparent.

If it doesn’t conserve memory, then is masking out the body even worth it? I plan to swap clothing for each character in my game so just switching the shirt would be really easy. If I went with the masking approach like I said, I would have to load the same diffuse texture of the body, but with different alphas to coordinate with the new clothing that you equipped - basically so you can see the skin under the rips of the clothing, if there are new ripped holes in different spots compared to the last clothing the character equipped.

And if the memory is still a concern, since I still have unnecessary polygons showing, can I remove geometry with an opacity map (or the alpha of a diffuse) in any 3D program? And before I can even consider this approach, how would I even swap clothes on a character if the geometry is already cutout for a different shirt? Because what I’m imagining is: I have one shirt, and the geometry of my body is cut out so that only parts of the body directly under the shirts holes can be seen. However the character will swap clothes. Now I need to re edit the geometry of the body of my character so that it fits accordingly with the holes in my characters new and equipped shirt.

From how I see it the only benefit of masking the skin underneath the clothing is to alleviate any skin mesh penetrating through the clothing during animations. Other than that - it seems like it would cause more overhead in the game than just leaving the skin alone. If there is no ugly, undesired issues with skin polys pushing through the clothing polygons, I wouldn’t mess with it.
I’m unfamiliar with workflows on clothing swaps - so your other questions will require testing.

Masked out areas are still there, using memory, just not getting drawn. You’re actually paying the entire memory cost and rendering cost of them being there still. The “real way” of doing this is actually remove the polygons under clothes. This isn’t a shader or runtime thing, it’s that a model of a long sleeve shirt is a model of a long sleeve shirt, forearms, hands and small bit of chest.

You can try to increase reuse by having a torso for short sleeves, long sleeves, unbuttoned, and no shirt and use the appropriate torso model for the shirt. Similarly most leg models often have no actual legs and are just pants with shoes floating at the bottom.

Well if that’s the case then that’s unfortunate. The problem with cutting the geometry of the clothing though is that it is too time consuming to get good detail.

The way I cut clothing is by sending my model to Photoshop, editing the opacity map of the clothing by using custom paint brushes to make cool ripped clothing effects. Then I take that opacity map and put it into the alpha channel of the diffuse so that Unity can work with my map by using standard cutout shader.

If I could actually rip up the clothing using maps that would be awesome but… Doesn’t look like any program I know of can do that. 3ds max or blender or maya, idk what would. Let me know if there is any program that can do this, or way I can efficiently rip up the clothing. This has stumped me for quite a while :confused:

It’s totally fine, I would even say common, to use this technique for adding holes or generally roughing up stuff. Just don’t think of it as a rendering optimization over an unblemished version. It can be an optimization over doing the same effect with geometry, and certainly an optimization of time to create the content.

1 Like

Agree - your technique is a good process, however masking the body parts under the cloth is inefficient in engine - although it masks unwanted inner penetration polygons.
Better to either remove the polygons under the cloth via modeling or improve skinning so skin beneath clothing doesn’t penetrate through.

I guess you can continue to mask polygons under cloth - to fix polygon penetration if it is happening, but it’s not the most efficient setup for engine performance.

As long as you match the bone weighting from the character to the pieces of clothing you won’t see interpenetration of skin and clothes happening. You can also use BlendShapes to help better wrap specific clothing to specific characters, especially in situations where the player can modify the players size and shape.

This is exactly what we did for the Sword Coast Legends character creator. I was one of two technical artists who worked on setting this system up. It allowed for tons of different armor and clothing sets to wrap well to huge characters and then have the same clothing set wrap onto a short character like a dwarf. We did not delete the underlying mesh, we kept the “nude” model underneath and layered clothing on top. No need for transparency masking of skin, etc.
This was also developed in Unity 4.7

1 Like

If 3D Max is an option to use - it has an awesome modifier called skinwrap which can derive skin weight data from another mesh. Essentially it can pull the skin weights from the character mesh and apply it onto the clothing. Awesome for clothing - though some skin weight editing will still be needed to make it perfect.
Best of all after skin weights are set on the skinwrap modifier click convert to skin button and export. Sit back and drink a cold one because you are saving hours on skin weighting.

2 Likes