vault backup: 2024-06-21 11:07:35

This commit is contained in:
BlueRose 2024-06-21 11:07:35 +08:00
parent 32001bcf8c
commit 55ee595157
2 changed files with 77 additions and 1 deletions

View File

@ -1 +1 @@
{"JNCustomAssetEd定义修型资产":{"JNCustomAssetEd定义修型资产":{"currentFile":{"count":1,"lastUpdated":1715827692229}}},"GreenScreen":{"GreenScreen":{"currentFile":{"count":1,"lastUpdated":1715843645080}}},"Character":{"Character":{"currentFile":{"count":1,"lastUpdated":1715848900346}}},"定义了·FGuid":{"定义了·FGuid":{"currentFile":{"count":1,"lastUpdated":1715915171873}}},"例如Idol.BeiLa。以及FollowingSocketName":{"例如Idol.BeiLa。以及FollowingSocketName":{"currentFile":{"count":1,"lastUpdated":1716192086731}}},"DirectorCamera为场景相关的相机静态镜头。":{"DirectorCamera为场景相关的相机静态镜头。":{"currentFile":{"count":1,"lastUpdated":1716192192053}}},"ECS资料":{"ECS资料":{"currentFile":{"count":1,"lastUpdated":1716465594941}}},"DebugView":{"DebugView":{"internalLink":{"count":1,"lastUpdated":1716796051996}}},".p4ignore":{".p4ignore":{"currentFile":{"count":1,"lastUpdated":1717048569032}}},"admin":{"admin":{"currentFile":{"count":1,"lastUpdated":1717123692206}}},"具体的命令应该说是":{"具体的命令应该说是":{"currentFile":{"count":1,"lastUpdated":1717749753511}}},"添加一个Idol.xxx标签。":{"添加一个Idol.xxx标签。":{"currentFile":{"count":2,"lastUpdated":1718092533903}}}}
{"ECS资料":{"ECS资料":{"currentFile":{"count":1,"lastUpdated":1716465594941}}},"DebugView":{"DebugView":{"internalLink":{"count":1,"lastUpdated":1716796051996}}},".p4ignore":{".p4ignore":{"currentFile":{"count":1,"lastUpdated":1717048569032}}},"admin":{"admin":{"currentFile":{"count":1,"lastUpdated":1717123692206}}},"具体的命令应该说是":{"具体的命令应该说是":{"currentFile":{"count":1,"lastUpdated":1717749753511}}},"添加一个Idol.xxx标签。":{"添加一个Idol.xxx标签。":{"currentFile":{"count":2,"lastUpdated":1718092533903}}},"FGBufferData":{"FGBufferData":{"currentFile":{"count":1,"lastUpdated":1718936545718}}}}

View File

@ -35,8 +35,84 @@ static FToonShadingPerMaterialCustomData ToonShadingPerMaterialCustomData;
## DeferredShadingCommon.ush
1. 实现[[#Encode/Decode函数]]
2. HasCustomGBufferData()函数添加对应的ToonShadingModel宏判断
3. [[#FGBufferData新增变量]]
4. 在Encode/Decode GBufferData中新增逻辑。
### Encode/Decode函数
RGB655 to 8-bit RGB。
将R 256 => 64 ,GB 256 => 32。之后使用2个8bit浮点来存储通道1存储R与G的头两位通道2存储G的后3位与B。
```c++
float2 EncodeColorToRGB655(float3 Color)
{
const uint ChannelR = (1 << 6) - 1;
const uint ChannelG = (1 << 5) - 1;
const uint ChannelB = (1 << 5) - 1;
uint3 RoundedColor = uint3(float3(
round(Color.r * ChannelR),
round(Color.g * ChannelG),
round(Color.b * ChannelB)
));
return float2(
(RoundedColor.r << 2 | RoundedColor.g >> 3) / 255.0,
(RoundedColor.g << 5 | RoundedColor.b ) / 255.0
);
}
float3 DecodeRGB655ToColor(float2 RGB655)
{
const uint ChannelR = (1 << 6) - 1;
const uint ChannelG = (1 << 5) - 1;
const uint ChannelB = (1 << 5) - 1;
uint2 Inputs = uint2(round(RGB655 * 255.0));
uint BitBuffer = (Inputs.x << 8) | Inputs.y;
uint R = (BitBuffer & 0xFC00) >> 10;
uint G = (BitBuffer & 0x03E0) >> 5;
uint B = (BitBuffer & 0x001F);
return float3(R, G, B) * float3(1.0 / ChannelR, 1.0 / ChannelG, 1.0 / ChannelB);
}
```
### FGBufferData新增变量
```c++
struct FGBufferData
{
...
// Toon specular
// 0..1, specular color
half3 ToonSpecularColor;
// 0..1, specular edge position
half ToonSpecularLocation;
// 0..1, specular edge smoothness
half ToonSpecularSmoothness;
// Toon shadow
// 0..1, shadow color
half3 ToonShadowColor;
// 0..1, shadow egde location
half ToonShadowLocation;
// 0..1, shadow edge smoothness
half ToonShadowSmoothness;
// 0..1, force shadow
half ToonForceShadow;
// Toon secondary shadow
// 0..1, secondary shadow color
float3 ToonSecondaryShadowColor;
// 0..1, secondary shadow edge location
float ToonSecondaryShadowLocation;
// 0..1, secondary shadow edge smoothness
float ToonSecondaryShadowSmoothness;
// Toon render
half3 ToonCalcShadowColor;
};
```
# BasePass
BasePassPixelShader.usf