Gamma Space skin shader development.
Developer : JPLeeEmail : email@example.com
Website : https://leegoonz.blog/
Recently, most of them are developed in a linear space.
But in some cases … for example, you might develop a game that runs on very old hardware.
If linear space conversion is not supported in hardware, it must be efficiently implemented inside the shader.
After a long time, I developed a skin shader in a situation similar to the development environment before 2016.
The entire project is a gamma space.
Texture Channel information.
Albedo with Roughness
Albedo uses an RGB channel, and roughness for expressing light is an alpha channel.
A roughness texture stored in the channel.The closer it is to white, the less glossy it is.The closer it is to black, the stronger the amount of gloss.This was converted directly into Linear Space inside the shader.
If you see this screen in the editor edit screen, you need to ignore it.
I have to follow the rules for the UnpackNormal function of the shader I created.
Normal Map uses a total of two types, but it is stored in a single texture.
One texture is stored in the RG (xy) of the texture, and another one is stored in the BA (xy) channel.Each z value is calculated directly from the shader as
sqrt(1 – saturate(dot(normal.xy, normal.xy)))
It is an important texture in skin expression.
LUT texture management.
This is the texture that records the standard Diffusion profile information for the skin.
Roughness with Reflection
Multiply the Roughness texture and Roghness variable values to express the glossiness of the skin surface.Reflection creates a reflected light effect.This is linked to the final Roughness expression.The above two values are greatly influenced by Tone Mapper.
For skin expression, we need to calculate SkinBRDF.Default is on.
Skin Brdf Attenuation
Skin Brdf Attenuation slightly obscures the shadow boundary and the skin boundary.Default is on.The reason for implementing this feature is that Soft Shadow cannot be used in mobile rendering, and if you need to use Soft Shadow, you must implement your own shadow.If you can’t implement shadows yourself, it’s best to use this feature as much as possible to blur the boundaries between the shadow and skin areas.This can be modified with the Skin Tone Scale and BRDF Attenuation values.You need to find a suitable range for both values.
Skin Tone Color
It is the Scattering color of the skin.
Skin Trans Map
The R channel is used as a depth value for skin scattering.The G channel is used for the Occlusion effect.See ShaderMap for information on texture information.
It is a fake lighting direction.This is for skin penetration effect only.
Indirect lighting was added without using auxiliary light.It creates a lighting effect from the side.You can turn it on or off and modify the intensity with Lighting Intensity.On a mobile screen, if the gloss is strong, it tends to look whiter than the original color.Therefore, it is not desirable to give Lighting Intensity too strong.
Assuming that no post-processing is used, Tone mapping is implemented and applied directly inside the shader.When rendering in Gamma space, the most noticeable part is that the specular part of the light is finally calculated in the gamma space, resulting in the feeling that the skin color is displaced.This is to remove the characteristics of Gamma space as much as possible using TONE MAPPER.
For example, the values applied to the following results.
Comparing between before tone mapped and after tone mapped.
It was developed under the condition that no post-treatment is used.
Tone mapping algorithm is implemented and applied inside the shader with reference to the Hable Filmic curve.
When modifying the tone mapper, you need to modify the roughness together to reach the final result.
See below for initial values.
Segment A = 0.2
Segment B = 0.29
Segment C = 0.24
Segment D = 0.272
Segment E = 0.02
Segment F = 0.3
White Level = 2.3
The final rendering result of the skin is determined by TONE MAPPER.Let’s modify the Segment F value from Segment D and modify the White Level to create the final rendering result.