View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# How can i have a softer Skin using BRDF

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

19 replies to this topic

### #1toto5100  Members

Posted 24 June 2014 - 02:28 PM

Hi,

i implemented physically based shading, using the Cook Torrance BRDF Equation, with Trowbridge Reitz GGX for Normal Distribution, the Smith Schlick GGX for Geometric Shadowing, Schlick Approximation for Fresnel and for diffuse, Lambert.

All is working in Linear Space with pow(2.33) on Input and pow(0.4545) on output, and it looks good.

But the problem i have is for skin :

The falloff is too harsh, good for general objects, but the skin should look softer.

And it looks like cell shading...

So how can i make it softer like this :

### #2Promit  Senior Moderators

Posted 24 June 2014 - 03:24 PM

POPULAR

You probably want to look into subsurface scattering for the skin. Jimenez's screen space shader is the popular one. However, I'm concerned about how sharp your light-shadow transition is independent of the material being rendered. That does not look correct to me. You should check out what's going on there before doing anything else. FWIW, a cheap starting point with skin is to simply shut off specular entirely. This is a good sanity check.

Edited by Promit, 24 June 2014 - 03:25 PM.

SlimDX | Shark Eaters for iOS | Ventspace Blog | Twitter | Proud supporter of diversity and inclusiveness in game development

### #3kauna  Members

Posted 24 June 2014 - 04:29 PM

Why aren't you taking advantage of gamma corrected texture reads / back buffers?

Cheers!

### #4MJP  Moderators

Posted 24 June 2014 - 06:50 PM

POPULAR

You probably want to look into subsurface scattering for the skin. Jimenez's screen space shader is the popular one. However, I'm concerned about how sharp your light-shadow transition is independent of the material being rendered. That does not look correct to me. You should check out what's going on there before doing anything else. FWIW, a cheap starting point with skin is to simply shut off specular entirely. This is a good sanity check.

I think it looks right for a gamma-correct Lambertian diffuse falloff. Linear-space Lambertian is actually pretty harsh, especially compared to doing it in gamma-space. Obviously it looks totally wrong for skin, since the SSS will "soften" the falloff and avoid that "rocky" look that you would get otherwise.

So yeah, there's the screen-space stuff which has its pros and cons. At work we use Pre-Integrated Skin Shading (also has an article in GPU Pro 2), which has a different set of pros and cons. For some background reading, I would also suggest reading the skin rendering chapter from GPU Gems 3. The actual techniques it describes aren't really attractive for real-time rendering (texture-space diffusion is too expensive and doesn't scale well, and GGX is a cheaper approximation than multiple Beckmann specular lobes), but it's still a great article.

Edited by MJP, 06 July 2014 - 03:42 PM.

### #5Tutorial Doctor  Members

Posted 24 June 2014 - 09:39 PM

I think I accidentally down voted someone in this post. Tablet jumping around.

They call me the Tutorial Doctor.

### #6toto5100  Members

Posted 25 June 2014 - 02:12 AM

@Promit Yes, the falloff is very harsh, and without specular too (it stay the same). Do you know another diffuse equation i can use to have something softer ?

@kauna It's because Unity Free have his inputs in Gamma Space, so i had to manually correct the gamma in shaders.

I will try Sub Surface Scaterring, but i cant' use a method in Screen Space or anything which needs a rendertexture : in free version, rendertexture are very expensive.

So i'll try the Pre-Integrated Skin Shading but i have some questions :

if i understood well, i need my usual textures :

- Albedo, Normal map, Specular Map, Gloss Map

and

- Curvature Map (Baked from the mesh) and BRDF look up

So this method only affect diffuse calculations right ?

I can keep my Cook Torrance Specular, i just have to modify classic Diffuse Lambert to add SSS ?

### #7Tutorial Doctor  Members

Posted 25 June 2014 - 10:59 AM

Will sub-surface scattering necessarily help the falloff though? You can however get good skin results with nice ambient occlusion, SSS, a subtle texture map, and a decent normal map.

They call me the Tutorial Doctor.

### #8Promit  Senior Moderators

Posted 25 June 2014 - 11:06 AM

@Promit Yes, the falloff is very harsh, and without specular too (it stay the same). Do you know another diffuse equation i can use to have something softer ?
At risk of revealing my mountain man situation of being trapped on mobile ... I just like gamma space half lambert, as described in the HL2 slides.
	float ndotl = dot(N, L1);
//compute half lambert term
ndotl = (ndotl * 0.5) + 0.5;
ndotl *= ndotl;
ndotl = clamp(ndotl, 0.0, 1.0);



SlimDX | Shark Eaters for iOS | Ventspace Blog | Twitter | Proud supporter of diversity and inclusiveness in game development

### #9toto5100  Members

Posted 25 June 2014 - 12:17 PM

I tested your half lambert, but the problem is the lighting looks flat : the falloff is very large, so it looks incorrect, especially with shadows.

I tried to downscale the normal map, and the result is a little softer, but it's still very harsh.

I'll try pre integrated sss too.

Someone knows where i can download the head scan all people use ? The Infinite site is down

### #10MJP  Moderators

Posted 25 June 2014 - 03:14 PM

So this method only affect diffuse calculations right ?

Yes. Current sub-surface scattering techniques only address diffuse reflectance, so you can leave specular alone.

Will sub-surface scattering necessarily help the falloff though?

Absolutely. Take a look at this image from Eric Penner's slides:

Notice how the falloff becomes much softer as curvature increases.

### #11Promit  Senior Moderators

Posted 25 June 2014 - 10:20 PM

Are you using self shadowing in these screenshots?

SlimDX | Shark Eaters for iOS | Ventspace Blog | Twitter | Proud supporter of diversity and inclusiveness in game development

### #12toto5100  Members

Posted 04 July 2014 - 03:24 PM

Hi,

Now, i implemented Pre Integrated SSS, so i use curvature and BRDF lookup but i have a new problem :

the SSS have ugly artifacts, and i don't know why. I tried to use a smaller mip map but it doesn't resolve the problem.

You can see the SSS is pretty hard, with a "polygon" look.

After that, i tried to do a pow(2.2) on the lookupsample, and there is less artifacts but it's incorrect(the falloff is not linear).

I also have some banding.

### #13L. Spiro  Members

Posted 04 July 2014 - 07:07 PM

The look-up table is data, not imagery, and should not be “converted” to any spaces (including linear).

It would appear that you have a problem with normals.  How does the model render normally?

L. Spiro

### #14Chris_F  Members

Posted 04 July 2014 - 07:37 PM

Looks to me like your curvature map is simply rubbish.

### #15toto5100  Members

Posted 05 July 2014 - 10:03 AM

It's not a problem of normal :

Normals are ok.

And about the curvature, i calculate it dynamically using :

length( fwidth(WorldNormal)  ) / length( fwidth (worldPos ) );

I'm manually correcting gamma by doing pow(2.2) on input (Albedo) and pow(1/2.2) on output.

When i remove this (so without gamma correction) it looks like it should (but its in gamma).

So i found a compromise which is i do gamma correction AFTER brdf calculations.

So the code looks like this :

half3 falbedo = tex2D(_MainTex,uv);
float ndotl = dot(s.blurNormal,lightDir);
lookUpPos.x = ndotl * 0.5 + 0.5;
lookUpPos.y = curvature * lightIntensity;
float3 dif = tex2D (_BRDFLookUp, lookUpPos).xyz;
fAlbedo*=dif;
float3 final = (pow(fAlbedo,2.2) + spec) * _LightColor0.rgb * (attenuation * 2);
return float4(final,1);



I know that it's not correct but i found nothing else.

Edited by toto5100, 05 July 2014 - 10:04 AM.

### #16Tasty Texel  Members

Posted 06 July 2014 - 04:13 AM

If you calculate your curvature map using screen space derivatives of lerped normals then it is only to be expected that the curvature values are constant over individual polygons. Normalizing your normals beforehand could help a bit, I'm not sure how much though.

EDIT: Ok, the prob is that you have to consider the change in position too, which is constant over triangles anyways.

Edited by Tasty Texel, 06 July 2014 - 04:26 AM.

### #17toto5100  Members

Posted 06 July 2014 - 06:29 AM

When i do :

length( fwidth(normalize(WorldNormal) )  ) / length( fwidth (worldPos ) );

it changes nothing.

Also, i'm using Unity's Surface Shaders, which compute normals automatically. Normal map is also taken in account.

I don't know how can i smooth them. It's also strange that the SSS effect works well when i do BRDF before gamma correction and looks ugly when i do gamma correction on input.

PS : You think Cook Torrance with GGX is good for skin specular or i should move to Kelemen/Szirmay-Kalos ?

Edited by toto5100, 06 July 2014 - 06:45 AM.

### #18MJP  Moderators

Posted 06 July 2014 - 03:41 PM

In my experience you really need to use curvature maps for the pre-integrated shading. The trick with using derivatives and clever and might work for certain simple scenarios, but the fact it has discontinuities across triangle edges is pretty much a deal-breaker for faces.

### #19Tasty Texel  Members

Posted 06 July 2014 - 04:28 PM

@MJP: Do you use a single curvature map regardless of facial animations?

### #20MJP  Moderators

Posted 07 July 2014 - 08:16 PM

Yeah we always use the same map, we don't animate it.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.