From 74bd05030d9f8d370bb4d7769acbb9ac8e8e4ba1 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Tue, 13 Nov 2012 09:13:49 +1100 Subject: [PATCH 1/2] Consider zoom when culling billboards. screenScale represents the current zoom factor, but may need some revision because I'm not sure if what it's doing is technically correct. It is used to multiply the culling distance for cells, as well as the fading distance. --- Engine/source/T3D/fx/groundCover.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 1911f0a78..71a6f7770 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1550,8 +1550,10 @@ void GroundCover::prepRenderImage( SceneRenderState *state ) { PROFILE_SCOPE( GroundCover_RenderBillboards ); + F32 screenScale = state->getWorldToScreenScale().y / state->getViewport().extent.y; + // Set the far distance for billboards. - mCuller.setFarDist( mRadius ); + mCuller.setFarDist( mRadius * screenScale ); F32 cullScale = 1.0f; if ( state->isReflectPass() ) @@ -1560,7 +1562,7 @@ void GroundCover::prepRenderImage( SceneRenderState *state ) // Setup our shader const data. // Must be done prior to submitting our render instance. - mShaderConstData.fadeInfo.set( mFadeRadius * cullScale, mRadius * cullScale ); + mShaderConstData.fadeInfo.set( mFadeRadius * cullScale * screenScale, mRadius * cullScale * screenScale ); const F32 simTime = Sim::getCurrentTime() * 0.001f; From 027d5608bdd56dcd3376f2c43ada865a6c875801 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Tue, 13 Nov 2012 10:21:03 +1100 Subject: [PATCH 2/2] Added comment. --- Engine/source/T3D/fx/groundCover.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 71a6f7770..53c910c3c 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1550,6 +1550,7 @@ void GroundCover::prepRenderImage( SceneRenderState *state ) { PROFILE_SCOPE( GroundCover_RenderBillboards ); + // Take zoom into account. F32 screenScale = state->getWorldToScreenScale().y / state->getViewport().extent.y; // Set the far distance for billboards.