Fix Global Surface Atlas drawing of objects that are hidden in GBuffer pass but should be visible for GI

This commit is contained in:
Wojciech Figat
2022-08-09 14:37:29 +02:00
parent 210342d337
commit 6a1378ebdb
8 changed files with 13 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ PACK_STRUCT(struct DeferredMaterialShaderData {
DrawPass DeferredMaterialShader::GetDrawModes() const
{
return DrawPass::Depth | DrawPass::GBuffer | DrawPass::MotionVectors | DrawPass::QuadOverdraw;
return DrawPass::Depth | DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas | DrawPass::MotionVectors | DrawPass::QuadOverdraw;
}
bool DeferredMaterialShader::CanUseLightmap() const

View File

@@ -32,6 +32,8 @@ private:
case DrawPass::Depth:
return useSkinning ? &DepthSkinned : &Depth;
case DrawPass::GBuffer:
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
case DrawPass::GlobalSurfaceAtlas:
return useLightmap ? &DefaultLightmap : (useSkinning ? &DefaultSkinned : &Default);
case DrawPass::MotionVectors:
return useSkinning ? (perBoneMotionBlur ? &MotionVectorsSkinnedPerBone : &MotionVectorsSkinned) : &MotionVectors;

View File

@@ -153,7 +153,7 @@ bool DeformableMaterialShader::Load()
if (_info.BlendMode == MaterialBlendMode::Opaque)
{
_drawModes = DrawPass::GBuffer;
_drawModes |= DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
// GBuffer Pass
psDesc.VS = _shader->GetVS("VS_SplineModel");
@@ -162,7 +162,7 @@ bool DeformableMaterialShader::Load()
}
else
{
_drawModes = DrawPass::Forward;
_drawModes |= DrawPass::Forward;
// Forward Pass
psDesc.VS = _shader->GetVS("VS_SplineModel");

View File

@@ -25,6 +25,8 @@ private:
case DrawPass::Depth:
return &Depth;
case DrawPass::GBuffer:
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
case DrawPass::GlobalSurfaceAtlas:
case DrawPass::Forward:
return &Default;
#if USE_EDITOR

View File

@@ -39,7 +39,7 @@ PACK_STRUCT(struct TerrainMaterialShaderData {
DrawPass TerrainMaterialShader::GetDrawModes() const
{
return DrawPass::Depth | DrawPass::GBuffer;
return DrawPass::Depth | DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
}
bool TerrainMaterialShader::CanUseLightmap() const

View File

@@ -26,6 +26,8 @@ private:
case DrawPass::Depth:
return &Depth;
case DrawPass::GBuffer:
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
case DrawPass::GlobalSurfaceAtlas:
return useLightmap ? &DefaultLightmap : &Default;
#if USE_EDITOR
case DrawPass::QuadOverdraw:

View File

@@ -513,7 +513,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
RenderContext renderContextTiles = renderContext;
renderContextTiles.List = RenderList::GetFromPool();
renderContextTiles.View.Pass = DrawPass::GBuffer;
renderContextTiles.View.Pass = DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
renderContextTiles.View.Mode = ViewMode::Default;
renderContextTiles.View.ModelLODBias += 100000;
renderContextTiles.View.ShadowModelLODBias += 100000;
@@ -582,7 +582,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
// Fake projection matrix to disable Screen Size culling based on RenderTools::ComputeBoundsScreenRadiusSquared
renderContextTiles.View.Projection.Values[0][0] = 10000.0f;
// Collect draw calls for the object
object.Actor->Draw(renderContextTiles);

View File

@@ -430,7 +430,7 @@ void RenderList::AddDrawCall(DrawPass drawModes, StaticFlags staticFlags, DrawCa
{
DrawCallsLists[(int32)DrawCallsListType::Depth].Indices.Add(index);
}
if (mask & DrawPass::GBuffer)
if (mask & (DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas))
{
if (receivesDecals)
DrawCallsLists[(int32)DrawCallsListType::GBuffer].Indices.Add(index);