Unity2023.2的版本,Thickness 自动化生成,今天测试了一把,确实不错。
1.Render 设置
在Project Settings->Graphics->HDRP Global Settings中
Frame Setting->Rendering->Compute Thickness 打开
2.Layer设置
2.1添加Layer:Thickness(其Layer Mask = 6)
2.2为场景中需要计算Thickness数据的物件都归档到 Thickness Layer
2.3在Project Settings->Quality->HDRP:Rendering:Computer Thickness中
Enable,且Layer Mask设置Thickness
2.4在Shader中使用Thickness
创建HD Sample Buffer后Source Buffer选择Thickness;
HD Sample Buffer的Layer Mask设置Thickness Layer Mask,即6;
Surface Options的Material Type选择 Subsurface Scattering
2.5调试:
选择Rendering Debugger->Rendering: Fullscreen Debug Mode: ComputerThickness
设置Layer Mask:当前Thickness Layer Mask为6,所以设置为6
3.最终效果