Changed the occlusion culling plane model to be on the XZ plane and adjusted the corner point computations
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0a1f8d75dcd85e8b4aa57f6c0c81af0300ff96915ba3c2b591095c215d5e1d8c
|
||||
size 12072
|
||||
oid sha256:75cdf73fcb9698a76a38294a1cf927a4fb41a34869e0429e1f02bf8d361a7258
|
||||
size 20400
|
||||
|
||||
+5
-5
@@ -64,18 +64,18 @@ namespace AZ
|
||||
|
||||
RPI::CullingScene::OcclusionPlane rpiOcclusionPlane;
|
||||
|
||||
static const Vector3 BL = Vector3(-0.5f, -0.5f, 0.0f);
|
||||
static const Vector3 BR = Vector3(0.5f, -0.5f, 0.0f);
|
||||
static const Vector3 TL = Vector3(-0.5f, 0.5f, 0.0f);
|
||||
static const Vector3 TR = Vector3(0.5f, 0.5f, 0.0f);
|
||||
static const Vector3 BL = Vector3(-0.5f, 0.0f, -0.5f);
|
||||
static const Vector3 TL = Vector3(-0.5f, 0.0f, 0.5f);
|
||||
static const Vector3 TR = Vector3( 0.5f, 0.0f, 0.5f);
|
||||
static const Vector3 BR = Vector3( 0.5f, 0.0f, -0.5f);
|
||||
|
||||
const AZ::Transform& transform = occlusionCullingPlane->GetTransform();
|
||||
|
||||
// convert corners to world space
|
||||
rpiOcclusionPlane.m_cornerBL = transform.TransformPoint(BL);
|
||||
rpiOcclusionPlane.m_cornerBR = transform.TransformPoint(BR);
|
||||
rpiOcclusionPlane.m_cornerTL = transform.TransformPoint(TL);
|
||||
rpiOcclusionPlane.m_cornerTR = transform.TransformPoint(TR);
|
||||
rpiOcclusionPlane.m_cornerBR = transform.TransformPoint(BR);
|
||||
|
||||
// build world space AABB
|
||||
AZ::Vector3 aabbMin = rpiOcclusionPlane.m_cornerBL.GetMin(rpiOcclusionPlane.m_cornerTR);
|
||||
|
||||
@@ -219,9 +219,9 @@ namespace AZ
|
||||
{
|
||||
// World space corners of the occluson plane
|
||||
Vector3 m_cornerBL;
|
||||
Vector3 m_cornerBR;
|
||||
Vector3 m_cornerTL;
|
||||
Vector3 m_cornerTR;
|
||||
Vector3 m_cornerBR;
|
||||
|
||||
Aabb m_aabb;
|
||||
};
|
||||
|
||||
@@ -574,18 +574,18 @@ namespace AZ
|
||||
{
|
||||
// convert to clip-space
|
||||
Vector4 projectedBL = view.GetWorldToClipMatrix() * Vector4(occlusionPlane.first.m_cornerBL);
|
||||
Vector4 projectedBR = view.GetWorldToClipMatrix() * Vector4(occlusionPlane.first.m_cornerBR);
|
||||
Vector4 projectedTL = view.GetWorldToClipMatrix() * Vector4(occlusionPlane.first.m_cornerTL);
|
||||
Vector4 projectedTR = view.GetWorldToClipMatrix() * Vector4(occlusionPlane.first.m_cornerTR);
|
||||
Vector4 projectedBR = view.GetWorldToClipMatrix() * Vector4(occlusionPlane.first.m_cornerBR);
|
||||
|
||||
// store to float array
|
||||
float verts[16];
|
||||
projectedBL.StoreToFloat4(&verts[0]);
|
||||
projectedBR.StoreToFloat4(&verts[4]);
|
||||
projectedTL.StoreToFloat4(&verts[8]);
|
||||
projectedTR.StoreToFloat4(&verts[12]);
|
||||
projectedTL.StoreToFloat4(&verts[4]);
|
||||
projectedTR.StoreToFloat4(&verts[8]);
|
||||
projectedBR.StoreToFloat4(&verts[12]);
|
||||
|
||||
static uint32_t indices[6] = { 0, 2, 1, 2, 3, 1 };
|
||||
static uint32_t indices[6] = { 0, 1, 2, 2, 3, 0 };
|
||||
|
||||
// render into the occlusion buffer, specifying BACKFACE_NONE so it functions as a double-sided occluder
|
||||
maskedOcclusionCulling->RenderTriangles((float*)verts, indices, 2, nullptr, MaskedOcclusionCulling::BACKFACE_NONE);
|
||||
|
||||
Reference in New Issue
Block a user