vault backup: 2024-12-13 16:22:58
This commit is contained in:
parent
fad004ded0
commit
934d40aff9
@ -827,3 +827,52 @@ if (RendererOutput == ERendererOutput::DepthPrepassOnly)
|
|||||||
ComputeLightGridOutput = GatherLightsAndComputeLightGrid(GraphBuilder, bComputeLightGrid, SortedLightSet);
|
ComputeLightGridOutput = GatherLightsAndComputeLightGrid(GraphBuilder, bComputeLightGrid, SortedLightSet);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# 半程阴影
|
||||||
|
由晨风&Neverwind提出:
|
||||||
|
- 【[UFSH2024]用虚幻引擎5为《幻塔》定制高品质动画流程风格化渲染管线 | 晨风 Neverwind 完美世界游戏】 【精准空降到 07:27】 https://www.bilibili.com/video/BV1rW2LYvEox/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e&t=447
|
||||||
|
|
||||||
|
**阴影Setup阶段**:
|
||||||
|
```c++
|
||||||
|
if 启用半程阴影:
|
||||||
|
{
|
||||||
|
额外进行一次CreatePerObjectProjectedShadow()
|
||||||
|
{
|
||||||
|
处理阴影光照Matrix
|
||||||
|
向阴影信息写入IsHalfViewShadowFlag
|
||||||
|
用新的光源方向画Atlas
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**阴影Projection阶段**:
|
||||||
|
//此阶段需要屏蔽角色投射到自己的非半程阴影
|
||||||
|
//和角色投射到场景中会跟随视角移动的阴影
|
||||||
|
```c++
|
||||||
|
if(Toon材质,且没有程阴影Flag的阴影
|
||||||
|
&&非Toon材质但有半程阴影Flag的阴影)
|
||||||
|
{
|
||||||
|
屏蔽此阴影
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
截图代码:
|
||||||
|
```c++
|
||||||
|
if(PrimitiveSceneinfo->Proxy->IsToonDisableSelfShadow())
|
||||||
|
{
|
||||||
|
...
|
||||||
|
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
|
||||||
|
{
|
||||||
|
const FViewInfo& View = Views[ViewIndex];
|
||||||
|
const FMatrix& ViewMatrix = View.ShadowViewMatrices.GetViewMatrix()
|
||||||
|
FVector LightDirection = Lightsceneinfo->Proxy- GetDirection();
|
||||||
|
const FVector CameraDirection = ViewMatrix.GetColumn(2).GetSafeNonmal()
|
||||||
|
float LightViewBlendFactor = PrimitiveSceneinfo->Proxy->GetToonHalfVienShadowFactor();
|
||||||
|
Fvector HalfViewLightDir = (LightDirection + ( 1 - LightViewBlendFactor) + CameraDirection * LightViewBlendFactor).GetSafeNormal();
|
||||||
|
FMatrix FinalCombineMatrix = FNnverseRotationMatrix(HalfViewLightDir.Rotation())
|
||||||
|
ShadowInitializer.WorldTolight = FinalCombineMatrix;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user