why john carmack drives a ferrari john ketchpaw 15-462: computer graphics 1 february 28, 2002
TRANSCRIPT
![Page 1: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/1.jpg)
Why John Carmack Drives A Ferrari
John Ketchpaw
15-462: Computer Graphics 1
February 28, 2002
![Page 2: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/2.jpg)
Administrative JunkTurn in your homeworkThe Midterm is on TuesdayAssignment 5 (roller coasters) should
go out Wednesday
![Page 3: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/3.jpg)
The Game Developer’s role
Everyone wants games to approximate the vision of the designers as closely as possible.
It is the developer’s job to figure out how to make the hardware do it.
![Page 4: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/4.jpg)
The Game Developer’s role
We want our games to have as much graphical detail as possible.
We also want the game to run at interactive frame rates (30Hz)
![Page 5: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/5.jpg)
Some Stats (from 1998)A Quake 3 level – 8k-12k triangles
visible at any moment (pretty close to the number possible per frame)
There are several hundred thousand triangles in a normal level
This ratio will remain high until the end of time.
![Page 6: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/6.jpg)
Some Stats (from 1998)This means we can’t get away with just
drawing all the surfaces with a z-buffer (or painter’s algorithm, etc., etc.), like you’ve been doing so far.
An idea: Don’t draw things if they aren’t visible.
![Page 7: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/7.jpg)
HmmmmThat’s not as simple as it lets on.
Any thoughts on how to do it?
![Page 8: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/8.jpg)
Some MethodsDistance metric
Great for outdoor scenes, but no good for interiors.
Always fighting with “pop in”Human annotation (“these rooms are
visible from here”) Labor intensive, often non-optimal and
error prone
![Page 9: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/9.jpg)
More thinking If we know certain things about the
geometry of the world, we can come close.
What’s common about interiors?
![Page 10: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/10.jpg)
Building InteriorsFor the most part, ceilings are horizontal
and at standard heightWalls are verticalMost walls are at right angles to each
other
![Page 11: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/11.jpg)
Enter Wolfenstein 3D (1992)Wolfenstein stored the world on a grid.Each grid location stored a wall, a door,
an object, or an enemy
![Page 12: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/12.jpg)
“Sliver” RenderingShoot a ray out for each column of
pixels Intersections were very cheap and well-
orderedWorked great on my 286
You’ll fall in love with raycasting later in the semester
![Page 13: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/13.jpg)
Raycasting? What’s that?
![Page 14: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/14.jpg)
The Result
![Page 15: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/15.jpg)
So that’s great and all…But we still want to be able to render
things with different heights for the horizontal surfaces…
We would also like walls that weren’t axis aligned
![Page 16: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/16.jpg)
Computers get a little fasterSuddenly, we can do more per column
of pixels Intersection with arbitrarily aligned line
segments, dealing with variable heights now possible…
But what can we do to efficiently determine which line segments to deal with?
![Page 17: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/17.jpg)
BSP Trees (quick and dirty)Pick a k-1 d hyperplane in our kd world,
and separate the other primitives onto either side
Recurse
This will likely be covered in more detail in an upcoming lecture
![Page 18: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/18.jpg)
What does get us?Very cheap (typically) ordering of the
world, based on the current viewpointWorld is broken up into convex
polygonsDoom used this very effectively
![Page 19: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/19.jpg)
Doom (1993)
![Page 20: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/20.jpg)
But I want more!As long as we’re raycasting, we’re stuck
faking it with 2 dimensions 320x200 image is 64,000 rays 640x480 is 307,200 rays!
As a result, we have to try render from geometry-pixels instead of pixels-geometry
![Page 21: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/21.jpg)
So what can we do?Squares got us a lot of mileage in
2d….maybe cubes work in 3d.
Actually a really good idea.
![Page 22: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/22.jpg)
Descent (1994)Built world geometry from lots and lots
of cubes Each cube face stored texture
information and/or connection to an adjacent cube
![Page 23: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/23.jpg)
Descent (1994) Render opaque faces in current cubeFor each connecting face, clip view
frustrum and recurse if appropriateThis was done with a beam tree
![Page 24: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/24.jpg)
Descent (1994)
![Page 25: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/25.jpg)
The GoodWalls and ceilings no longer have any
restriction on orientationNo overdraw
![Page 26: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/26.jpg)
The BadTry building a room with a column in the
middle In general, algorithm assumes world
has spherical topology (like cubes and other convex polyhedra), does OK if the donut holes are big compared to view
Lots of time spent clipping if surfaces have much geometric detail
![Page 27: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/27.jpg)
Could possibly do better In Descent, we’re dynamically figuring
out which surfaces are occludedWhy not do something in pre-
processing?
![Page 28: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/28.jpg)
Dr. FunkThomas Funkhouser wrote his Ph.D
thesis on this back in ’93 www.cs.princeton.edu/~funk/thesis.pdf for a
good read
![Page 29: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/29.jpg)
QuakeQuake does exactly this In general, we don’t need the world to
be built out of cubes, just convex polyhedra
Just like in Doom did in 2d, we can use a BSP tree to do this
![Page 30: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/30.jpg)
Quake
![Page 31: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/31.jpg)
ProsConstant time to determine potentially
visible polysCan use BSP to draw front to back and
eliminate overdraw
![Page 32: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/32.jpg)
ConsGeometry is “more” staticPre calc time can grow to be enormous
Necessitates marking of certain features as “details” to keep out of VSD calculation
Big loss on doors
![Page 33: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/33.jpg)
And onwardsThis is still an open area of researchGames today still use variations on the
portal-rendering/BSP theme to solve this problem Halo clusters BSP leaves into room size
chunks and does portals in between
![Page 34: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/34.jpg)
So YeahThis Lecture was all about Visible
Surface DeterminationThere’s lots that I glossed over about
these engines, mostly related to actual rasterization
These days, the hardware takes care of it for us, but it’s important to be aware of what things were done.
![Page 35: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/35.jpg)
So YeahOther really fascinating stuff going on w/
real-time gaming Level of Detail Programmable Graphics Hardware
Vertex and Pixel Shaders
![Page 36: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/36.jpg)
AcknowledgementsPaul Constant (I ripped off his
diagrams)Adrian Perez (CMU ’01, now at Bungie
Studios)Google
![Page 37: Why John Carmack Drives A Ferrari John Ketchpaw 15-462: Computer Graphics 1 February 28, 2002](https://reader036.vdocuments.us/reader036/viewer/2022070403/56649f2a5503460f94c43f12/html5/thumbnails/37.jpg)
Questions?