RealTime Hair Rendering (Shader and 3D Model)

Unity3D Hair Rendering and simulating hairdressing and hairstyles

Simulating real world hair colors and women’s hair coloring styles

Hair rendering in 3D real-time environment is one of the most difficult challenges due to its huge complexity. There has been a lot of work in this field, but there is no single method, shader, and general prefabricated material to implement it. every project The basis of hardware and software needs and budgeting is different. For example, hair rendering in computer games is very different because hardware resources must be allocated to the processing of other parts of the game, such as artificial intelligence, game logic, networking, sounds, etc at the same time. In this particular project, I assigned most hardware resources to 3D rendering and graphic processing.


The requirements of the project at the beginning were as follows:
1-Render hair in a real-time environment and in the most realistic way possible in your time and available software and hardware features.

2-Creating and simulating a hair color system in the closest state to the real world with the ability to implement and simulate a variety of Amber hair color models

3-Wrist pre-made hairstyles automatically on scanned 3D heads

4-Dedicated display in VR glasses
Each of these was a major challenge, and for each, I developed solutions and methods that I will explore below.


1-3D modeling Hair And Realtime Render

One of the most difficult challenges for me and my 3d modeling team was making hairstyles 3d models similar to the real hairstyles used in modern hairdressing salons and displaying them with the best quality and reliability for the audience. Also in terms of hardware, graphics memory limitations And rendering should have been considered. To solve this problem, after researching the existing real-world hairstyles, specific categories were created for these models, and for each category, the budget of the 3D model was determined in terms of the maximum number of triangles and the maximum budget for shaders pass. Simultaneously with managing the 3D modeling team, I also did the required research and shader programming. In addition to rendering hair and shadows, the desired shader should be able to simulate a variety of available hairdressing colors.
The system of combining colors and displaying Ombre hair colors was also made with real-world research and a survey of professional hairdressers.


2-Shader Development

I developed the main hair rendering shader by Unity Shader language. This Shader consists of different layers and sections for rendering and color simulations.
Light and shadow rendering section, hair color section, and amber and mesh simulation section. To have as much control as possible, I asked the modeling team to make each 3D hair model with two or more layers of specific UV data. In each hair shader, I used these UV layers to render a specific part of the hair rendering and its layers. These parts include the rendering section of the main hair texture (transparency of hair strands) and the color – the default rendering section and the amber and mesh colors rendering section.


3-PostProductions

One of the most important and heavy items in terms of processing load in transparent objects and layers that are on top of each other is anti-alloy stone. Render textures of transparent layers of hair will be without the use of pixel anti-aliasing and quality. In this project, I used MSAA and TFAA simultaneously. Created. I also used Screen space ambient occlusion due to its high speed and good quality to create contact shadows



4-Align and fit Hair Models With any 3d Scanned head

One of the hardest challenges for me was to wrap and place any 3D hairstyles on many different 3D scanned heads.
To do this, I considered 32 main points for each hair that was used with Skin Mesh, these points’ task was to control the shape and form of the 3D model. Also, 32 hair points were placed on the head model by the modeling team. Finally, the hair points and the head model are matched and the hairstyles will place on different heads.



5-VR Presentaion

There were no extra choices in choosing the VR headset model, and finally, I chose the HTC VIVE 2 headset from Oculus Rift and HTCVIVE to have a higher resolution than my peers during the project for VR display.

Rendering the hairstyle on your monitor was a processing challenge. Now imagine that this rendering had to be rendered for HTC VIVE 2 VR glasses with almost doubled resolution.it needs to render twice from different directions, while the project needs were that the quality of the display should not be reduced. To prevent frame drop in VR mode, I made changes to the shader and the 3D mesh model of the hair, which resulted in a rate of 20 to 30 frames per second at a resolution of 3840X1080.

Rendering the hairstyle on the display monitor was a processing challenge. Now imagine that this rendering had to be rendered for VIVE 2 VR glasses with almost double the resolution and from two directions, while the project needs were that the quality of the display should not be reduced. This would almost double the processing load. To prevent frame drop in VR mode, I made changes to the shader and the 3D mesh model of the hair, which resulted in a rate of 20 to 30 frames per second at a resolution of 3840X1080.

6-Crowns and Dresses

One of the project’s needs was to show various crowns for each hairstyle with realistic rendering and show different clothes for each body style. For this, I consider special places for the crown placement for each hairstyle. The user could easily identify and insert special crowns for each hairstyle and put the hairstyle in the crowns.
In the case of clothing, the 3D model of the body was built in the standard categories, and clothes were made based on the body’s 3D models.

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment