vault backup: 2024-12-12 22:27:42
This commit is contained in:
parent
976a4e8810
commit
580a98ee1b
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e4f9f533ecf956176b62814d03d443ce7c51b027d1d100f24a3d6c8f247bb9d9
|
||||
size 1509308
|
@ -387,6 +387,58 @@ void SetupShadowDepthPassUniformBuffer(
|
||||
}
|
||||
```
|
||||
|
||||
## FShadowDepthPassMeshProcessor
|
||||
CullMode:双面物体会使用CM_None,其余的使用 CM_CW或者CM_CCW。
|
||||
|
||||
```c++
|
||||
bool FShadowDepthPassMeshProcessor::TryAddMeshBatch(const FMeshBatch& RESTRICT MeshBatch,
|
||||
uint64 BatchElementMask,
|
||||
const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy,
|
||||
int32 StaticMeshId,
|
||||
const FMaterialRenderProxy& MaterialRenderProxy,
|
||||
const FMaterial& Material)
|
||||
{
|
||||
const bool bShouldCastShadow = Material.ShouldCastDynamicShadows();
|
||||
|
||||
const FMeshDrawingPolicyOverrideSettings OverrideSettings = ComputeMeshOverrideSettings(MeshBatch);
|
||||
const ERasterizerFillMode MeshFillMode = ComputeMeshFillMode(Material, OverrideSettings);
|
||||
|
||||
const ERasterizerCullMode MeshCullMode = FMeshPassProcessor::ComputeMeshCullMode(Material, OverrideSettings);
|
||||
ERasterizerCullMode FinalCullMode = SetupShadowCullMode(FeatureLevel, MeshPassTargetType, ShadowDepthType, Material, MeshCullMode, PrimitiveSceneProxy->CastsShadowAsTwoSided());
|
||||
|
||||
//判断是否投射动态阴影 && 是否在MainPass中渲染 && 是否会走OpaquePass
|
||||
bool bResult = true;
|
||||
if (bShouldCastShadow
|
||||
&& ShouldIncludeDomainInMeshPass(Material.GetMaterialDomain())
|
||||
&& ShouldIncludeMaterialInDefaultOpaquePass(Material)
|
||||
&& EnumHasAnyFlags(MeshSelectionMask, MeshBatch.VertexFactory->SupportsGPUScene(FeatureLevel) ? EShadowMeshSelection::VSM : EShadowMeshSelection::SM))
|
||||
{
|
||||
const FMaterialRenderProxy* EffectiveMaterialRenderProxy = &MaterialRenderProxy;
|
||||
const FMaterial* EffectiveMaterial = &Material;
|
||||
const bool bVFTypeSupportsNullPixelShader = MeshBatch.VertexFactory->SupportsNullPixelShader();
|
||||
const bool bEvaluateWPO = Material.MaterialModifiesMeshPosition_RenderThread()
|
||||
&& (!ShouldOptimizedWPOAffectNonNaniteShaderSelection() || PrimitiveSceneProxy->EvaluateWorldPositionOffset());
|
||||
|
||||
//取得NullPixelShader以及计算材质中的WPO,之后如果对没有Pixel进行写入且没有改变WPO使用默认材质渲染;否则则采用当前模型的材质。
|
||||
if (UseDefaultMaterialForShadowDepth(Material, bVFTypeSupportsNullPixelShader, bEvaluateWPO))
|
||||
{
|
||||
const FMaterialRenderProxy* DefaultProxy = UMaterial::GetDefaultMaterial(MD_Surface)->GetRenderProxy();
|
||||
const FMaterial* DefaultMaterialResource = DefaultProxy->GetMaterialNoFallback(FeatureLevel);
|
||||
check(DefaultMaterialResource);
|
||||
|
||||
// Override with the default material for opaque materials that don't modify mesh position.
|
||||
EffectiveMaterialRenderProxy = DefaultProxy;
|
||||
EffectiveMaterial = DefaultMaterialResource;
|
||||
}
|
||||
|
||||
bResult = Process(MeshBatch, BatchElementMask, StaticMeshId, PrimitiveSceneProxy, *EffectiveMaterialRenderProxy, *EffectiveMaterial, MeshFillMode, FinalCullMode);
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Lights
|
||||
### Shader
|
||||
ShadowProjectionPixelShader.usf
|
||||
|
Loading…
x
Reference in New Issue
Block a user