整体效果展示:主要方案是对下面几张图做不同的处理
身体
基础颜色光照:主要贴图+卡通贴图+ramp图+法线图+光照图
金属度与高光,头发部分高光:光照图,头发部分用高光black图
深度边缘光:用额外pass DepthNormals 获取深度信息
描边:额外pass对描边进行处理,用光照图的a通道对不同区域做颜色区分
脸
方案:主要贴图+卡通贴图+ramp图+SDF+描边
需要用到的贴图
将光照图,ramp图的sRGB关闭,法线图Type改成法线
妮露基础图的a通道储存的是神之眼灰度信息
光照图的rba存储材质信息,r通道储存金属强度,g通道储存AO信息,b通道储存高光形状与细节
ramp图上五行是白天暗部颜色,下五行是夜晚暗部颜色
卡通图用来做底部光照体积文章来源:https://www.toymoban.com/news/detail-400548.html
准备阶段文章来源地址https://www.toymoban.com/news/detail-400548.html
//数据准备
Properties
{
[Space][Space][Space][Space]
_AmbientColor ("基础颜色", Color) = (0.667,0.667,0.667,1)
_DiffuseColor ("漫反射颜色", Color) = (0.906,0.906,0.906,1)
_ShadowColor ("阴影颜色", Color) = (0.737,0.737,0.737,1)
[Space][Space][Space][Space]
_DiffuseTexFac("漫反射Fac",Range(0,1))=1
_DiffuseTex ("漫反射贴图", 2D) = "white" {}
[Space][Space][Space][Space]
_ToonTexFac("卡通Fac",Range(0,1))=1
_ToonTex ("卡通贴图", 2D) = "white" {}
[Space][Space][Space][Space]
_SphereTexHair ("头发高光", 2D) = "black" {}
_SphereHair("头发高光强度",Range(0,128))=68
[Space][Space][Space][Space]
_DoubleSided("双面",Range(0,1))=0
_Alpha("透明值",Range(0,1))=1
[Space][Space][Space][Space]
_MetalTex("金属贴图", 2D) = "black" {}
_SpecExpon("高光强度",Range(1,128))=58
_KsNonMetallic("非金属",Range(0,3))=1
_KsMetallic("金属度",Range(0,3))=1
[Space][Space][Space][Space]
_NormalMap("法线贴图", 2D) = "bump" {}
[Space][Space][Space][Space]
_ILM("光照贴图",2D)="black"{}
[Space][Space][Space][Space]
_RampTex("Ramp贴图", 2D) = "white" {}
_RampMapRow0("Ramp0",Range(1,5))=1
_RampMapRow1("Ramp1",Range(1,5))=4
_RampMapRow2("Ramp2",Range(1,5))=3
_RampMapRow3("Ramp3",Range(1,5))=5
_RampMapRow4("Ramp4",Range(1,5))=2
[Space][Space][Space][Space]
_OutlineOffset("描边值",Float)=0.0007
_OutlineMapColor0("描边颜色0",Color)=(0,0,0,0)
_OutlineMapColor1("描边颜色1",Color)=(0,0,0,0)
_OutlineMapColor2("描边颜色2",Color)=(0,0,0,0)
_OutlineMapColor3("描边颜色3",Color)=(0,0,0,0)
_OutlineMapColor4("描边颜色4",Color)=(0,0,0,0)
[Space][Space][Space][Space]
_rimStrength("边缘光宽度",Range(0,10))=0.8
_rimMax("边缘光强度",Range(0,20))=0.8
}
//准备pass,阴影和深度信息
Pass
{
Name"ShadowCaster"
Tags{"LightMode"="ShadowCaster"}
ZWrite On
ZTest LEqual
ColorMask 0
Cull off
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
//材质关键字
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
//显卡实例化
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
//管线配置关键字
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment
#include "Library/PackageCache/com.unity.render-pipelines.universal@12.1.7//Shaders/LitInput.hlsl"
#include "Library/PackageCache/com.unity.render-pipelines.universal@12.1.7//Shaders/ShadowCasterPass.hlsl"
ENDHLSL
}
Pass
{
Name"DepthNormals"
Tags{"LightMode"="DepthNormals"}
ZWrite On
Cull off
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma vertex DepthNormalsVertex
#pragma fragment DepthNormalsFragment
//材质关键字
#pragma shader_feature_local _NORMALMAP
#pragma shader_feature_local _PARALLAXMAP
#pragma shader_feat
到了这里,关于原神角色渲染详解的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!