Hey, I'm Simon and I made a game!! :)
Support me: BUY & Demo on Steam

This article was updated. Jump to Update 1.

You can choose!
Read the article or watch the movie. Both contain (almost) the same content.

I didn’t embed the video directly to avoid any tracking from Google and complications with the DSGVO.

I stumbled across this funny video and after a short period of lolling I was thinking… maybe this isn’t a bug at all!

What we see here is either the result of a little torture fun of an opposing Mafia family or it’s a neat little trick to avoid clipping between hat and hair (only that the guy in the video has no hat – which is the actual bug).

Here is how it looks when you just put a hat on a Mafia II guy:

What can we do about the clipping? We already saw the solution in the first video. They just compress the upper head a bit:

But how did they do it? At first I thought it’s a vertex shader pushing the vertices a bit but I couldn’t find proof by studying the draw calls.
So I got some mod tools (M2Toolkit and M2CharMC), extracted the meshes and found something! There is a bone called “HairScale” in the rig and this is how it looks when scaling it up and down:

Voilà! With that, we can put the hat on, scale the hair bone down and schwups, our little Mafia men is happy!

I hope you liked the article! Feel free to follow me on Twitter, check out my Artstation and/or leave me a comment.

Update 1

Found this video Inside Disco Elysium – graphics studies which reveals a similar technique in Disco Elysium: Here, parts of the body are scaled depending on the cloth.

Putting pants on makes the legs thinner (orange outline):

Source: Disco Elysium

Adding a shirt scales torso (orange outline):

Source: Disco Elysium

Interesting: Putting a jacket on top of the shirt, makes the shirt scale as well (blue outline). Also look how the feet deforms when a show is put on it (orange outline, in the shot only 1 shoe is worn):

Source: Disco Elysium

There is one open question, though: How exactly does the scaling work? In the Mafia game, a bone was scaled.
For Disco Elysium, we either have several additional bones as well, or it’s done via vertex shader (pushing the vertices inward along their normal orientation). If so, I guess the body is painted with different vertex color masks to allow for scaling different parts (e.g. legs) and leaving others untouched (e.g. torso).
Or could there be another solution? What do you think?

2 thoughts on “Mafia II – Hat vs. Hair

  1. Dustin Aber

    Simon, I just wanted to thank you for this great blog. I have sent it to my students over many years so they can see the innovative way artists in industry solve problems. It is such a great resource, I hope you keep it up!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *