How is character clothing done on mid tier+ games?

So I’ve begun working with a freelance artist on a set of RPG style characters with various clothing.

His preferred approach is to model character body, then separately model character clothing, layered on top of the body mesh. The clothing is, of course, modeled against the same skeletal structure, so animation is easy enough.

The immediately obvious downside is overdraw. The character mesh’s body still exists under the clothing, which adds to overhead.

He’s got some low end AAA experience, and from my work with him so far, he seems to be highly skilled and very capable. The work itself is beautiful.

My question, is he, being a freelancer, just shifting work to the programming side or is this a standard practice? Do games just ‘eat’ the overdraw or do they remove the polys under the clothing? Are there easy ways to delete those polys (assuming they’re being mapped to the same skeleton, could I delete body verts based on shared weight painting or something)?

That is a common way to do clothing when you want to do removable/changable clothing. You can ofcourse make some optimisations by splitting the torso up into seperate parts so that you can disable bits that are not imporant (such as the part under a t shirt when the t shirt is active) altho this will just add a lot more work to the rigging side of things.

Ultimately clothing is difficult and you will likely get a degree of overdraw from it, unless you do some fancy stuff to get around that. The alternative is doing them as textures (baked so that you get a bit of depth) but that will look worse and also add a different kind of overhead instead.

If the character model is optimised enough it wont cause too many issues having some overdraw, and ofcourse you can never completely eliminate overdraw in most games anyway.

If you dont need customisable / removable clothing, then he can model the clothes seperately on top and then combine the meshes and remove the polygons underneath the clothes, thatll work fine too.

But there isnt a single way its done. Some games take the perf drop and optimise around it. Some games do not draw the torso or any bits covered by clothes when clothing is active.

If you have to eat the perf, try setting the underneath polygons to the simplest shader possible (unlit or vert color) while the clothing is obscuring it (and back to the original shader when removed), but it wont do much to help that perf drop.

In AAA studios I had the opportunity to look around and sit in on during my sony scholarship, quite a few were using marvelous designer to create clothes with full physics sim, and then bring that back into a DCC app to optimise and adjust, and into engine finally for more adjustments and round and round that cycle.

Marvelous designer will be overkill for you though, dont bother with it

EDIT: these 2 articles I always find are good at summarising a reasonable workflow for mid tier graphics clothing in games :

https://80.lv/articles/game-characters-modeling-clothes-materials/

https://80.lv/articles/making-clothes-for-video-games/

Unfortunately most decent looking ones like that will use marvelous designer at some point in the pipeline just like those 2 do

EDIT 2: Interestingly kotaku have a article on how a lot of AAA games from pre 2016 would actually swap out the mesh or do other tricks to get around problem of taking and putting on clothes, but also gives a bit of an insight into how they generally approach clothing. So definately give that a read!

https://kotaku.com/why-video-game-characters-almost-never-remove-their-clo-1828182196

4 Likes

The clothing is being designed in marvelous. The guy is simply excellent with the tool. He has experience as a clothing specialist in low end AAA, so marvelous was his tool of choice.

The base body is 4k vert and 7k tri (including head), so I guess at worst I won’t be eating too much cost here. Most of the muscle work is baked into the normals.

Still, I’d like to optimize the work - so in terms of deleting body mesh programatically - what are my options?

The easiest way I could think of is to just custom mark verts for deletion and save a map of occluded body verts for each piece of clothing, but I don’t want to manually manage this.

There are two core problems:
1 - performance. I’d like to be able to run on low end PC and starting with really good work as a base would be nice.
2 - clipping. He’s willing to do the work correcting clipping, but it’d be nice to not need to bug him and just guarantee zero clipping.

If I’m only dealing with a few dozen pieces of clothing - manual management can work - but its less than ideal. Automatic detection and processing would really be ideal. So, how can this be done?

1 Like

I honestly have no idea how you would do automatic detection and processing, hopefully someone will chime in. But I think thats going to be a seriously big engineering task so I hope you have a number of developers at hand and lots of the project time to spare making that.

Otherwise I would say the age old line: Is it performing badly on target hardware? If not, no need to optimise it further.

If you havent got a lookdev sample build onto a target platform yet, then no point optimising ahead of time and making more work for yourself. Get it in engine, in a sample level of reasonably similar density and fidelity to what your previsualisation is and then test. You can use the unity snaps hd packs for quickly dumping a character into a proper level to test this.

FYI If he is already doing marvelous designer then I really dont think you need to worry, it has some serious optimisation options both in the program and on export. I think this is a classic case of until its a problem maybe you shouldnt worry too much about it? I doubt it will actually be a problem in the end unless your really trying to go high end, especially if your only worrying about a dozen or so pieces of clothing.

1 Like

You shouldn’t need any sophisticated solution to disable rendering of the underlying body, it is standard practice for character modelers to separate this as a gameobject so you can easily disable it when not necessary.

That’s not just for performance, it’s for the animations as well. Without an excessive amount of bones and sophisticated rigging, it is impossible to animate clothes over a mesh without bad clipping. Obviously, if there is mesh underneath that cannot be seen the solution is simply to disable it. And the simplest way is to make the body a separate mesh. That is a few clicks in your DCC. No programming necessary. So long as the border vertices share the same position, animations will not show visible seams.

@MadeFromPolygons_1 , unless I misunderstand or there is something I do not know, the case with Marvelous Designer is the opposite of what you are saying. Theh latest version of MD has some improvements for automatic retopo, but it still puts out non-game ready topology. It’s position in the character art pipeline is to produce high quality folds that can be built upon or baked from. But it does not produce game ready models.

this video shows what process for dealing with MD models is like (also a fantastic workflow for maya users):

If you want good overview of character rigging for games, check out polycount wiki and also search user mark_dygert post history.

Nah I sort of didnt explain it properly. You 100% cant put stuff from MD straight into a game as yeah that would be terrible. But on export to DCC programs it has some reasonable optimisation so that what you get inside the DCC is no different to optimising say a CAD model or a sculpted model.

You will definately have to retopo but I assume the person in question will be doing this as if they are using marvelous designer for games, they 100% must be exporting to a DCC program as next step of pipeline and I cant imagine anyone would do otherwise. Sorry I should have worded post better but I am at work so trying to fast type! :slight_smile:

EDIT: haha, that video is actually the one our clothing artist used when first getting to grips with a MD and maya pipeline ! It really is a decent video (so is a lot of lesterbanks stuff actually!)

1 Like

Is it really that hard to do? I don’t need perfection, I need something that doesn’t have false positive on occlusion test and identifies a set of vertices to clip.
4980314--485630--Unity_2019-09-19_09-53-18.png

This is the result of about a half hour of testing out a few simple methods for vert occlusion test. Maybe I’m nuts, but I don’t think getting from here to game ready acceptable levels is that far (backfaces are being drawn through here, as far as i can see there are no false positives here).

This isn’t complete, but unless there are serious problems I haven’t found I wouldn’t expect this to take more than 2-3 days to flesh out.

Nono I dont think actually doing it is the hard part, but getting that optimised and working alongside all your game logic and full game art (full levels not empty like you shown) is going to add uncessary overhead. Unless your talking about doing this in editor and not realtime? In which case go for it! Thats definately doable

I assumed you meant on the fly realtime work out based on clothes to stop areas rendering underneath dynamically, which yeah would definately be a big piece of engineering. But if you meant an edit-time tool for within unity, I 100% endose that idea and think it would be a pretty decent thing to make as you can reuse it for future projects with ease. God maybe Ill have a shot at writing one now come to think of it :smile:

I was thinking that I could like build ’ vertex occlusion map’ per clothing in editor, then apply them at runtime. Just write a script to process all the overlaying meshes in batch.

Applying wouldn’t be too hard I think. Whenever I spawn a character and get his clothes, modify the underlying mesh to clip the occluded vertices.

Need to remember this thread when I start working on my DayZ VR game

1 Like

I think you wont be able to simply apply it once as while the mesh deforms bits will show at the edges and potentially need a recalc, but if you say you dont need perfection then go for it!

I personally think depending on pose it will need to be recalculated which is the main perf issue I was imagining, but I am also probably overthinking as I tend to think of everything as scalable for the biggest baddest highest budget game which often is well outside scope of what is needed!

1 Like

Even a AAA (Is Bughemia consired AAA?) have problems with these kind of things

3 Likes

Yeah - I think I’m calling this the ‘false positive’ problem. I’m thinking that I need something on the ‘very conservative’ end so it doesn’t clip stuff thats visible. That pants example is also nice because the clothing edges are skin tight, flush against the mesh. Something with gaps (like a semi open sleeve) will be harder.

1 Like

Wow that is some awful clipping issues!

1 Like

That’s going to be another issue of doing this programmatically versus standard practice. You are looking for occluded vertices, what happens when vertex is no longer occluded because animation drives it to surface or beyond? No matter what, he gonna have to spend time painting weights for an impossible task. Only way to make is work is if its skin-tight body conforming clothes, or you simply disable the body mesh.

1 Like

But who knows what kind of constraints they’re working with on this. I can build the vertex clip maps in editor.

Again, I don’t need 100% perfection, I just need - better than nothing without spending tons of time.

Yeah I guess if you do that then even if it bleeds a bit it wont matter as you are not clipping the bits right at the edges so there is some wiggle room.

Honestly this is a pretty common problem even for AAAs and I am very interested to follow your progress on tackling the problem! You never know, you may come up with a solution that really is king, and then you can asset store the tech too as a bonus :slight_smile:

That said I am pretty sure you wont get much of a perf impact from the clothes so you could always just leave them as water-tight clothes that sit on top of the mesh and deform with it :slight_smile:

I could understand that the hat clip into the mask, Dayz have endless combos of clothing. But the mask that clips the face is a bit wierd.

1 Like

it’s probably user made content. Bohemia games are sandboxes for modders, basically. Hundreds of thousands of users. Any number of their fans could have created that, and conforming a face mask to hundreds of in game characters isn’t easy task for amateur modder.

low hanging fruit picking on that

2 Likes

Wow the mask clipping was so bad I didnt even notice the hat clip!

But yeah they have such an enormous amount of wearable items its understandible!

EDIT: even more so if it is user created as @BIGTIMEMASTER implies!