Add Graphics::MotionVectors::MinObjectScreenSize to skip too small objects from drawing motion vectors

This commit is contained in:
2026-05-04 17:29:58 +02:00
parent 429f8e5336
commit cbcfa4013b
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -32,6 +32,7 @@ bool Graphics::SpreadWorkload = true;
#if !BUILD_RELEASE || USE_EDITOR
float Graphics::TestValue = 0.0f;
#endif
float Graphics::MotionVectors::MinObjectScreenSize = 0.02f;
float Graphics::Shadows::MinObjectPixelSize = 2.0f;
bool Graphics::PostProcessing::ColorGradingVolumeLUT = true;
+9
View File
@@ -110,6 +110,15 @@ public:
API_FIELD() static float MinObjectPixelSize;
};
// Motion Vectors rendering configuration.
API_CLASS(Static, Attributes="DebugCommand") class FLAXENGINE_API MotionVectors
{
DECLARE_SCRIPTING_TYPE_MINIMAL(MotionVectors);
// The minimum screen size of objects to draw motion vectors. Improves performance by skipping too small objects (eg. sub-pixel) from rendering motion vectors.
API_FIELD() static float MinObjectScreenSize;
};
// Post Processing effects rendering configuration.
API_CLASS(Static, Attributes="DebugCommand") class FLAXENGINE_API PostProcessing
{
+6 -2
View File
@@ -710,7 +710,9 @@ void RenderList::AddDrawCall(const RenderContext& renderContext, DrawPass drawMo
{
DrawCallsLists[(int32)DrawCallsListType::Distortion].Indices.Add(index);
}
if ((drawModes & DrawPass::MotionVectors) != DrawPass::None && (staticFlags & StaticFlags::Transform) == StaticFlags::None)
if ((drawModes & DrawPass::MotionVectors) != DrawPass::None &&
(staticFlags & StaticFlags::Transform) == StaticFlags::None &&
RenderTools::ComputeBoundsScreenRadiusSquared(drawCall.ObjectPosition, drawCall.ObjectRadius, renderContext.View) > Math::Square(Graphics::MotionVectors::MinObjectScreenSize))
{
DrawCallsLists[(int32)DrawCallsListType::MotionVectors].Indices.Add(index);
}
@@ -756,7 +758,9 @@ void RenderList::AddDrawCall(const RenderContextBatch& renderContextBatch, DrawP
{
DrawCallsLists[(int32)DrawCallsListType::Distortion].Indices.Add(index);
}
if ((drawModes & DrawPass::MotionVectors) != DrawPass::None && (staticFlags & StaticFlags::Transform) == StaticFlags::None)
if ((drawModes & DrawPass::MotionVectors) != DrawPass::None &&
(staticFlags & StaticFlags::Transform) == StaticFlags::None &&
RenderTools::ComputeBoundsScreenRadiusSquared(bounds.Center, (float)bounds.Radius, mainRenderContext.View) > Math::Square(Graphics::MotionVectors::MinObjectScreenSize))
{
DrawCallsLists[(int32)DrawCallsListType::MotionVectors].Indices.Add(index);
}