Is dynamic hair hardware intensive?

Hi

I would like to know if dynamic hair in unity is hardware intensive - As in; does it take up a lot of resources?

Imagine a semi-low poly game, with somewhat cartoony hair like below - physics based with a lot of movement. Does this drain resources or is it quite doable in 2019?

Seeing as the game you’re using as an example came out in 2005, yeah, that’s fine.

Well, i believe those are pre-rendered animations, right? Aren’t they just a pre-rendered layer, smacked on top of gameplay?

Whats a pre-rendered layer? And how do you smack something on top of gameplay?

In answer to your question though, yes its possible.

You could use the new animation rigging package to create a damping effect for the hair so that it moves as expected which may or may not be a more performant way of doing this. I think the new package uses c# animation jobs so it should be multithreaded

A compute shader + shader would be the other way to go about this

There are probably other ways too but those two spring to mind.

No offence but the way you are describing things tells me you are new to unity and probably game development as a whole, which also means you probably shouldnt be trying to do hair physics as the first thing.

You are right about me being very new to both.

I am the type of person that need to work on a single project, to learn. I just wanted to get an idea of how FPS heavy the vision was, before going that route - And you are right, i shouldn’t start off with the advanced parts.

What i meant by “pre-rendered layer” was not an attempt to sound clever. It was my way of describing a 2d animation being played, simulating 3d characters on the screen. That’s what it looks like to me. Long time since i played B&W2 so correct me if i’m wrong. :slight_smile:

Thanks for the answer, that it’s indeed possible.

Hey I think thats a good approach to learning, just wanted to make sure you know its going to be pretty intensive.

I (and most of the community here) love seeing people try to learn difficult or new things instead of asking for the work to be done for them, so I think what you are doing is great :slight_smile: And I can link you some tutorials to get you started that could help on this matter:

Note these are all different ways of doing same thing so try them all! Some easy some hard!

Joint based hair physics:
https://laboratoriesx86.wordpress.com/2014/07/27/joint-based-hair-cloth-physics-for-unity/

This one is for cloth but can be applied to anything including hair:
https://www.polygon-treehouse.com/blog/2017/8/4/howtoponcho

And if you wanted to go the compute shader route, this is a great intro to compute shaders:
http://kylehalladay.com/blog/tutorial/2014/06/27/Compute-Shaders-Are-Nifty.html

After that for the compute shader route you would basically use a compute shader to compute the bend of each hair mesh, and literally transform the model based on the spring physics sim. This way is hardest and requires a lot of math and physics research.

Good luck :slight_smile:

P.S personally I would try the cloth method first as it is easiest and looks really good for what it is! If you wanted literally individual strands of hair, joint based could be okay but wont be that performant, but would be what I would try first.

Then if no other solution is fast enough FPS wise, compute shader based deformation is the way to go

B&W 2 had no pre-rendered layers. They used GPU features, to render hairs in full 3D.
If you didn’t have appropriate GPU, your characters had no hair.

Thank you for the hints.

You are right - I was mainly thinking about those “story tellers/guides” popping up. I completely forgot about the “avatars” having hair as well, perhaps my GPU was not up to date at that time. Well i guess that also answers my questions, so thanks.

With a poly count that low?

I think that those characters just used a technique called “hair cards”. Basically, groups of hairs are painted onto a transparent quad or line of quads, and these quads are placed around the head and face so that it looks like the hair has volume. Those quads can be animated just like any other part of a model, including being made semi-dynamic.

If you zoom in on this model (not by me!) you can see the technique in action.

2 Likes

@angrypenguin
Yeah. I think they used that same technique you described, for Donkey Kong’s fur, in Donkey Kong Tropical Freeze.

no the hair card method is different from the shell based method, which dk tropical freeze (and start fox adventure) used.

Shells are more for fur though.

It’s an artistic and technical choice, you can pretty mush do both with it, but while fur is either card or shell, human hair is generally done with card due to the sophistication of hairstyle (since we are intimately familiar with them) and the amount of control card offer you.