One of the most complex problems in real-time games, virtual production, and in particular digital humans, is simulating hair that moves and looks realistic.
In December, Epic released v4.24 of UE4, and for artists working to create more believable characters, creatures, and digital humans, it offered the first look at Epic’s new strand-based hair and fur system. The system enables artists to simulate and render hundreds of thousands of photoreal hairs at real-time frame rates.
Charles de Rousiers is a former software engineer within the Frostbite engine team at Electronic Arts, based in Sweden. He was one of the key engineers on the project and below, with his help, we have an exclusive video looking at the new Hair system in action.
We sat down also with Gaelle Morand, who is a Senior Technical Artist at Epic Games and formerly a Grooming Supervisor doing Look Development & Lighting at Industrial Light & Magic for 5 years in San Francisco. As an experienced artist, she has been impressed at how quickly the new system has been developed and how much this experimental early release can do. While Charles de Rousiers has been quite modest about this leap in real-time performance, after examining the new system, we agree with Morand’s statement that what, “Charles and the team have implemented is pretty spectacular.”
Traditionally hair in real-time has been created using card-based rendering or other approximations. In a card-based workflow, a small number of large flat sheets are used to give the approximate shape and motion of a much larger number of individual hairs. Using the new Hair Rendering and Simulation features in UE4.24, there is now the ability to render each individual strand of hair. By rendering each individual hair, artists can massively improve the visual fidelity of real-time simulated hair.
Some 5 years ago, NVIDIA had provided a hair solution called HairWorks. The HairWorks toolset consists of DCC tool integration and real-time rendering and simulation for hair. Hairworks is no longer supported by the newer UE4 releases. At the time of its release, Hairworks was helpful, but it was very much a black box and somewhat difficult to manipulate.
Recently Epic Games bought ‘Shave and a Haircut’, from Joe Alter (who also joined Epic in Nov. 2019). Perhaps surprisingly, the new Epic hair tools that the company is shipping with UE4.24 do not involve that software at all. Since acquiring Shave and a Haircut, Epic Games has made it’s v9.6 Maya plugin and associated shaders available on GitHub as both source code and compiled binaries. These are free for everyone to use under the Unreal Engine 4 EULA. It might be reasonable to think that Shave and a Haircut would now be a key part of the UE4 solution, but this is not the case. Epic knows that the market for grooming tools is not that large and rather than dominate that space, the team is keen to work with a range of companies such as Peregrine Labs and their Yeti software. Epic could clearly nearly wipe out these smaller companies with its massive R&D budget and market clout, but Epic is very much focused on fostering long term support of these much smaller specialist hair and groom companies.
Epic is currently testing their new Hair implementation with grooms from Ornatrix, Yeti, as well as from Houdini. Both Ornatrix and Yeti have ‘plug and play’ Alembic exports to UE4’s new Hair, but studios are not limited to these packages. In fact, anything, “can now get into Unreal,” explains Morand. “The groom could be Haircraft from ILM or Barbershop from Weta Digital – so long as it conforms in terms of the Alembic export and the set of attributes that we’re looking for upon input. When UE4 gets the groom in engine, UE4 is looking for a set of standard attributes that really make up a groom,” she adds. A groom is more than just a set of curves – there are key attributes that matter, for example, the width and color, and this set of metadata is all vital.
A side benefit of Epic’s purchase of Shave and a Haircut is related to patents. This industry segment of the market has been a patent minefield, with some software unable to be sold in the USA as a result. Now with Epic owning Shave and a Haircut’s patents and having deep (legal) pockets, the company has waived any Patent issues it is involved with and this clears the way for Yeti and Ornatrix to be used more widely. Both companies are now safe in the knowledge that they are shielded by Epic, and, “they can commercialize globally in a way they had not been able to previously,” adds Sebastien Miglio, Director of Product Management for Unreal Engine.
The Basic DDC Hair pipeline into UE4While no standard file import/export format currently exists for Hair Grooms, this new experimental Hair tool provides a naming convention scheme for using Alembic files to ingest Groom data exported from standard DCC tools. This also provides support for multiple Hair Groups within a single Alembic file (for example head hair, peach fuzz, beard, eyelashes, and brows).
Hair is generally expensive to both simulate and render. The achievable frame rate of hair in UE4 4.24 depends on the size of the groom, its resolution, and underlying hardware it’s been run on, but as a guide, one could expect a 30fps or higher framerate with a 2080Ti for a human groom (40K + strands) at 1080p. The test grooms that Morand has been working with and demonstrating are by no means cheats, they are flowing long blond hair grooms, one of the hardest use cases. The performance at the moment is just experimental as “the goal was to put everything in place rather than focusing on specific performance at the moment,” explains Charles de Rousiers. The team is quick to point out that the current hair performance is not as good as one can imagine Epic will soon be able to achieve.
In this first experimental software release, the team is focused on, “ensuring that we deliver outstanding visual quality and physics simulation,” explains Miglio. “To be quite honest, today when you get Alembic into Unreal, almost everything is non-editable. There’s very little ability to edit even the CVs. I think over time there is an ambition of improving this, step by step, and allowing the UI to provide more tweaking, more modification, but that’s further away.”
One can adjust the look and render of the Hair but not the groom itself. As Morand points out, “we want to make sure that we keep that conversation open. We have had initial discussions with Peregrine Labs. They are interested in working with us on something more, but it might not be in the next release… but some system that will enable users to have perhaps live links where if someone is grooming in the Ap, then the updates will automatically come through to the engine.”
Hair is driven by three things, the BRDF, the Geometry and the reaction between the hair strands, or the way light bounces from hair strand to hair strand while also shadowing. UE4 uses a lot of cutting edge approaches to achieve real-time performance, which can be varied depending upon artists’ real-time budgets. For example, the system voxelates the groom and uses deep shadow maps. The groom can be supersampled via MSAA to 8 samples per pixel. While some solutions to hair are relatively easy using full path tracing, they are expensive and so a range of clever approaches are used by the Epic team to speed up the render while producing natural-looking hair volumes that is made up fully of geometry and response plausibly to backlight, self-shadowing and illumination (see the video for a more complete explanation).
When importing, curves can also be tagged as guide hairs to drive a simulation. Most Hair simulations do not simulate all the hairs equally but propagate out from a subset of special guide hairs using a weighting mechanism. This is important as UE4 provides not only the rendering and shading but also a dynamics simulation using UE4’s Niagara.