2024-06-24 11:56:00 +08:00
|
|
|
|
# 相关资产路径
|
2024-06-24 13:01:28 +08:00
|
|
|
|
Content/ResArt/CommandMaterial
|
2024-06-24 15:18:12 +08:00
|
|
|
|
- [ ] [[#Functions]]
|
|
|
|
|
- [x] [[#MatCap]]
|
|
|
|
|
- [ ] [[#MaterialInstance]]
|
|
|
|
|
- [ ] [[#Materials]]
|
|
|
|
|
- [ ] [[#Outline]]
|
|
|
|
|
- [x] [[#Textures]]
|
2024-06-24 13:01:28 +08:00
|
|
|
|
|
|
|
|
|
# Functions
|
2024-06-24 15:18:12 +08:00
|
|
|
|
- [x] [[#ShadingModels]]
|
2024-06-24 13:01:28 +08:00
|
|
|
|
- MF_ToonPBRShadingModel
|
|
|
|
|
- MF_ToonBaseShadingModel
|
|
|
|
|
- MF_ToonSkinShadingModel
|
|
|
|
|
- MF_ToonHairShadingModel
|
2024-06-24 20:03:37 +08:00
|
|
|
|
- [x] Effects
|
2024-06-24 13:01:28 +08:00
|
|
|
|
- MF_Dissolve
|
|
|
|
|
- MF_EdgeLight
|
|
|
|
|
- MF_Fur
|
2024-06-25 18:41:14 +08:00
|
|
|
|
- [x] Tools
|
|
|
|
|
- MF_DecodeArrayIDAndAlpha:分离输入浮点数的整数与小数部分。整数部分作为TextureArrayID,小数部分作为Alpha参数。
|
|
|
|
|
- 主要用于MF_FaceOverlay的**Face Overlay Color**效果与M_Penetrate的**Eye Overlay Color**效果。
|
2024-06-24 13:01:28 +08:00
|
|
|
|
- MF_Hash11
|
|
|
|
|
- MF_Hash12
|
|
|
|
|
- MF_Hash13
|
|
|
|
|
- MF_Hash22
|
|
|
|
|
- MF_Hash23
|
2024-06-25 18:41:14 +08:00
|
|
|
|
- [x] ***CameraLightCollection***:各个角色的主光照颜色、边缘光颜色与主光亮度以及LightDir。
|
|
|
|
|
- [ ] MF_CharacterMainLightIntensity:
|
2024-06-24 15:18:12 +08:00
|
|
|
|
|
|
|
|
|
## 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
|
2024-06-24 20:03:37 +08:00
|
|
|
|
- **MF_EdgeLight**:边缘光效果,通过UE菲尼尔函数以及一些贴图、变量实现效果。主要被***MF_CharacterEffects***引用。
|
2024-06-24 19:26:23 +08:00
|
|
|
|
- **MF_Dissolve**:溶解过度效果。主要被***MF_CharacterEffects***、***MF_SceneEffects***引用。
|
|
|
|
|
- MF_Fur:用于制作Fur效果的材质函数,被**ToonShading_Standard_nooffset_fur**引用。主要还是靠***GFur插件***,没有参考意义,升级难度+1。
|
2024-06-24 15:18:12 +08:00
|
|
|
|
|
|
|
|
|
# Matcap
|
|
|
|
|
存放大量Matcap用的**球形环境贴图**。
|
|
|
|
|
|
|
|
|
|
# Outline
|
|
|
|
|
# Textures
|
|
|
|
|
存储一些默认贴图与一些测试用(无用)贴图。
|