scenevisibility.cpp
MarkRelevant()
逐个primitive 加到 分属于各个pass的渲染list
ComputeDynamicMeshRelevance()
NumElements = MeshBatch.Mesh->Elements.Num();
每个pass里elements数量更新
MobileBasePass.cpp
FMobileBasePassMeshProcessor::Process()
定义回调
meshBatch
FMeshPassProcessor postprocess前面各个pass继承这个processor有自己的rendering
MobileShadingRenderer.cpp
SetupMobileBasePassAfterShadowInit()
添加回调
总的结构
renderer里 排布各个pass
pass用的数据来自meshPassProcessor (FCustomDepthPassMeshProcessor)
xxRendering里(或者setup)定义processor addMeshBatch,用父类meshPassProcessor.addMeshBatch
它们被renderer的render()调用 位于renderer这层 物理位置在rendering.cpp
FPrimitiveViewRelevance
FPrimitiveSceneProxy::FPrimitiveSceneProxy(const UPrimitiveComponent* InComponent, FName InResourceName)
, bCastVolumetricTranslucentShadow(InComponent->bCastDynamicShadow && InComponent->CastShadow && InComponent->bCastVolumetricTranslucentShadow)
if (MeshBatch.CastShadow) { // Determine the mesh's material and blend mode. const FMaterialRenderProxy* FallbackMaterialRenderProxyPtr = nullptr; const FMaterial& Material = MeshBatch.MaterialRenderProxy->GetMaterialWithFallback(FeatureLevel, FallbackMaterialRenderProxyPtr); const FMaterialRenderProxy& MaterialRenderProxy = FallbackMaterialRenderProxyPtr ? *FallbackMaterialRenderProxyPtr : *MeshBatch.MaterialRenderProxy; const EBlendMode BlendMode = Material.GetBlendMode(); const float MaterialTranslucentShadowStartOffset = Material.GetTranslucentShadowStartOffset(); const FMeshDrawingPolicyOverrideSettings OverrideSettings = ComputeMeshOverrideSettings(MeshBatch); const ERasterizerFillMode MeshFillMode = ComputeMeshFillMode(MeshBatch, Material, OverrideSettings); const ERasterizerCullMode MeshCullMode = ComputeMeshCullMode(MeshBatch, Material, OverrideSettings); const bool bIsTranslucent = IsTranslucentBlendMode(BlendMode);
开关数据放在material里 用这种方式拿到
还可以放component 作用于整个mesh的数据
设置pass rt
BeginRenderPass