314 lines
15 KiB
Markdown
314 lines
15 KiB
Markdown
# 相关资产路径
|
||
Content/ResArt/CommandMaterial
|
||
- [x] [[#Functions]]
|
||
- [x] [[#MatCap]]
|
||
- [x] [[#Materials]]
|
||
- [ ] [[#MaterialInstance]]
|
||
- [x] [[#Outline]]
|
||
- [x] [[#Textures]]
|
||
|
||
# Functions
|
||
- [x] [[#ShadingModels]]
|
||
- MF_ToonPBRShadingModel
|
||
- MF_ToonBaseShadingModel
|
||
- MF_ToonSkinShadingModel
|
||
- MF_ToonHairShadingModel
|
||
- [x] [[#Effects]]
|
||
- MF_Dissolve
|
||
- MF_EdgeLight
|
||
- MF_Fur
|
||
- [x] Tools
|
||
- MF_DecodeArrayIDAndAlpha:分离输入浮点数的整数与小数部分。整数部分作为TextureArrayID,小数部分作为Alpha参数。
|
||
- 主要用于MF_FaceOverlay的**Face Overlay Color**效果与M_Penetrate的**Eye Overlay Color**效果。
|
||
- MF_Hash11
|
||
- MF_Hash12
|
||
- MF_Hash13
|
||
- MF_Hash22
|
||
- MF_Hash23
|
||
- [x] ***CameraLightCollection***:各个角色的主光照颜色、边缘光颜色与主光亮度以及LightDir。
|
||
- MF_CharacterMainLightIntensity:使用CustomNode编写的函数,通过RoleID进行Switch Case计算对应角色的MainLightColor * MainLightIntensity,这些一般在Sequence中进行修改。
|
||
- MF_ApplyToonHairSpecular:头发高光计算,被M_ToonBase_V02调用。
|
||
- ***MF_CharacterEffects***:基本所有角色相关材质都有使用。主要调用了MF_EdgeLight、MF_Dissolves实现了**边缘光与溶解效果。
|
||
- MF_CharacterRimLightIntensity:使用CustomNode编写的函数,通过RoleID进行Switch Case计算对应角色的RimLightColor * RimLightIntensity,这些一般在Sequence中进行修改。
|
||
- MF_FaceHighlightAndShadow:使用Shadow贴图渲染脸上的阴影效果(通过Dot(LightVector,FaceRight)判断左右)以及边缘高光(通过Dot(LightVector,FaceFront)作为Mask),被M_ToonFace调用,但没有使用脸部阴影效果只使用了高光(实际看不出来)。
|
||
- 其中的FaceRight、FaceFront、FaceLightDir**使用了CustomPrimitiveData**。
|
||
- MF_FaceOverlay:脸部材质额外的BaseColorTexture叠加效果,猜测是用来制作一些特殊表情的腮红效果,被M_ToonFace调用。
|
||
- MF_Inputs:镭射材质效果,只被M_ToonLaserPBR、MI_Leishezhi调用。
|
||
- MF_Matcap:Matcap效果,输出2种贴图Multip 与 Add效果,被MF_ToonPBRInput调用。
|
||
- **MF_Matcap_Add**:MF_Matcap的升级版。
|
||
- OutputAdd = LightMap * LightMatcap
|
||
- OutputEmissive = Matcap Texture 01 + Matcap Texture 02 + Matcap Texture 03 + Emissive Matcap * Emissive Texture
|
||
- OutputNeckShadow = lerp( lerp(1.0, Matcap Color 04, Matcap Texture 04), 1, NeckShadow)
|
||
- OutputInnerline = Innerline Matcap
|
||
- MF_NormalMapIntensity:Normal强度调整,被大量材质引用。
|
||
- ***MF_SceneEffects***:调用了MF_Dissolve实现了溶解效果。但备用他的材质并不多。
|
||
- MF_ShiftTangent:Kajiya-Kay中的ShiftTangent,被M_ToonHair_V01调用。
|
||
- MF_StrandSpec:Kajiya-Kay中的高光计算逻辑,被M_ToonHair_V01调用。
|
||
- MF_Surface:Surface材质相关属性逻辑,被MF_ToonPBRInput、MF_ToonBaseInput调用。
|
||
- **MF_Surface_V02**:Surface材质相关属性逻辑,被MF_ToonBaseInput_V02调用。与MF_Surface相比少了Specular输出。
|
||
- MF_TextureBooming:材质没有上线。
|
||
- **MF_ToonBaseInput**:通用ToonBase材质逻辑函数。集合了MF_CharacterMainLightIntensity、MF_Matcap_Add、MF_Surface、MF_ToonBaseShadingModel材质函数以及一些变量材质设置。被**M_ToonBase_V02_Penetrate**、**M_ToonBase_V02_Test**调用。
|
||
- ***MF_ToonBaseInput_V02***:通用ToonBase材质逻辑函数V02。集合了MF_CharacterMainLightIntensity、MF_Matcap_Add、**MF_Surface_V02**、MF_ToonBaseShadingModel材质函数以及一些变量材质设置。被**M_ToonBase_V02**、**M_NaiLin_AnotherWorld02**、**M_EggGym_Flower**调用。
|
||
- **MF_ToonHairSpecularMaskUV**:计算Hair高光贴图UV,被MF_ApplyToonHairSpecular(**M_ToonBase_V02**)调用。
|
||
- 使用dot( float3(0,0,1.0f), CaemraVector)的数值来对**HairMask的采样UV(V轴)** 进行偏移,以此实现高光偏移效果。
|
||
- **MF_ToonPBRInput**:通用ToonPBR材质逻辑函数。集合了MF_CharacterMainLightIntensity、MF_Matcap、MF_Surface、**MF_ToonPBRInput**l材质函数以及一些变量材质设置。被**M_Penetrate**、**M_ToonBase_V01**、**M_ToonFace**、**M_ToonHair_V01**、**M_ToonSkin**、**M_BeiLa_Skin_AnotherWorld**、**M_Wave**。
|
||
- ***MF_TranslucentDOF***:Translucent材质的景深效果,***没有看懂***。被MF_Input、**MF_Surface**、**MF_Surface_V02**、M_ToonFacee_old、M_ToonLaserPBR调用。
|
||
- MF_VectorRotateAboutAxis:向量旋转函数。被MF_WorldSpaceStarring调用。
|
||
- MF_WorldSpaceStarring:被M_NaiLin_AnotherWorld02调用。
|
||
- SceneEffectsCollection:场景效果材质参数集,**可能已经废弃,因为UE5大世界不支持关卡流**。会被MF_SceneEffects、BP_EmptyToStageA以及其他材质调用。
|
||
## ShadingModels
|
||
采用CustomNode构造FMaterialAttributesde的之后传递到MaterialAttribute模式的材质中,其他骚操作还有:
|
||
1. 使用宏开启MRT5:`#define PIXELSHADEROUTPUT_MRT5 1`
|
||
2. 设置ShadingModelID:`Result.ShadingModel = 14;`
|
||
3. 使用FToonShadingPerMaterialCustomData ToonShadingPerMaterialCustomData(位于Common.ush)来传递卡通渲染用数据,之后在BasePassPixelShader.ush中将数据塞入GBuffer中。
|
||
### MF_ToonPBRShadingModel
|
||
```c++
|
||
FMaterialAttributes Result;
|
||
Result.BaseColor = float3(1.0, 1.0, 1.0);
|
||
Result.Metallic = 0.0;
|
||
Result.Specular = 0.0;
|
||
Result.Roughness = 0.0;
|
||
Result.Anisotropy = 0.0;
|
||
Result.EmissiveColor = float3(0.0, 0.0, 0.0);
|
||
Result.Opacity = 1.0;
|
||
Result.OpacityMask = 1.0;
|
||
Result.Normal = float3(0.0, 0.0, 1.0);
|
||
Result.Tangent = float3(1.0, 0.0, 0.0);
|
||
Result.WorldPositionOffset = float3(0.0, 0.0, 0.0);
|
||
Result.SubsurfaceColor = float3(1.0, 1.0, 1.0);
|
||
Result.ClearCoat = 1.0;
|
||
Result.ClearCoatRoughness = 0.1;
|
||
Result.AmbientOcclusion = 1.0;
|
||
Result.Refraction = float3(0.0, 0.0, 0.0);
|
||
Result.PixelDepthOffset = 0.0;
|
||
Result.ShadingModel = 1;
|
||
Result.CustomizedUV0 = float2(0.0, 0.0);
|
||
Result.CustomizedUV1 = float2(0.0, 0.0);
|
||
Result.CustomizedUV2 = float2(0.0, 0.0);
|
||
Result.CustomizedUV3 = float2(0.0, 0.0);
|
||
Result.CustomizedUV4 = float2(0.0, 0.0);
|
||
Result.CustomizedUV5 = float2(0.0, 0.0);
|
||
Result.CustomizedUV6 = float2(0.0, 0.0);
|
||
Result.CustomizedUV7 = float2(0.0, 0.0);
|
||
Result.BentNormal = float3(0.0, 0.0, 1.0);
|
||
Result.ClearCoatBottomNormal = float3(0.0, 0.0, 1.0);
|
||
Result.CustomEyeTangent = float3(0.0, 0.0, 0.0);
|
||
|
||
#define PIXELSHADEROUTPUT_MRT5 1
|
||
|
||
Result.ShadingModel = 14;
|
||
ToonShadingPerMaterialCustomData.ToonSpecularColor = saturate(SpecularColor.rgb);
|
||
ToonShadingPerMaterialCustomData.ToonShadowColor = saturate(ShadowColor.rgb);
|
||
ToonShadingPerMaterialCustomData.ToonShadowLocation = saturate(CutPosition);
|
||
ToonShadingPerMaterialCustomData.ToonShadowSmoothness = saturate(CutSmoothness);
|
||
|
||
return Result;
|
||
```
|
||
|
||
### MF_ToonBaseShadingModel
|
||
```c++
|
||
FMaterialAttributes Result;
|
||
Result.BaseColor = float3(1.0, 1.0, 1.0);
|
||
Result.Metallic = 0.0;
|
||
Result.Specular = 0.0;
|
||
Result.Roughness = 0.0;
|
||
Result.Anisotropy = 0.0;
|
||
Result.EmissiveColor = float3(0.0, 0.0, 0.0);
|
||
Result.Opacity = 1.0;
|
||
Result.OpacityMask = 1.0;
|
||
Result.Normal = float3(0.0, 0.0, 1.0);
|
||
Result.Tangent = float3(1.0, 0.0, 0.0);
|
||
Result.WorldPositionOffset = float3(0.0, 0.0, 0.0);
|
||
Result.SubsurfaceColor = float3(1.0, 1.0, 1.0);
|
||
Result.ClearCoat = 1.0;
|
||
Result.ClearCoatRoughness = 0.1;
|
||
Result.AmbientOcclusion = 1.0;
|
||
Result.Refraction = float3(0.0, 0.0, 0.0);
|
||
Result.PixelDepthOffset = 0.0;
|
||
Result.ShadingModel = 1;
|
||
Result.CustomizedUV0 = float2(0.0, 0.0);
|
||
Result.CustomizedUV1 = float2(0.0, 0.0);
|
||
Result.CustomizedUV2 = float2(0.0, 0.0);
|
||
Result.CustomizedUV3 = float2(0.0, 0.0);
|
||
Result.CustomizedUV4 = float2(0.0, 0.0);
|
||
Result.CustomizedUV5 = float2(0.0, 0.0);
|
||
Result.CustomizedUV6 = float2(0.0, 0.0);
|
||
Result.CustomizedUV7 = float2(0.0, 0.0);
|
||
Result.BentNormal = float3(0.0, 0.0, 1.0);
|
||
Result.ClearCoatBottomNormal = float3(0.0, 0.0, 1.0);
|
||
Result.CustomEyeTangent = float3(0.0, 0.0, 0.0);
|
||
|
||
#define PIXELSHADEROUTPUT_MRT5 1
|
||
|
||
Result.ShadingModel = 13;
|
||
ToonShadingPerMaterialCustomData.ToonShadowColor = saturate(ShadowColor.rgb);
|
||
ToonShadingPerMaterialCustomData.ToonShadowLocation = clamp(ShadowLocation, 0, SpecularLocation);
|
||
ToonShadingPerMaterialCustomData.ToonShadowSmoothness = saturate(ShadowSmoothness);
|
||
ToonShadingPerMaterialCustomData.ToonForceShadow = saturate(ForceShadow);
|
||
ToonShadingPerMaterialCustomData.ToonSecondaryShadowColor = saturate(SecondaryShadowColor.rgb);
|
||
ToonShadingPerMaterialCustomData.ToonSecondaryShadowLocation = clamp(SecondaryShadowLocation, 0, SpecularLocation);
|
||
ToonShadingPerMaterialCustomData.ToonSecondaryShadowSmoothness = saturate(SecondaryShadowSmoothness);
|
||
|
||
return Result;
|
||
```
|
||
|
||
### MF_ToonSkinShadingModel
|
||
```c++
|
||
FMaterialAttributes Result;
|
||
Result.BaseColor = float3(1.0, 1.0, 1.0);
|
||
Result.Metallic = 0.0;
|
||
Result.Specular = 0.0;
|
||
Result.Roughness = 0.0;
|
||
Result.Anisotropy = 0.0;
|
||
Result.EmissiveColor = float3(0.0, 0.0, 0.0);
|
||
Result.Opacity = 1.0;
|
||
Result.OpacityMask = 1.0;
|
||
Result.Normal = float3(0.0, 0.0, 1.0);
|
||
Result.Tangent = float3(1.0, 0.0, 0.0);
|
||
Result.WorldPositionOffset = float3(0.0, 0.0, 0.0);
|
||
Result.SubsurfaceColor = float3(1.0, 1.0, 1.0);
|
||
Result.ClearCoat = 1.0;
|
||
Result.ClearCoatRoughness = 0.1;
|
||
Result.AmbientOcclusion = 1.0;
|
||
Result.Refraction = float3(0.0, 0.0, 0.0);
|
||
Result.PixelDepthOffset = 0.0;
|
||
Result.ShadingModel = 1;
|
||
Result.CustomizedUV0 = float2(0.0, 0.0);
|
||
Result.CustomizedUV1 = float2(0.0, 0.0);
|
||
Result.CustomizedUV2 = float2(0.0, 0.0);
|
||
Result.CustomizedUV3 = float2(0.0, 0.0);
|
||
Result.CustomizedUV4 = float2(0.0, 0.0);
|
||
Result.CustomizedUV5 = float2(0.0, 0.0);
|
||
Result.CustomizedUV6 = float2(0.0, 0.0);
|
||
Result.CustomizedUV7 = float2(0.0, 0.0);
|
||
Result.BentNormal = float3(0.0, 0.0, 1.0);
|
||
Result.ClearCoatBottomNormal = float3(0.0, 0.0, 1.0);
|
||
Result.CustomEyeTangent = float3(0.0, 0.0, 0.0);
|
||
|
||
#define PIXELSHADEROUTPUT_MRT5 1
|
||
|
||
Result.ShadingModel = 15;
|
||
ToonShadingPerMaterialCustomData.ToonShadowColor = saturate(ShadowColor.rgb);
|
||
ToonShadingPerMaterialCustomData.ToonShadowLocation = saturate(CutPosition);
|
||
ToonShadingPerMaterialCustomData.ToonShadowSmoothness = saturate(CutSmoothness);
|
||
|
||
return Result;
|
||
```
|
||
|
||
### MF_ToonHairShadingModel
|
||
```c++
|
||
FMaterialAttributes Result;
|
||
Result.BaseColor = float3(1.0, 1.0, 1.0);
|
||
Result.Metallic = 0.0;
|
||
Result.Specular = 0.0;
|
||
Result.Roughness = 0.0;
|
||
Result.Anisotropy = 0.0;
|
||
Result.EmissiveColor = float3(0.0, 0.0, 0.0);
|
||
Result.Opacity = 1.0;
|
||
Result.OpacityMask = 1.0;
|
||
Result.Normal = float3(0.0, 0.0, 1.0);
|
||
Result.Tangent = float3(1.0, 0.0, 0.0);
|
||
Result.WorldPositionOffset = float3(0.0, 0.0, 0.0);
|
||
Result.SubsurfaceColor = float3(1.0, 1.0, 1.0);
|
||
Result.ClearCoat = 1.0;
|
||
Result.ClearCoatRoughness = 0.1;
|
||
Result.AmbientOcclusion = 1.0;
|
||
Result.Refraction = float3(0.0, 0.0, 0.0);
|
||
Result.PixelDepthOffset = 0.0;
|
||
Result.ShadingModel = 1;
|
||
Result.CustomizedUV0 = float2(0.0, 0.0);
|
||
Result.CustomizedUV1 = float2(0.0, 0.0);
|
||
Result.CustomizedUV2 = float2(0.0, 0.0);
|
||
Result.CustomizedUV3 = float2(0.0, 0.0);
|
||
Result.CustomizedUV4 = float2(0.0, 0.0);
|
||
Result.CustomizedUV5 = float2(0.0, 0.0);
|
||
Result.CustomizedUV6 = float2(0.0, 0.0);
|
||
Result.CustomizedUV7 = float2(0.0, 0.0);
|
||
Result.BentNormal = float3(0.0, 0.0, 1.0);
|
||
Result.ClearCoatBottomNormal = float3(0.0, 0.0, 1.0);
|
||
Result.CustomEyeTangent = float3(0.0, 0.0, 0.0);
|
||
|
||
Result.ShadingModel = 14;
|
||
Result.Anisotropy = 1.0;
|
||
ToonShadingPerMaterialCustomData.CustomData0 = saturate(float4(ShadowColor.rgb, ShadowSmoothness));
|
||
ToonShadingPerMaterialCustomData.CustomData1 = saturate(float4(SpecularAbsorbance, SpecularRangeParam.xyz));
|
||
|
||
return Result;
|
||
```
|
||
|
||
## Effects
|
||
- **MF_EdgeLight**:边缘光效果,通过UE菲尼尔函数以及一些贴图、变量实现效果。主要被***MF_CharacterEffects***引用。
|
||
- **MF_Dissolve**:溶解过度效果。主要被***MF_CharacterEffects***、***MF_SceneEffects***引用。
|
||
- MF_Fur:用于制作Fur效果的材质函数,被**ToonShading_Standard_nooffset_fur**引用。主要还是靠***GFur插件***,没有参考意义,升级难度+1。
|
||
|
||
# Matcap
|
||
存放大量Matcap用的**球形环境贴图**。除此之外`/ResArt/CommonMaterial/Materials/V02/MatCap/`也存储了Matcap贴图。
|
||
|
||
## 球形全景图制作方法
|
||
【如何将无人机拍摄的球形全景图还原成球形视图】 https://www.bilibili.com/video/BV1yz411q7Eg/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e
|
||
|
||
# Materials
|
||
>所有角色与新服装都迁移到V02版本,V01已废弃。
|
||
|
||
- Special
|
||
- M_BeiLa_Skin_AnotherWorld:特别定制的材质。
|
||
- [ ] V02
|
||
- Special
|
||
- M_NaiLin_AnotherWorld02:特别定制的材质。
|
||
- ***[[#M_ToonBase_V02]]***:**默认的ShadingModel为13**,也就是SHADINGMODELID_TOON_BASE。
|
||
- ~~M_ToonBase_V02_Test~~:测试用,主要的差别是使用的是MF_ToonBaseInput(里面用的是旧版的MF_Surface)
|
||
- MI_ToonBase_V02:
|
||
- MI_ToonSkin_V02:
|
||
- MI_ToonFace_V02
|
||
- MI_ToonHair_V02
|
||
- MI_Brow_V02:
|
||
- MI_Eye_V02:
|
||
- MI_EyeGlass_V02:
|
||
- MI_EyeHighlight_V02:
|
||
- MI_EyeShadow_V02:
|
||
- MI_MakeUp_V02:
|
||
- MI_TeethTongue_V02:
|
||
- [x] **M_Eye_Highlight**:
|
||
- M_Hide:隐藏模型用材质。
|
||
- [x] M_Penetrate:
|
||
- [x] **M_ToonBase_V01**:主要的逻辑是MF_ToonPBRInput => MF_CharacterEffects。**默认的ShadingModel为14**,也就是**SHADINGMODELID_TOON_PBR**。
|
||
- [x] M_ToonBase_V02_Penetrate:带有Penetrate功能的M_ToonBase_V01。
|
||
- [x] **M_ToonFace**:
|
||
- [x] M_ToonFace_old:
|
||
- [x] **M_ToonHair_V01**:
|
||
- [x] **M_ToonSkin**:
|
||
|
||
## M_ToonBase_V02
|
||
与M_ToonBase_V01相比。最主要的逻辑区别在于:
|
||
1. MF_ToonPBRInput => MF_ToonBaseInput_V02
|
||
1. MF_Matcap_Add => MF_Matcap。不输出Specular,转而将高光结果输出在BaseColor与Emissive中。
|
||
2. MF_ToonPBRShadingModel => MF_ToonBaseShadingModel。
|
||
1. 移除Specular
|
||
2. 增加ToonShadowSmoothness
|
||
3. 增加ToonSecondaryShadow
|
||
4. ShadingModel为13,也就是**SHADINGMODELID_TOON_BASE**。14 => 13。
|
||
2. 增加MF_ApplyToonHairSpecular()计算头发高光并且将结果叠加到Emissive上。
|
||
3. 增加Penetrate逻辑,结果加上WPO上。
|
||
4. 增加Refraction逻辑,通过Normal以及菲尼尔节点插值,以此设置Refraction。
|
||
|
||
# MaterialInstance
|
||
|
||
# Outline
|
||
主要存储了Outline主材质以及所有角色所用到的Outline材质,统一放到对应角色文件夹中。描边材质使用***M_Outline_V03***或***MI_Outline_V03***即可。
|
||
|
||
1. 材质ShadingModel为Unlit、BlendMode为Maskd。
|
||
2. 所有描边材质都有**MF_CharacterEffects**、MF_CharacterMainLightIntensity。所以都支持溶解效果,以及调整每个角色的描边光照效果(连接的是材质Emissive引脚)。
|
||
|
||
- M_Outline_V01 & M_Outline_V02:
|
||
- **WPO**引脚逻辑:**描边粗细控制部分逻辑**和V01基本相同,除了V01有Minimum Line Thickness这个粗细最小值。剩下的其他逻辑一模一样。
|
||
- ***M_Outline_V03***:
|
||
- **OpacityMask**引脚逻辑:与V01、V02略有不同。会将BaseTexture贴图的a通道乘以HideMask,然而并没有材质使用。
|
||
- **WPO**引脚逻辑:V03版本的**描边粗细控制部分逻辑**做了更加合理的改动。VertexColor的RGB通道代替Backface外扩时的VertexNormalWS,这样不会影响光照效果。
|
||
- MaterialInstance
|
||
- MI_Outline_V03
|
||
- MI_Outline_Face_V03
|
||
- MI_Outline_Hair_V03
|
||
- MI_Outline_Skin_V03
|
||
- Dissolve:继承自MaterialInstance文件夹中的对应材质实例,**勾选了EnableDissolve**。
|
||
# Textures
|
||
存储一些默认贴图与一些测试用(无用)贴图。 |