66
1

The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

1

Page 2: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The motivation of this work is to create

a physically based shading model for

hair that is usable for gamesThere have been a ton of great advancements in hair rendering recently but not really in the shading realm.

It is common to hear “every material in our game is PBR … except hair”Most everyone in games is still using the Kajiya-Kay shading model

Lets change that

2

Page 3: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Before we start any work like this we like to get a ton of photo reference to compare our results to.

These are real human hair extensions to get us a wide variety of colors

3

Page 4: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

We also brought in a professional stylist to style some peoples hair like those of some of the characters in Paragon.

This is a 3 point lighting set up for the character twin blast

4

Page 5: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is ambient lighting

5

Page 6: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is a single light for the character Sparrow

6

Page 7: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The paths are named by the R for reflection and T for transmission events that the path encounters.

7

Page 8: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is the R path.The light ray reflects off the front of the hair fiber

8

Page 9: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is the TT path.The light ray transmits through the front of the fiber,passes through the interior which colors it due to absorptionAnd then transmits through the other side

9

Page 10: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is the TRT path.The light ray transmits through the front of the fiberPasses through the colored interiorReflects off the opposite side,Passes through the interior again and transmits out the front.

We could keep going with more internal bounces but these typically are pretty dim due to lots of absorption.

10

Page 11: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The R path is white due to not passing through the interior of the fiberThe TRT is colored due to passing through the fiber twice.They are separated from one another due to the tilted cuticle scales

11

Page 12: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The TT path can be seen from the other side.It is also colored since the path passed through the interior of the fiber but is less saturated than the TRT since it only passes through once.

12

Page 13: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Marschner’s factorization of the shading separates things into a sum of these lobes,p standing for the number of times the path passes through the interior

Each lobe is also broken into 2 functions, M and N…

13

Page 14: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

These are the longitudinal and azimuthal scattering functions M and N

The the longitudinal function describes scattering down the length of the fiberand the azimuthal function describes it radially around the fiber

14

Page 15: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

That isn’t practical for us.

15

Page 16: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

We need many colors of hair, roughness, etc.In some cases those need to vary within the same hair style, streaks of color, patterns in fur.

There are many characters coming in Paragon that haven’t been announced yet and I can’t show but trust me; every variation of hair under the sun needs to be supported

16

Page 17: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Bonus:

Replaced quadrature with Monte Carlo

17

Page 18: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Lets dive in to these functions.One of the improvements that Weta’s model had over Marschner’s is an energy conversing longitudinal scattering function

We use a Gaussian instead. Having a cheaper but more accurate alternative to d’Eon’sfunction would be nice. This is one area in particular I’d like to improve.

2 symbols that are good to explain here are beta and alphaBeta is based on the roughness of the fiberAlpha is based on the tilt of the cuticle scales

18

Page 19: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

We did use Weta’s azimuthal dependent modification from their follow up paper. For R this is cheap enough and looks slightly better.

19

Page 20: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Azimuthal for the R path is fairly simpleThe distribution function is just CosHalfPhiUsing a trig identity can skip any inverse trig functions

The attenuation is the Fresnel function

20

Page 21: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

21

Page 22: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

22

Page 23: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Weta solved the paths internal to the fiber through numerical integration with a Gaussian detector. This is a very nice generalization of the problem but is far too expensive for our purposes.

It isn’t important to understand this integral for the sake of understanding our approximation. Just know this is too expensive to solve as is.

We instead are going to solve other paths as single lobes more in line with how Marschner originally did.

It is useful to understand the attenuation term A(). This is broken into 2 subterms, Fresnel and absorption.

23

Page 24: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

First we need to solve for h which is the offset from the center of the fiberEta prime is the modified index of refraction

We can simplify this a bit but it’s still heavier than I’d like

24

Page 25: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

… so we approximate!

Graph the functionFunction approximation like this is somewhat of a black art.Make intelligent guesses about what can be removed or replaced. Try and see what works.Came up with thisUses CosHalfPhi that we had from before

Ignoring sign of h, which turns out to not be relevant for our use, we have an equation that is cheaper

25

Page 26: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Now for the modified index of refractionIf we fix the original index of refraction at 1.55 which is the IOR for human hair, this is a very accurate approximation.

Bonus:There are multiple ways to arrive at this general form of approximation.

The way I found it is I noticed in terms of cos theta d the function looked very much like 1/x. Adding a linear term made the fit much better. Tweak the constants until the max relative error is low. Done.

Alternatively, a Tayler series of the numerator with cos theta d replaced by x. The first 2 terms have the same form but slightly different constants. The constants I have here are a better fit.

26

Page 27: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Found the look more pleasant

C is the BaseColor of hair

27

Page 28: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Plug this in for gamma t and simplify. You can see now that the sign of h is irrelevant for us since it is always squared.

28

Page 29: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The formula for sTT was too expensive for us for too little of an improvement.

Instead of using Pixar’s solution for s we pick the constant 0.35.From there we approximate the logistic with a Gaussian in terms of cos phi to avoid inverse trig

Bonus:Note that Pixar only switched from Gaussian to Logistic to make importance sampling closed form. That isn’t useful for us. The reason Logistic was where I started was that I started with Pixar’s approximation for sTT. It funny to circle back but that was the history.

29

Page 30: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

30

Page 31: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

31

Page 32: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

For TRT we have to be brutal.

Marschner solved this and glints with root finding for h which has multiple solutions which means multiple lobes.Weta solved it with heavy numerical integrationPixar solved it with very large look up tables

I chose a single simple lobe.h, the offset of the path from the fiber center, for the purposes of Fresnel I use a constant.In the absorption term all use of h or the modified index of refraction are gone,replaced by a constant.The distribution I again started with the logistic function and approximated it with a Gaussian in terms of cos phi.

32

Page 33: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

33

Page 34: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

34

Page 35: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

35

Page 36: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

But it’s still missing something

36

Page 37: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Especially for light hair since the amount of absorption per fiber is less

37

Page 38: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

It feels wrong to present this part in a physically based shading course but instead consider this a call to arms.This is the biggest opportunity for others to improve this model.

38

Page 39: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

We used ideas from the Agni’s Philosophy demo

We don’t author a normal and use this fake normal instead.

It is theoretically better to have an actual normal either authored, calculated by

tracing similar to bent normals or derived from a filtered distance field of the

volume.

In my tests I found little extra benefit from an authored normal when filtered

shadowing was applied. Skipping authoring nice normals both saves artist time

and gbuffer space.

u from the diagram many slides ago is a vector parallel to the hair fiber

The rest of the scattering approximation is a wrapped Lambert, and an

absorption based on the direct light path length through the hair volume.

That path length is derived from the exponential shadow value.

This is all a giant artistic hack and not physically based in the slightest. It was

derived by looking at photos, not ground truth renders. Future work would be

to implement this direct light model in a path tracer and see what approximations could be made with no bounces to match the multi bounce

39

Page 40: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

reference.

39

Page 41: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Here is what it looks like. I don’t have a reference to compare it to like the other terms.

Bonus:Ignore that highlight on the braid. It is actually from the surface underneath the hair.

40

Page 42: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

41

Page 43: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

42

Page 44: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

43

Page 45: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

As mentioned already I rely on shadows for the shading model. It is absolutely vital to the look which is easy to see by disabling them.

Shadow maps are PCF filtered with an exponential falloff instead of a hard comparison.The result is volumetric looking without any provided normals

44

Page 46: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

45

Page 47: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

The most intriguing approximates Marschner’s model with circular Gaussians

which can be analytically integrated against spherical Gaussian lights

Since that is basically what we have for both the longitudinal and azimuthal

functions this could fit well with the rest of our approach.

In the end it wasn’t worth the development time to be that sophisticated

Bonus:

It would also be worth looking at “Analytic Tangent Irradiance Environment

Maps for Anisotropic Surfaces” which should be similar cost but more accurate

results. In all honesty I didn’t pursue either of these options because I ran out

of development time. For the cases I was testing at the time this very simple

solution looked good enough.

46

Page 48: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

This is what we do

Increase the roughness as an approximation of a wider area light source.

We don’t have shadowing from shadow maps so we need to artificially shadow paths that would likely be blocked by a volume of hair. These are primarily those that are coming from the opposite side.

If you had some computed form of directional occlusion such as bent cones we could make less assumptions about which paths are blocked.

47

Page 49: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

48

Page 50: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

49

Page 51: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

50

Page 52: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

51

Page 53: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

52

Page 54: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

53

Page 55: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

I’ll leave you with some shots of a human head we will be releasing in the next version of Unreal so that there is a high quality example of all of the character rendering work we have done of late.

54

Page 56: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

55

Page 57: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

56

Page 58: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

Lastly thanks to, Epic, our character art team and to Stephen Hill and Stephen McAuley for reviewing these slides

57

Page 59: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

58

Page 60: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

59

Page 61: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

60

Page 62: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

61

Page 63: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

62

Page 64: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

63

Page 65: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

64

Page 66: The motivation of this work is to create - Self Shadow · 2019-10-26 · The motivation of this work is to create a physically based shading model for hair that is usable for games

65