top of page
Writer's picturesamoyedbob

REAL-TIME HAIR RENDERING SYSTEM

Updated: Dec 20, 2021

We did a lot of study on the hair strands' real-time rendering. Especially for the animal characters, the fur is very dense compared with human hair. A few bunches of the long hair of humans look very thick if you groom them in one way direction and make some styles. But the short fur with fewer strands won't cover all the skin, the skin will be exposed, that looks very hairless and hilarious.

Instead of rendering mesh cards as hairs which always be used in game development, we tend to use a hair simulation system. because that will make the hair blow up when the wind passes by or will flow like the real hair when the character is moving.



Hair Works

There are two kinds of hair simulation systems. one is the Nvidia Hair Works system, the second one is the UE5 Grooming system.

Before the Grooming system was released out. we did a lot of study on the Hair Works system. It does not support ray tracing and rectangle lights, only support point light, and the version is stopped updating at version 4.21, you have to compile the UE4 file by yourself. That is not perfect but good enough. At first, you need to use Maya's Shave Plugin to shape the guides, the plugin will generate curves based on the vertex of the mesh which is a must for Hair Works.



And then export the guides using the Hair Works plugin in Maya. After importing them into the UE4, we created a very heavy fur containing 3million hair strands. It's so heavy that's hard to catch up with the animation when it's on live streaming. but when you render out the video, it looks fine.




Grooming system in UE4

So we change to search the other way to simulate the fur. Thanks to the Epic team, they integrated the grooming system into the UE4 eventually. the surprise is that we could get a more realistic result and more ray-tracing effects without any delayed.



But there is another challenge that we can't render the fur's color based on the root of the mesh. then I go to check the official example Meerkat found that if we use Xgen to modify the guides won't work which is a basic fur tool in Maya that stopped serving in 2006, they recommend we use the plugin Yeti. which is really a good tool that you can export the root color as default. after that in the UE5, just link the root and assign the root material for the fur.



more than that you can also set the group information in the Yeti plugin, which allows you to have different groups of furs when you imported into the UE5. that make the possibility that making the fur have different styles in different parts, such as my character need a dense and short fur on the face, but not that dense fur on the back of his head. Using groups we can treat them separately, and reduce unnecessary fur in invisible parts.




Material Programming

Setting up the material of the fur in UE5 is also a big challenge. At first, there were some "face normal" problems. we can't find the right tangent value for the hair. The hair strand is so special that the reflection and refraction are totally different from other geometry because the shape of the strands is special. and also We need the fur tint color with texture, but sometimes we need it tints a pure color like black or white. so we should set a toggle button somehow. Luckily we found this video, who is a hair expert in Russia. we learned a lot from him. and we finally made out the complicated material programming.



Rendering

The last thing is rendering. There were a lot of incidents that occurred. The most important thing was that if we put more than 2 characters with fur into the scene. That will be a disaster. The fur will be cut off by shadow somehow and flicking all the time.



the solution is set r.HairStrands.Voxelization.Virtual.VoxelWorldSize to 1.

The official solution is to set the value to 0.1 as default. But in my case is 1. and there are other parameters I set up in my projects listed as below.

r.HairStrands.Voxelization.Virtual.VoxelWorldSize 1

r.HairStrands.Voxelization.Virtual.VoxelPageCountPerDim 16

r.HairStrands.Voxelization.Virtual.ForceMipLevel 0


After all these difficulties, we got the perfect real-time rendering finally. we are really happy with our efforts. and you can find more details in our short movie. please check our project page!












24 views0 comments

Comentarios


bottom of page