Download

Hair Rendering Simulation test

Hi Guys,

Thought it might be time to start sharing some screenshots from my latest experiment. Hair Rendering. Theres not a lot to look at for now. Mainly just rendering the strands of hair. The input file consists of 160 control strands that are then tessellated to produce around 40,000 strands of hair. Currently it does take a fairly hefty hit to the rendering, but this is mainly because it is highly unoptimized. There are a lot of places I can improve.


Primary strands only


Wireframe view of primary strands


Primary and Secondary strands

Currently using UNLIT lighting so thats why there is no real detail. I will probably have to code in a new lighting mode to get good lighting on the hair, also struggling with Aliasing.

Plans for the future:

  • Simulation of hair - Using a similar approach to APEX cloth.
  • Hair editor within the Unreal Editor to allow individual tweaking of things such as Baldness, Density, Color, Curliness, etc.
  • Lighting model for the hair

I will continue to update this thread with new pictures and videos as I make progress.

Nice work Ehamloptiran!

Implementing realistic hair is probably one of the most difficult things you could’ve chosen :smiley: All the weird reflections, refractions and interactions of light with every single hair. Not to mention the physics. My computer graphics professor once said, if you managed to implement a hair sim that was robust, flexible, looked and behaved realistically and run with good performance you’d either get a ton of money or recognition, or both :cool:

Good luck and keep us posted!

Nice man! Please make it happen :smiley:

This is very cool!

Hair is something we’re struggling with right now so I’m excited to see what you come up with :slight_smile:

Thanks.

Haha I know, I am sucker for punishment it seems. But it has also been a good learning exercise. There is still a lot of work to be done, even just with the rendering. Alot of chances to optimize too since I haven’t been worrying about speed at this time. In the end there will be an aggressive LOD implementation as things will start to get very slow if you have multiple characters will full hair setup (or fur). Where it will reduce the number of strands being draw while simultaneously increasing the size of strands to hide any gaps, then eventually swapping it out with a low poly hair model when distant. This should help with speed greatly.

I am hoping that I can get this released as a plugin someday, but it will require a few additions to the engine that will need to be accepted by Epic before this would be able to become a plugin. Especially if I go down the route of a separate lighting model just for the hair.

Looks pretty nice. Probably going to need special/better anti-aliasing than UE4 has now. This should work: Humus - 3D so hopefully when they get to supporting transparency/different lighting models the above will be included (different lighting models should be able to be supported without a plugin, theoretically). Nice work so far though!

Good find, thats some nice AA. I will take a look at that when the time arises.

Have you looked into Tress FX? ATi put the entire code repository up on their site and it probably would help you out a lot. Let me know if you have any questions about it and I will see what I can do to help.

Thanks I’ll take a look at that, especially considering its a deferred solution.

Hey Ehamloptiran, this is awesome - between this and the fluid surface actor contributions, well the community is in your debt. Although, I for one would love to see realistic beard physics before undertaking significant AA changes.

Agreed, AA is a long way off, the sample that Frenetic Pony pointed to, looks great and i have put that into my research folder for later investigations and integration, right now, simulation is top priority. I have looked at the TressFX code linked to by Samsterdam and its great, I should be able to integrate a lot of that while keeping the tessellation for finer details, which will actually simplify the input format, allowing for a lot more flexibility like beards and full body fur to be created easily, even from within the editor (Considering the algorithms they use are essentially game ready).

Hopefully I will have some nice surprises by the end of this weekend.

My humor doesn’t come across very well over text, but the fact you’re jumping into this with both feet in earnest, well… if you’re ever in the bay area, let me know, I’ll buy you a few pints :smiley:

Update, partially implemented AMD’s TressFX hair system. It can make very nice looking hair running at very sensible frame rates, but has some very limiting factors making it hard to integrate into a plugin, I’ve already made a number of additions to the engine to allow for it, and due to the way it renders it essentially has to be the last object rendered in the scene, making it very hard to put into a component.

The screenshot below is basic rendering, no lighting (As this will require a custom lighting path due to no depth information, which will come next). It utilises OIT (Order Independent Transparency) to ensure that fragments are rendered back to front for correct blending. There is no anti aliasing in place yet (TressFX has built in support for that, using a similar way that Frenetic Pony linked to earlier. Just need to implement). But even at 57,000 strands it still renders a lot faster than the previous implementation I tried and I still have the choice to utilise Tessellation to improve the quality of the hair.

839c2de992b0780384ecf7bd6d5208214a0bed18.jpeg

Very interesting!

Looking forward to seeing this develop, keep up the good work!

@Ehamloptiran, awesome concept here!
At first I imagined the model on the first screen suddenly nodding and shaking, and then dubstep appears (wub-wub) combined with all the hair waving around. :crazy:
Yep, that would end up with a decent hair spray commercial. :wink:

TressFX in UE4 sounds awesome to me :smiley: Keep up the awesome work!

Got basic lighting working, using only the primary directional light, since I am compositing the hair in the translucency pass, basically need to do standard forward rendering lighting/shadowing. Was unable to get it to work in the deferred pass without looking rubbish. The lighting model is Kajiya with dual highlights.

The hair emits shadows to the world , but is not currently self shadowed. Still trying to figure that part out.

Amazing work Ehamloptiran. You’ve ported FluidSurface just in few days and now TressFX… you’ve got pretty big knowledge base i see :slight_smile:
What have you worked on before? Is there a portfolio site somewhere or anything else? :slight_smile: