vault backup: 2024-06-21 17:58:39

This commit is contained in:
BlueRose 2024-06-21 17:58:39 +08:00
parent a645265e18
commit 6ddb534e37

View File

@ -43,6 +43,8 @@ static FToonShadingPerMaterialCustomData ToonShadingPerMaterialCustomData;
2. AO => ToonSecondaryShadowLocation
3. CustomData => ToonShadowColor/ToonSecondaryShadowSmoothness
4. PrecomputedShadowFactors => ToonSecondaryShadowColor
5. `#define GBUFFER_REFACTOR 0` 以此关闭自动生成Encode/Decode GBufferData代码并使用硬编码调用Encode/Decode GBufferData。
6. `#if WRITES_VELOCITY_TO_GBUFFER` => `#if GBUFFER_HAS_VELOCITY`,以此**关闭写入VELOCITY到GBuffer中**。
### Encode/Decode函数
RGB655 to 8-bit RGB。
@ -224,6 +226,48 @@ FGBufferData DecodeGBufferData(
```
# BasePass
BasePassPixelShader.usf
1. `#if 1` => `#if GBUFFER_REFACTOR && 0`以此关闭自动生成Encode/Decode GBufferData代码并使用硬编码调用Encode/Decode GBufferData。
2. 在FPixelShaderInOut_MainPS()中添加写入FGBufferData逻辑。代码如下
```c++
...
switch(GBuffer.ShadingModelID)
{
case SHADINGMODELID_TOON_BASE:
GBuffer.ToonShadowColor = ToonShadingPerMaterialCustomData.ToonShadowColor.rgb;
GBuffer.ToonShadowLocation = ToonShadingPerMaterialCustomData.ToonShadowLocation;
GBuffer.ToonShadowSmoothness = ToonShadingPerMaterialCustomData.ToonShadowSmoothness;
GBuffer.ToonForceShadow = ToonShadingPerMaterialCustomData.ToonForceShadow;
GBuffer.ToonSecondaryShadowColor = ToonShadingPerMaterialCustomData.ToonSecondaryShadowColor.rgb;
GBuffer.ToonSecondaryShadowLocation = ToonShadingPerMaterialCustomData.ToonSecondaryShadowLocation;
GBuffer.ToonSecondaryShadowSmoothness = ToonShadingPerMaterialCustomData.ToonSecondaryShadowSmoothness;
GBuffer.Specular = 1.0;
GBuffer.GBufferAO = 0.0;
GBuffer.PrecomputedShadowFactors.gba = 1;
break;
case SHADINGMODELID_TOON_PBR:
GBuffer.ToonSpecularColor = ToonShadingPerMaterialCustomData.ToonSpecularColor.rgb;
GBuffer.ToonShadowColor = ToonShadingPerMaterialCustomData.ToonShadowColor.rgb;
GBuffer.ToonShadowLocation = ToonShadingPerMaterialCustomData.ToonShadowLocation;
GBuffer.ToonShadowSmoothness = ToonShadingPerMaterialCustomData.ToonShadowSmoothness;
GBuffer.ToonSecondaryShadowColor = ToonShadingPerMaterialCustomData.ToonShadowColor.rgb;
GBuffer.ToonForceShadow = 1.0;
GBuffer.Specular = 1.0;
GBuffer.PrecomputedShadowFactors.gba = 1;
break;
case SHADINGMODELID_TOON_SKIN:
GBuffer.ToonShadowColor = ToonShadingPerMaterialCustomData.ToonShadowColor.rgb;
GBuffer.ToonShadowLocation = ToonShadingPerMaterialCustomData.ToonShadowLocation;
GBuffer.ToonShadowSmoothness = ToonShadingPerMaterialCustomData.ToonShadowSmoothness;
GBuffer.ToonSecondaryShadowColor = ToonShadingPerMaterialCustomData.ToonShadowColor.rgb;
GBuffer.ToonForceShadow = 1.0;
GBuffer.PrecomputedShadowFactors.g = 1;
break;
default:
break;
}
...
```
# Lighting