Fix model screen size calculation in orthographic view projections

#980
This commit is contained in:
2023-05-08 12:44:01 +02:00
parent aeda759086
commit a5afa04f8f
2 changed files with 2 additions and 4 deletions
+1 -1
View File
@@ -395,7 +395,7 @@ uint64 RenderTools::CalculateTextureMemoryUsage(PixelFormat format, int32 width,
float RenderTools::ComputeBoundsScreenRadiusSquared(const Float3& origin, float radius, const Float3& viewOrigin, const Matrix& projectionMatrix)
{
const float screenMultiple = 0.5f * Math::Max(projectionMatrix.Values[0][0], projectionMatrix.Values[1][1]);
const float distSqr = Float3::DistanceSquared(origin, viewOrigin);
const float distSqr = Float3::DistanceSquared(origin, viewOrigin) * projectionMatrix.Values[2][3];
return Math::Square(screenMultiple * radius) / Math::Max(1.0f, distSqr);
}
+1 -3
View File
@@ -73,9 +73,7 @@ void RenderView::PrepareCache(const RenderContext& renderContext, float width, f
WorldPosition = Origin + Position;
// Ortho views have issues with screen size LOD culling
const float modelLODDistanceFactor = (renderContext.LodProxyView ? renderContext.LodProxyView->IsOrthographicProjection() : IsOrthographicProjection()) ? 100.0f : ModelLODDistanceFactor;
ModelLODDistanceFactorSqrt = modelLODDistanceFactor * modelLODDistanceFactor;
ModelLODDistanceFactorSqrt = ModelLODDistanceFactor * ModelLODDistanceFactor;
// Setup main view render info
if (!mainView)