+ All Categories
Home > Documents > David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke...

David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke...

Date post: 14-Dec-2015
Category:
Upload: roxanne-hudson
View: 220 times
Download: 0 times
Share this document with a friend
25
David Luebke 06/23/22 CS 551 / 645: Introductory Computer Graphics David Luebke [email protected] http://www.cs.virginia.edu/~cs551
Transcript
Page 1: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

CS 551 / 645: Introductory Computer Graphics

David Luebke

[email protected]

http://www.cs.virginia.edu/~cs551

Page 2: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Recap: Z-Buffer Pros

Simple!!! Easy to implement in hardware Polygons can be processed in arbitrary order Easily handles polygon interpenetration Enables deferred shading

– Rasterize shading parameters (e.g., surface normal) and only shade final visible fragments

– When does this help?

Page 3: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Recap: Z-Buffer Cons

Lots of memory (e.g. 1280x1024x32 bits) Read-Modify-Write in inner loop requires fast

memory Hard to do analytic antialiasing Hard to simulate translucent polygons Precision issues (scintillating, worse with

perspective projection)

Page 4: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing

Idea: – trace a ray from the eyepoint through the center

of each pixel– Color pixel according to the first object the ray hits– Simple! No need for:

Perspective projection matrices Clipping Scan conversion of polygons

Page 5: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing

An example:

ScreenEyepoint Scene

Page 6: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing

An example:

ScreenEyepoint Scene

Page 7: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing

Two flavors of the algorithm:– Ray casting just finds visible surfaces– Recursive ray tracing traces additional rays from

those surfaces for sophisticated shading Shadows Reflection Refraction

Page 8: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing: The Catch

Ray tracing is a simple, powerful way to determine visibility & shading

So why don’t we always use it?

Page 9: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Ray Tracing: The Catch

Ray tracing is a simple, powerful way to determine visibility & shading

So why don’t we always use it? Too slow!

– Complexity proportional to # of pixels– Typical screen: ~1,000,000 pixels– Typical scene:« 1,000,000 polygons

Page 10: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Visibility Algorithms

The Z-buffer is an image-space algorithm– Takes place at the end of the pipeline, in screen-

space coordinates

BSP Trees are an object-space algorithm– Takes place in world-space coordinates

Warnock’s algorithm is a hybrid – Uses both screen-space and object-space

information

How would you classify ray casting?

Page 11: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Visibility Algorithms

The 70’s were the decade of analytic object-space algorithms

In the mid-80’s, memory got cheap enough that Z-buffers became the practical choice

Then history repeated itself… Next up: conservative visibility algorithms for

reducing load from the front end of the rendering pipeline

Page 12: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Conservative Visibility Agorithms

View-frustum culling– Organize primitives into clumps with a simple

bounding volume– Before rendering the primitives in a clump, test its

bounding volume against the view frustum If the clump is entirely outside the view frustum, don’t

render any of the primitives If the clump intersects the view frustum, render normally If the clump is entirely within the view frustum, can

render with clipping disabled

Page 13: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Efficient View-Frustum Culling

How big should the clumps be?– Choose minimum size so:

cost testing bounding volume << cost clipping primitive

– Organize bounding volumes into a hierarchy for more efficient testing

A general strategy known as hierarchical bounding volumes

Page 14: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Efficient View-Frustum Culling

What shape should bounding volumes be?– Spheres and axis-aligned bounding boxes are

simple to calculate and cheap to test– Oriented bounding boxes converge asymptotically

faster in theory– Lots of other volumes have been proposed, but

most people still use spheres and AABBs.

Page 15: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Efficient View-Frustum Culling

Where in the pipeline should view-frustum culling be performed?– As early as possible (world coordinates)

Page 16: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

Goal: walk through architectural models (buildings, cities, catacombs…)

These divide naturally into cells– Rooms, alcoves, corridors…

Transparent portals connect cells– Doorways, entrances, windows…

Key observation: cells only see each other through portals!

Page 17: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

Idea: – Create an adjacency graph of cells– Starting with cell containing eyepoint, traverse

graph, rendering visible cells – A cell is only visible if it can be seen through a

sequence of portals Need a line of sight So cell visibility reduces to testing portal sequences…

Page 18: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

A

D

H

FCB

E

G

H

B C D F G

EA

Page 19: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

A

D

H

FCB

E

G

H

B C D F G

EA

Page 20: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

A

D

H

FCB

E

G

H

B C D F G

EA

Page 21: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

A

D

H

FCB

E

G

H

B C D F G

EA

Page 22: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

A

D

H

FCB

E

G

H

B C D F G

EA

Page 23: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Cells & Portals

Can even figure out which cells a particular cell will never see:

Ex: H will never see F; B can only see H

This can further speed up culling

A

D

H

FCB

E

G

Page 24: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Overview

Recap: visible surfaces; Z-buffer Other exact algorithms

– BSP trees– Ray casting

Conservative algorithms– View-frustum culling– Cells & portals– Occlusion culling

Page 25: David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu cs551.

David Luebke 04/18/23

Occlusion Culling

When cells and portals don’t work…– Trees in a forest– A crowded train station

Need general occlusion culling algs:– Dynamic scenes, aggregate occluders– Open problem, little work so far:

Hierarchical Z-Buffer (Greene 93) Hierarchical Occlusion Maps (Zhang 97)


Recommended