Frustum culling in opengl
This presentation is the property of its rightful owner.
Sponsored Links
1 / 42

Frustum Culling in OpenGL PowerPoint PPT Presentation


  • 38 Views
  • Uploaded on
  • Presentation posted in: General

Frustum Culling in OpenGL. Ref: MarkMoley.com. Culling Techniques. Outline. Introduction View Frustum Plane Equation Frustum Plane Extraction Frustum/Point/Sphere Inclusion Tests. Definition (View Frustum). the volume of space that includes everything visible from a given viewpoint

Download Presentation

Frustum Culling in OpenGL

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Frustum culling in opengl

Frustum Culling in OpenGL

Ref: MarkMoley.com

Fall 2006 revised


Culling techniques

Culling Techniques

Fall 2006 revised


Outline

Outline

  • Introduction

    • View Frustum

    • Plane Equation

  • Frustum Plane Extraction

  • Frustum/Point/Sphere Inclusion Tests

Fall 2006 revised


Definition view frustum

Definition (View Frustum)

  • the volume of space that includes everything visible from a given viewpoint

  • defined by six planes arranged in the shape of a pyramid with the top chopped off

  • If a point is inside this volume then it's in the frustum and it's visible, and vice versa

    • Visible here mean potentially visible. It might be behind another point that obscures it, but it's still in the frustum. … the scope of occlusion culling

Fall 2006 revised


View frustum cont

View Frustum (cont)

Fall 2006 revised


Definition plane

Definition (Plane)

  • Divide the space into two halves; extends to infinity

  • any given point is (in front of | behind | on) the plane.

  • In R3, a plane is defined by four numbers:

    • A plane equation: Ax + By + Cz +D = 0

Fall 2006 revised


Plane equation

Plane Equation

Fall 2006 revised


Normalized plane equation

Normalized Plane Equation

Fall 2006 revised


Frustum culling

Frustum Culling

  • Idea:

    • If object is not in frustum, do not send it through pipeline (it is not visible)

    • Wrap the object in a bounding volume; test the bounding volume against frustum (in world coordinate system)

      • Sphere, bounding boxes, …

  • Tasks:

    • Frustum plane extraction

    • Inclusion tests for different bounding volumes

Fall 2006 revised


Frustum plane extraction

u

s

t

M

P

Frustum Plane Extraction

  • The rendering pipeline:

Fall 2006 revised


Rendering pipeline cont

u

s

t

M

P

Rendering Pipeline (cont)

c : product of PM

In OpenGL,clip volume is [-1,1]3

Fall 2006 revised


Frustum plane extraction left

uy

ux

-1

1

Left

Frustum Plane Extraction (Left)

Fall 2006 revised


Left plane cont

The left plane in clip coordinate:

The corresponding equation in world coordinate:

uy

ux

-1

1

Left

Left Plane (cont)

Fall 2006 revised


Frustum plane extraction right

uy

ux

-1

1

Right

Frustum Plane Extraction (Right)

Fall 2006 revised


Right plane cont

The right plane in clip coordinate:

The corresponding equation in world coordinate:

Right

uy

ux

-1

1

Right Plane (cont)

Fall 2006 revised


Summary

Summary

Fall 2006 revised


Pointinfrustum test

PointInFrustum Test

  • A point in frustumin all 6 halfspaces

The valid sides of all halfspaces are > 0

Fall 2006 revised


Sphereinfrustum test

SphereInFrustum Test

p

p

PointInOffsetFrustum Test

Minkowski sum of sphere and frustum

Fall 2006 revised


Minkowski sum

Minkowski Sum

Coordinate dependent!

Fall 2006 revised


Signed distance to left plane

uy

ux

-1

1

Left

Signed Distance to Left Plane

  • Plane equations are further normalized to facilitate distance computation

d<0

Fall 2006 revised


Remarks

Remarks

  • Use bounding spheres

    • Can be conservative if the object is slender

  • Use hierarchical bounding volume where appropriate (see next page)

  • BoxInFrustum:

    • complicated and expensive

    • AABB: already so

    • OBB: more so

Fall 2006 revised


How can bounding volume hierarchies help

How can bounding volume hierarchies help?

View-frustum culling

Ray-tracing

Collision detection

Fall 2006 revised


How can bounding volume hierarchies help1

How can bounding volume hierarchies help?

View-frustum culling

Ray-tracing

Collision detection

Fall 2006 revised


How can bounding volume hierarchies help2

How can bounding volume hierarchies help?

View-frustum culling

Ray-tracing

Collision detection

Fall 2006 revised


How can bounding volume hierarchies help3

How can bounding volume hierarchies help?

View-frustum culling

Ray-tracing

Collision detection

Fall 2006 revised


Example culling off fps 15 5

Example (Culling Off: FPS 15.5)

Fall 2006 revised


Example culling on fps 31 0

Example (Culling On: FPS 31.0)

Fall 2006 revised


Epilogue

Epilogue

Portal rendering

World coordinates?!

Plane representation in R3

Fall 2006 revised


Indoor scenes

Similar to building walkthrough

Occlusions in scene are common (culling important)

Geometric database can be huge; preprocessing is required to facilitate smooth viewing

Indoor Scenes

Fall 2006 revised


Preprocessing for indoor scenes

Potential visible set (PVS)

only load the rooms that are visible from the current room

Preprocessing for Indoor Scenes

Fall 2006 revised


Frustum culling in opengl

1

7

2

4

3

6

5

E

M

B

8

L

C

R

Ki

K

M

Portal Rendering

B

1

4

E

2

C

7

3

6

5

L

8

R

K

Fall 2006 revised

Ki


Portal rendering

Portal Rendering

  • only render the other rooms in PVS if the “portal surfaces” are in sight

Fall 2006 revised


Earlier we said

u

s

t

M

P

Earlier, we said…

But aren’t slocal coordinates?

Fall 2006 revised


Recall pipeline

Modelview

Matrix

Viewing

Transform

Model

Transform

world

coordinates

Recall Pipeline…

Fall 2006 revised


Frustum culling scenario

the scene is (mostly) static and specified in their world coordinate (the modeling transform is identity)

the viewer navigates around them, changing the viewing transform only

Frustum Culling Scenario

Fall 2006 revised


Therefore

Modelview

Matrix

Viewing

Transform

Model

Transform

world

coordinates

Therefore …

I

t

u

s

t = PMs

M : viewing transform

s : world coordinate

Fall 2006 revised


Verification

x–z+10

L

R

–x–z+10

X

Z

Verification

Fall 2006 revised


Supplement representing a plane in r 3

Supplement: Representing a Plane in R3

x: pivot variable

Fall 2006 revised


Plane in r 3 cont

Plane in R3 (cont)

n

x

p

Fall 2006 revised


Summary1

Summary

  • Algebraic equation

  • Parametric equation

  • Vector equation

  • Depending on the application, select the most suitable equation

    • In/out test

    • Projection

Fall 2006 revised


Screen space bounding box ssbb

Compute and display the screen-space bounding box of an AABB (axis-aligned bounding box)

Convert world coordinates to clip coordinates, perspective-divide to get window coordinates

Useful in GPU-assisted collision detection applications

Screen-Space Bounding Box (SSBB)

Fall 2006 revised


Display viewing frustum

Useful for projective texturing (showing where the projector is)

Useful for illustrating frustum culling

Given [-1,1]3 clip coordinates, determine their corresponding world coordinates to render

Display Viewing Frustum

Fall 2006 revised


  • Login