0 Basic UnityURP Rendering Pipeline Character Rendering_Skin_Hair_Eyes_Anisotropy_SSS Practice

About Subsurface Scattering

 

Generally, the Shader of the face is the most important part of the face.

- This is different from the needs of doujinshi

- And domestic mobile games have a good demand for such a face

- I do not understand art,

- I'm lazy and don't understand the principles of graphics.

- I still have some pursuits, and I may say how to adjust the texture later,

So, today we just talk about the code of HLSL

Do not blow or black, refer to the subsurface scattering achieved by a foreign skin Skin effect ,

Really, any foreign artist can write programs (for business reasons, he won't tell you that he uses Ampliy Shader Editor)

<So just look at the shader code like this, don't think about scalability, magic modification, of course, there is still some robustness, foreigners are still relatively stable>

*In fact, in comparison, the Shader kernel framework of Unity's official URP LDRP is still relatively reliable and very industrialized.

*After writing this article, I also found that this British guy really only knows Ampliy Shader Editor (personally thinks the best Lianliankan, not one of them), and he has written thousands of lines stupidly for several years. Out these Shaders

content

About Subsurface Scattering

RRF_HumanShaders/Skin/RRF_HSP_URP_SkinBasic-------------------------------------------------

Differences between SSSMap and domestic LUT maps

RRF_HumanShaders/HairShader2/HairShader2_AS_RRF_VRTC_URP----------------------------

<The effect can be said to be quite powerful>

 Hair renderings liked on other sites

RRF_HumanShaders/EyeShaders/EyeShader_Model4URP-------------

postscript

reference:


RRF_HumanShaders/Skin/RRF_HSP_URP_SkinBasic
-------------------------------------------------

SSSMap - a texture with subsurface scatter information; if you don't have this texture for the time being, use Albedo. If you have the ability to create this texture, A channel == Thickness, the whiter the skin, the thinner the skin, such as ears, nostrils, around the eyes, etc.

SSS Mip - a blur control that makes the SSS effect softer

SSS_FromAlpha - A channel control for SSS

_Final_SSS - Do two layers of interpolation with SSS_FromAlpha, this value is adjusted to 1

Differences between SSSMap and domestic LUT maps

* Visually, the two principles are the same, both

* In fact, many of the above skin rendering settings are very wasteful, there is only one key: how to call out the LUT map of the skin

 We don't understand art, just look at the code

//居然还是用Ampliy shader或者Forge写的代码,不意外的意外
float4 tex2DNode45 = tex2D( _SSS_Map, uv_SSS_Map );

Let's take a look at the principle of Lut:

"here. . . Omit the derivation of the LUT 1000-line formula"

"here. . . Omit Subsurface Scattering 1000 Inference Maps"

"here. . . Omit 5 papers"

"here. . . 2 speeches omitted"

"here. . . Ten videos of life

Then, we have this formula:

(Find an old friend from the following code: NdotL, because it is a lut map, it is basically the threshold of uv sampling skin, NdotL controls U (left and right), and scatter linearly controls V (up and down))

	half NdotL = saturate(dot(normalWS, light.direction));
	float lutU = NdotL * 0.5 + 0.5;
	float lutV = scatter + _CuvratureOffset;
	half3 lut = SAMPLE_TEXTURE2D(_ScatterLUT, sampler_ScatterLUT, float2(lutU, lutV)).rgb;
	half3 radiance = light.color * light.distanceAttenuation * light.shadowAttenuation * lut;

It is said that it is the restoration effect of the glory of the king, which can be compared with the above code (also uv sampling lut)

//采样代码
float3 SSS = tex2D(_SSSMap,float2(NL*0.5+0.5,Mix.b)))

Let's take a look at the skin Shader principle of the foreign brother:

"The code will not be posted, it is not a commercial consideration, but it is really not worth posting"

//伪代码
float NdotL;
float SSSColorInterval = lerp(.r,.a,_FromAlpha);
float4 SSSColor; 
float4 color = NdotL * SSSColorInterval * clamp(SSSColor) * LitAtten * (LitPower * NdotL);

RRF_HumanShaders/HairShader2/HairShader2_AS_RRF_VRTC_URP-----------------------------------------------------

 

RVTC is adopted

RVTC == Validation(R) Root(G) Tip(B) Cutout(A)  

<The effect can be said to be quite powerful>

For an albedo texture, To -> PVTC, as long as the CutOut art of channel A is well designed, fine hair can be achieved

* After looking at the code, of course, I found that the three RGB channels of this old man are useless, only the A channel is used.

"Extrac's effect is also very explosive"

 Extrac effect 1-2

 Hair renderings liked on other sites

what's going on? In fact, the effect is very general, in fact, only the highlight "Let's release it after the screenshot" is realized.

Look, compared to the ordinary BaseColor map before the implementation, the high praise effect above actually only achieves the highlight transfer

 

 "That's it, it's okay to look at it from a distance", it's definitely not enough to rely on highlights

  • The effect of hair root is ultimately depend on cutout
  • The degree of density, anisotropy also needs to be investigated
  • Hair "animation" fluttering is another subject

RRF_HumanShaders/EyeShaders/EyeShader_Model4URP-------------

Rendering of the eyes:

General eye shadow: shadow|lashes

The eyelashes are wrongly attached, the eyeball is not in the center, and not everyone is an expert in professional art. 

2 useless knowledge points have been added

 

 The manuscript is so long, I have to give up, it's rotten

postscript

Although this article has the meaning of complaining about the British brother, but

  • Everything is a double-edged sword. My brother may not be able to program, but my art is really good. The theory may seem frustrating to many people, but the practice is really effective.
  • No ability can compare to the word "persistence". My brother insisted on doing it for a few years, or the perseverance of an artist is a "talent" that we can never learn in science and engineering.
  • ~!@!@*()#)()!*@

reference:

Analysis of the screenshots of the League of Legends mobile game (continuously stealing the tower...) bzdww

PBR extension for Unity - UWA Blog


 

 

Guess you like

Origin blog.csdn.net/avi9111/article/details/124362483