Simulation and 3D Graphics

43
2005.04.12 SLIDE 1 IS146 – SPRING 2005 Simulation and 3D Graphics Jeffrey Heer Berkeley Institute of Design Computer Science Division University of California, Berkeley http://www.sims.berkeley.edu/academics/courses/is146/ s05/ IS146: Foundations of New Media

description

Jeffrey Heer Berkeley Institute of Design Computer Science Division University of California, Berkeley http://www.sims.berkeley.edu/academics/courses/is146/s05/. Simulation and 3D Graphics. IS146: Foundations of New Media. Lecture Overview. Review of Last Time Today Simulation Engines - PowerPoint PPT Presentation

Transcript of Simulation and 3D Graphics

Page 1: Simulation and 3D Graphics

2005.04.12 SLIDE 1IS146 – SPRING 2005

Simulation and 3D Graphics

Jeffrey Heer

Berkeley Institute of Design

Computer Science Division

University of California, Berkeleyhttp://www.sims.berkeley.edu/academics/courses/is146/s05/

IS146:

Foundations of New Media

Page 2: Simulation and 3D Graphics

2005.04.12 SLIDE 2IS146 – SPRING 2005

Lecture Overview

• Review of Last Time• Today

• Simulation Engines• 3D Graphics

• Preview of Next Time• Prof. Greg Niemeyer from Art Practice

Page 3: Simulation and 3D Graphics

2005.04.12 SLIDE 3IS146 – SPRING 2005

Lecture Overview

• Review of Last Time• Today

• Simulation Engines• 3D Graphics

• Preview of Next Time• Prof. Greg Niemeyer from Art Practice

Page 4: Simulation and 3D Graphics

2005.04.12 SLIDE 4IS146 – SPRING 2005

Lecture Overview

• Review of Last Time• Today

• Simulation Engines• 3D Graphics

• Preview of Next Time• Prof. Greg Niemeyer from Art Practice

Page 5: Simulation and 3D Graphics

2005.04.12 SLIDE 5IS146 – SPRING 2005

What is simulation?

• A simulation is a procedural representation of aspects of “reality”

Page 6: Simulation and 3D Graphics

2005.04.12 SLIDE 6IS146 – SPRING 2005

What is simulation?

• A simulation can be defined as “an operating representation of central features of reality.” This definition again identifies two central features that must both exist before an exercise can reasonably be described as a simulation. First, it must represent an actual situation of some sort--either a situation drawn directly from real life, or an imaginary situation that conceivably could be drawn from real life (invasion by extraterrestrial beings, for example). Second, it must be operational, i.e., must constitute an on-going process-- a criterion that effectively excludes from the class of simulations static analogues such as photographs, maps, graphs, and circuit diagrams, but includes working models of all types.

Page 7: Simulation and 3D Graphics

2005.04.12 SLIDE 7IS146 – SPRING 2005

What is simulation?

• A set of entities or phenomena of interest, boiled down to essential characteristics of representation (e.g., shape, position, etc)

• A set of procedures or rules for how the state of these entities evolves.

• In programming terms: data structures + procedural abstractions acting on them.

• Simulations are far from perfect - they leave out information on purpose!

Page 8: Simulation and 3D Graphics

2005.04.12 SLIDE 8IS146 – SPRING 2005

Designing Simulations

• Given a phenomena to simulate, the problem is to decide what are its parts, how these parts can be represented with numerical values, and what the relationships are that let these parts affect one another…

• Making a simulation is a process of abstracting--of selecting which entities and which properties from a complex real phenomena to use in the simulation program. For example, to simulate a bouncing ball, the ball’s position is important but its melting point probably isn’t. Any model has limitations, and is not a complete representation of reality.

• Key points: Abstract, Numerical, Limited

Page 9: Simulation and 3D Graphics

2005.04.12 SLIDE 9IS146 – SPRING 2005

Game of Life Simulation

• The Game of Life was devised by the British mathematician John Conway in 1970. It made its first public appearance in the October 1970 issue of Scientific American

• Simulated cells living and dying - perhaps the most classic example of simulation

• Simple rules give rise to complex behavior– emergent phenomena– “the often hidden relationship between the formal

structure of a game and the experience of that structure through play” (my italics)

Page 10: Simulation and 3D Graphics

2005.04.12 SLIDE 10IS146 – SPRING 2005

Game of Life Simulation

• DEMO

• http://www.bitstorm.org/gameoflife/

Page 11: Simulation and 3D Graphics

2005.04.12 SLIDE 11IS146 – SPRING 2005

Game of Life Simulation

• Represented entities– “Living” cells arranged on a grid

• Simulation procedure– Populated grid slot:

• 1 or fewer neighbors: die (loneliness, starvation)• 4 or more neighbors: die (overpopulation)• 2-3 neighbors: live

– Empty grid slot:• 3 neighbors: new cell (reproduction)

Page 12: Simulation and 3D Graphics

2005.04.12 SLIDE 12IS146 – SPRING 2005

Game of Life Simulation

Block Boat Blinker Toad Glider LWSS“Still Lifes” “Oscillators” “Spaceships”

Diehard (130) Acorn (5206)“Methesulahs”

Gosper Glider Gun“Breeders”

Page 13: Simulation and 3D Graphics

2005.04.12 SLIDE 13IS146 – SPRING 2005

Game of Life Simulation

• What the game of Life seems to do most eloquently is demonstrate the amazing complexity inherent in even simple systems, and how stunning order and beauty can be found in even the murkiest times of chaos.

• After realizing that which looked like a huge throbbing mass of nothing two turns ago is now a perfectly symmetrical stable system, you will see what I mean. Also, seeing if you can create sets of life that can accomplish specific goals (travel across the screen, shoot out travelers, etc.) is a pleasant affirmation of the fact that structured organisms CAN wander out of a pile of primordial soup. (from Dan Norton, flakmag.com)

Page 14: Simulation and 3D Graphics

2005.04.12 SLIDE 14IS146 – SPRING 2005

What is simulation?

• A video game is an imaginary world: its inhabitants are nonexistent creatures that nevertheless the eye can see, and the hand can move. It is imaginary in the sense that there is no solid reality behind the picture. A bouncing ball may be faithfully simulated, but that moving blip of light has no real mass or elasticity. The ball’s position, velocity, mass, and elasticity are just numbers stored in the computer that controls the video game; and the laws of physics that govern the ball’s trajectory and it bounce are just mathematical equations stored in the computer’s program. --Warren Robinett

Page 15: Simulation and 3D Graphics

2005.04.12 SLIDE 15IS146 – SPRING 2005

Physics Simulation

• How do we simulate real-world physical phenomena?– Realistic motion, inertia, gravity, elasticity,…

• This is central to numerous video games, 3D worlds, flight simulators, sports simulations, military tests… and the list goes on.

Page 16: Simulation and 3D Graphics

2005.04.12 SLIDE 16IS146 – SPRING 2005

Physics Simulation

• DEMO

• http://www.sodaplay.com/zoo/index.htm

Page 17: Simulation and 3D Graphics

2005.04.12 SLIDE 17IS146 – SPRING 2005

Page 18: Simulation and 3D Graphics

2005.04.12 SLIDE 18IS146 – SPRING 2005

Simple Physics Simulation

• Represented entities– Objects

• Mass, Position, Velocity, Force

– Springs• Stretchiness, Resting Position

– Forces• Gravity, Air Resistance

• Simulation procedure– Objects repel each other (“anti-gravity”) based on

mass and position– Springs push or pull based on position of end-points– Objects are slowed by air resistance dependent on

their current velocity

Page 19: Simulation and 3D Graphics

2005.04.12 SLIDE 19IS146 – SPRING 2005

Physics Simulations

• N-Body ForcesF = G * mass1 * mass2 / distance^2

• Spring ForcesF = -stretchiness * distance from resting

• Drag Forces (Viscosity, Air Resistance)F = resistance * velocity

• GravityF = mass * gravitational pull

Page 20: Simulation and 3D Graphics

2005.04.12 SLIDE 20IS146 – SPRING 2005

3D Graphics as Simulation

• Computer Images are 2D– (in fact, so is all retinal vision)

• Depth cues, perspective, shading, occlusion, etc allow us to perceive images as being 3D representations

• These images exploit our perception to simulate 3D worlds. How?

Page 21: Simulation and 3D Graphics

2005.04.12 SLIDE 21IS146 – SPRING 2005

3D Graphics Simulations

• Represented entities– 3D Models of Characters and Objects

• Combinations of shapes modeled in 3D space• Colors and Textures of these Shapes

– Lighting Sources– Camera Position

• Simulation procedure– Generate 2D Image from 3D Model

• Perspective Projection• Ray-Tracing / Radiosity

Page 22: Simulation and 3D Graphics

2005.04.12 SLIDE 22IS146 – SPRING 2005

Collections of Shapes

Page 23: Simulation and 3D Graphics

2005.04.12 SLIDE 23IS146 – SPRING 2005

…to 3D Imagery

http://home.comcast.net/~tomjking/

Page 24: Simulation and 3D Graphics

2005.04.12 SLIDE 24IS146 – SPRING 2005

The 2D Basics

• Computer Image = 2D Grid (the Raster)– Each grid entry is a number indicating color

• Drawing Primitives (remember LOGO?)– setColor, drawLine, drawRect, fillRect,

drawEllipse, fillEllipse, drawCurve

• So how to go from here to 3D?– Procedural Abstraction– Simulation

Page 25: Simulation and 3D Graphics

2005.04.12 SLIDE 25IS146 – SPRING 2005

Put It In Perspective

Page 26: Simulation and 3D Graphics

2005.04.12 SLIDE 26IS146 – SPRING 2005

Put It In Perspective

Page 27: Simulation and 3D Graphics

2005.04.12 SLIDE 27IS146 – SPRING 2005

3D Rendering Approaches

• Scan Conversion– 3D Model -> 2D Model -> Image– Transform geometry (to handle perspective)

• Raytracing– Directly generate image by simulating the

path of light rays through the scene– (but do it in reverse!)

Page 28: Simulation and 3D Graphics

2005.04.12 SLIDE 28IS146 – SPRING 2005

Raytracing

Page 29: Simulation and 3D Graphics

2005.04.12 SLIDE 29IS146 – SPRING 2005

Raytracing

Page 30: Simulation and 3D Graphics

2005.04.12 SLIDE 30IS146 – SPRING 2005

Raytracing

Page 31: Simulation and 3D Graphics

2005.04.12 SLIDE 31IS146 – SPRING 2005

Raytracing

• Send rays to light sources to know shadow conditions

Page 32: Simulation and 3D Graphics

2005.04.12 SLIDE 32IS146 – SPRING 2005

Raytracing Effects

• Power of a general simulation– Reflection (let light rays continue after hitting

a surface, add up colors along the way)– Refraction (redirect light ray’s path in

response to surface)– Can warp the viewing surface (fisheye views,

simulate vision problems)

• Drawbacks– This takes computational power - good for

movies or imagery, bad for real-time games.

Page 33: Simulation and 3D Graphics

2005.04.12 SLIDE 33IS146 – SPRING 2005

Raytracing

• Reflection

Page 34: Simulation and 3D Graphics

2005.04.12 SLIDE 34IS146 – SPRING 2005

Raytracing

• Refraction

Page 35: Simulation and 3D Graphics

2005.04.12 SLIDE 35IS146 – SPRING 2005

Raytracing

• Warped viewing surfaces

Page 36: Simulation and 3D Graphics

2005.04.12 SLIDE 36IS146 – SPRING 2005

Shading Languages

Page 37: Simulation and 3D Graphics

2005.04.12 SLIDE 37IS146 – SPRING 2005

Repeated Themes

• Game of Life, Physics, Raytracing– Model of “World”

• Cells, Objects / Springs / Forces, Shapes / Lights / Textures

– Actions/operations on that world• Live / Die, Physical Laws,

Ray Casting / Reflection / Refraction

• Basic rule structure gives rise to an amazingly complex space of possibilities

Page 38: Simulation and 3D Graphics

2005.04.12 SLIDE 38IS146 – SPRING 2005

Games as Simulation of Conflict• Territorial

– Chess, Checkers, RISK, Halo, Quake

• Economic– Monopoly, Magic the Gathering

• Knowledge– Trivial Pursuit, Hollywood Squares

• Other Arenas Possible– Social, Psychological conflict

Page 39: Simulation and 3D Graphics

2005.04.12 SLIDE 39IS146 – SPRING 2005

Levels of Simulation

• General Simulation Engine (“Simulation”)– A rich framework for simulating phenomena, based on

generative principles.– Ex: A character jumping in a rich physics simulations

(e.g., Halo)

• Case-Based Simulation (“Emulation”)– Explicit simulation rules for handling specific cases.– Ex: A character jumping in Mario Bros.

• Most games interleave the two, depending on desired levels of detail.

Page 40: Simulation and 3D Graphics

2005.04.12 SLIDE 40IS146 – SPRING 2005

Immersive Fallacy

• The idea that the pleasure of a media experience lies in its ability to sensually transport the participant into an illusory, simulated reality.

• Counter-Point– “… but the very thing that makes their activity

play is that they also know they are participating within a constructed reality, and are consciously taking on artificial meanings”

– Toolmaker’s Paradigm: remember Text1 vs Text2?

Page 41: Simulation and 3D Graphics

2005.04.12 SLIDE 41IS146 – SPRING 2005

Nick Reid on Play

• Can Computers “Play”? Can Software “Play”? Can Hardware “Play”?

• Salen and Zimmerman make constant reference as games and play being rules in motion. Is this true? What is “motion”? Regardless of those answers, what are the effects of these ludic structures in motion? What is left behind? Is there anyway to digitally represent these “ludic artifacts”?

Page 42: Simulation and 3D Graphics

2005.04.12 SLIDE 42IS146 – SPRING 2005

Nick Reid on Play

• “ . . . Caillois defines play by virtue of its structural identity.” (p.309)

• This quote struck me as akward because at first I had no idea what exactly it meant. Earlier S&Z quotes various forms and definitions of types of games from Caillois, so, what the quote probably means is that the identity of the structure is what defines the type of play. When I first read it, I immediately thought about networks, and the structures of social identities, and tried to put that into play – epically paida, so my question is, how could one represent game or play structures as a “graph”?

Page 43: Simulation and 3D Graphics

2005.04.12 SLIDE 43IS146 – SPRING 2005

Lecture Overview

• Review of Last Time• Today

• Simulation Engines• 3D Graphics

• Preview of Next Time• Prof. Greg Niemeyer from Art Practice

• Henry Jenkins. Art Form for the Digital Age, MIT Technology Review, (September/October 2000).

• Discussion Questions: Sharmaine Lewis