Developer knowledge network · moderated exchange

Супольнасць UnreliableCode

Супольнасць распрацоўшчыкаў даследаванняў, зваротнага праектавання і кадавання

Knowledge indexжыць
4Categories
919Threads
2.8KПаведамленні
Tutorial

View Frustum Culling: 6 Plane Extraction and Fast Sphere Intersection Equations in 3D [StackOverflow Architecture Guide]

matrix_math_guy
Math Specialist
MEMBER
прадстаўнік: 105
Дата далучэння: Aug 2018
Паведамленні: 52
Дзякуй: 41
1 месяцаў таму · Jun 25, 2026 7:47 PM
#1

Eliminating invisible meshes before sending draw calls to the GPU:

Extract the 6 frustum planes (Left, Right, Bottom, Top, Near, Far) from the 4x4 View-Projection Matrix ($M = V \times P$):

CPP
// Distance from bounding sphere center to frustum plane
float DistanceToPlane(const Plane& p, const Vector3& center) {
    return p.a * center.x + p.b * center.y + p.c * center.z + p.d;
}

bool IsSphereInFrustum(const Vector3& center, float radius, const Plane planes[6]) {
    for (int i = 0; i < 6; i++) {
        if (DistanceToPlane(planes[i], center) < -radius)
            return false; // Completely outside frustum!
    }
    return true; // Visible!
}

Skips 60-80% of world scene objects, saving massive GPU rasterization time!

graphics_pipeline_pro
DirectX / Vulkan Engineer
MEMBER
прадстаўнік: 172
Дата далучэння: Sep 2018
Паведамленні: 10
Дзякуй: 51
1 месяцаў таму · Jun 26, 2026 12:52 AM
#2

The plane extraction formula from the ViewProjection matrix is elegant and requires zero matrix inversion.

raycast_ryan
Ballistics Dev
MEMBER
прадстаўнік: 72
Дата далучэння: Sep 2019
Паведамленні: 32
Дзякуй: 16
1 месяцаў таму · Jun 26, 2026 2:39 PM
#3

Vectorizing the 6 plane tests with AVX2 allows culling 50,000 objects in < 1 millisecond on CPU.