Fix Global Surface Atlas drawing of objects that are hidden in GBuffer pass but should be visible for GI
This commit is contained in:
@@ -42,7 +42,7 @@ PACK_STRUCT(struct DeferredMaterialShaderData {
|
|||||||
|
|
||||||
DrawPass DeferredMaterialShader::GetDrawModes() const
|
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
|
bool DeferredMaterialShader::CanUseLightmap() const
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ private:
|
|||||||
case DrawPass::Depth:
|
case DrawPass::Depth:
|
||||||
return useSkinning ? &DepthSkinned : &Depth;
|
return useSkinning ? &DepthSkinned : &Depth;
|
||||||
case DrawPass::GBuffer:
|
case DrawPass::GBuffer:
|
||||||
|
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
|
||||||
|
case DrawPass::GlobalSurfaceAtlas:
|
||||||
return useLightmap ? &DefaultLightmap : (useSkinning ? &DefaultSkinned : &Default);
|
return useLightmap ? &DefaultLightmap : (useSkinning ? &DefaultSkinned : &Default);
|
||||||
case DrawPass::MotionVectors:
|
case DrawPass::MotionVectors:
|
||||||
return useSkinning ? (perBoneMotionBlur ? &MotionVectorsSkinnedPerBone : &MotionVectorsSkinned) : &MotionVectors;
|
return useSkinning ? (perBoneMotionBlur ? &MotionVectorsSkinnedPerBone : &MotionVectorsSkinned) : &MotionVectors;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ bool DeformableMaterialShader::Load()
|
|||||||
|
|
||||||
if (_info.BlendMode == MaterialBlendMode::Opaque)
|
if (_info.BlendMode == MaterialBlendMode::Opaque)
|
||||||
{
|
{
|
||||||
_drawModes = DrawPass::GBuffer;
|
_drawModes |= DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
|
||||||
|
|
||||||
// GBuffer Pass
|
// GBuffer Pass
|
||||||
psDesc.VS = _shader->GetVS("VS_SplineModel");
|
psDesc.VS = _shader->GetVS("VS_SplineModel");
|
||||||
@@ -162,7 +162,7 @@ bool DeformableMaterialShader::Load()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_drawModes = DrawPass::Forward;
|
_drawModes |= DrawPass::Forward;
|
||||||
|
|
||||||
// Forward Pass
|
// Forward Pass
|
||||||
psDesc.VS = _shader->GetVS("VS_SplineModel");
|
psDesc.VS = _shader->GetVS("VS_SplineModel");
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ private:
|
|||||||
case DrawPass::Depth:
|
case DrawPass::Depth:
|
||||||
return &Depth;
|
return &Depth;
|
||||||
case DrawPass::GBuffer:
|
case DrawPass::GBuffer:
|
||||||
|
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
|
||||||
|
case DrawPass::GlobalSurfaceAtlas:
|
||||||
case DrawPass::Forward:
|
case DrawPass::Forward:
|
||||||
return &Default;
|
return &Default;
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ PACK_STRUCT(struct TerrainMaterialShaderData {
|
|||||||
|
|
||||||
DrawPass TerrainMaterialShader::GetDrawModes() const
|
DrawPass TerrainMaterialShader::GetDrawModes() const
|
||||||
{
|
{
|
||||||
return DrawPass::Depth | DrawPass::GBuffer;
|
return DrawPass::Depth | DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerrainMaterialShader::CanUseLightmap() const
|
bool TerrainMaterialShader::CanUseLightmap() const
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ private:
|
|||||||
case DrawPass::Depth:
|
case DrawPass::Depth:
|
||||||
return &Depth;
|
return &Depth;
|
||||||
case DrawPass::GBuffer:
|
case DrawPass::GBuffer:
|
||||||
|
case DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas:
|
||||||
|
case DrawPass::GlobalSurfaceAtlas:
|
||||||
return useLightmap ? &DefaultLightmap : &Default;
|
return useLightmap ? &DefaultLightmap : &Default;
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
case DrawPass::QuadOverdraw:
|
case DrawPass::QuadOverdraw:
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
|
|
||||||
RenderContext renderContextTiles = renderContext;
|
RenderContext renderContextTiles = renderContext;
|
||||||
renderContextTiles.List = RenderList::GetFromPool();
|
renderContextTiles.List = RenderList::GetFromPool();
|
||||||
renderContextTiles.View.Pass = DrawPass::GBuffer;
|
renderContextTiles.View.Pass = DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas;
|
||||||
renderContextTiles.View.Mode = ViewMode::Default;
|
renderContextTiles.View.Mode = ViewMode::Default;
|
||||||
renderContextTiles.View.ModelLODBias += 100000;
|
renderContextTiles.View.ModelLODBias += 100000;
|
||||||
renderContextTiles.View.ShadowModelLODBias += 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
|
// Fake projection matrix to disable Screen Size culling based on RenderTools::ComputeBoundsScreenRadiusSquared
|
||||||
renderContextTiles.View.Projection.Values[0][0] = 10000.0f;
|
renderContextTiles.View.Projection.Values[0][0] = 10000.0f;
|
||||||
|
|
||||||
// Collect draw calls for the object
|
// Collect draw calls for the object
|
||||||
object.Actor->Draw(renderContextTiles);
|
object.Actor->Draw(renderContextTiles);
|
||||||
|
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ void RenderList::AddDrawCall(DrawPass drawModes, StaticFlags staticFlags, DrawCa
|
|||||||
{
|
{
|
||||||
DrawCallsLists[(int32)DrawCallsListType::Depth].Indices.Add(index);
|
DrawCallsLists[(int32)DrawCallsListType::Depth].Indices.Add(index);
|
||||||
}
|
}
|
||||||
if (mask & DrawPass::GBuffer)
|
if (mask & (DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas))
|
||||||
{
|
{
|
||||||
if (receivesDecals)
|
if (receivesDecals)
|
||||||
DrawCallsLists[(int32)DrawCallsListType::GBuffer].Indices.Add(index);
|
DrawCallsLists[(int32)DrawCallsListType::GBuffer].Indices.Add(index);
|
||||||
|
|||||||
Reference in New Issue
Block a user