#16: computer cinematography: the toy story lighting model cse167: computer graphics instructor:...

59
#16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

Upload: sophia-parrish

Post on 17-Dec-2015

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

#16: Computer Cinematography:

The Toy Story Lighting Model

CSE167: Computer GraphicsInstructor: Ronen Barzel

UCSD, Winter 2006

Page 2: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

2

Film Cinematography

What makes film look different from home movie? Camera Lighting

Not trying for “photorealism” Lighting in cinematography

Contribute to storytelling Set mood Compose image Direct viewer’s eye

Page 3: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

3

Real-World Film Lighting

Practical lights: lights that are visible onscreen e.g. desk lamps, ceiling lamps, flashlights, fires, … rarely major contributors to illumination

Main lights and spotlights placed off-camera To create desired illumination effect

Standard three-point lighting setup: Key light -- provides major source of illumination & shadow

Fill Light -- fills in dark areas & shadows made by key

Back light -- creates subtle highlights around edges• helps give sense of 3D depth• separates subject from background

Page 4: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

4

Real-World Film Lighting Trickery

Cheat as necessary: Suspend sheet in front of light to soften shadows

Position opaque cards or graded filters to shape light

Focus narrow “tickler” lights to get extra highlights

Hide “kicker” light under a desk to fill dark areas under character’s chin

etc…

Page 5: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

5

Computer Graphics Trickery

We’re not looking for realism real-world lighting is constrained by reality, CG isn’t

Things that can’t be done in real life lights coming out of nowhere lights that act on only certain objects decoupling lights and shadows etc.

Real life does some things easier than standard CG: soft shadows soft area lights global illumination techniques help this

Page 6: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

6

Lighting Model

Several independent aspects selection shape shadowing texture dropoff direction properties

Page 7: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

7

Basic setup

only fill lights

Page 8: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

8

One key light

(will talk about the beam-of-light effect later)

(will talk about the beam of light effect later)

Page 9: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

9

Selection

torus unaffected by key light

Page 10: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

10

Shape

Region of space affected by light Real-world commonly use spotlights, barn door lights

CG model: Generalized cone/pyramid Soft edges Cuton and cutoff

Page 11: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

11

Generalized cone/pyramid

A “superellipse” shape swept into a pyramid superellipse varies between circle and rectangle pyramid may be truncated or sheared

Page 12: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

12

2-dimensional superellipse:

n=1 is ordinary ellipse or circle need to handle 4 quadrants carefully:

• avoid exponentiation of negative numbers• use

2D Superellipse

x

y

⎣⎢

⎦⎥=

acosn(θ)bsinn(θ)

⎣⎢

⎦⎥, where 0 ≤θ ≤ 2π and 0 ≤ n < ∞

x

a⎛⎝⎜

⎞⎠⎟

2 n

+y

b⎛⎝⎜

⎞⎠⎟

2 n

= 1

y = b 1−x

a⎛⎝⎜

⎞⎠⎟

2 n⎛

⎝⎜

⎠⎟

n 2

xn =−xnif x < 0

Page 13: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

13

Aside: 3D Superellipsoid

x

y

z

⎢⎢⎢

⎥⎥⎥=

acosn1 (φ)cosn2 (θ)bcosn1 (φ)sinn2 (θ)

csinn1 (φ)

⎢⎢⎢

⎥⎥⎥ 

where 0 ≤θ ≤ 2π

and - π2 ≤φ≤ π2

and 0 ≤ n < ∞

Page 14: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

14

Returning to lighting…

A 2D superellipse swept into a pyramid pyramid may be truncated or sheared

Page 15: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

15

Shape: Rounded Rectangle

Page 16: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

16

Shape: Sheared Barn Door

Page 17: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

17

Soft Edges

Full intensity in central pyramid No effect (zero intensity) outside outer pyramid Smooth falloff between them

Page 18: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

18

Shape: Hard Edge

Page 19: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

19

Shape: Soft Edges

Page 20: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

20

Step Transitions

Want to transition between two values E.g. in a shader, transition between two colors on surface

E.g. inside/outside light shape Want function to provide control value between 0 to 1:

• Function step(s,a,b) for a < b

• Should return 0 for s ≤ a

• Should return 1 for s ≥ b

• Should vary smoothly between them

• Can use, e .g., to trans ition between two colors :

                Lerp(step(s,a,b),Color1,Color2 )

Page 21: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

21

Linear Step

Vary linearly between a and b:

Simple, quick Not C1-continuous

• Abrupt• Can cause Mach banding

linearstep(s,a,b) =

0, s≤as−ab−a

, a≤s≤b

1 b≤s

⎨⎪⎪

⎩⎪⎪

s0

1

a b

Page 22: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

22

“SmoothStep”

Cubic curve: Tangent is horizontal at start and end

• C1-continuous Special-case of a Hermite Spline:

• Cubic spline defined by two interpolating points and two tangents

In RenderMan shading language library

smoothstep(s,a,b) =

0, s≤a

−2s−ab−a

⎛⎝⎜

⎞⎠⎟

3

+ 3s−ab−a

⎛⎝⎜

⎞⎠⎟

2

, a≤s≤b

1 b≤s

⎪⎪

⎪⎪

s0

1

a b

Page 23: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

23

Shape: Cutoff

Truncate bottom of pyramid smooth transition zone (fairly sharp in the example)

Page 24: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

24

Shape: Cuton

Truncate top of pyramid smooth transition zone (gradual in the example)

Page 25: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

25

Shadowing

Shadows & shadow placement important for cinematography Can control shadows for artistic effect Think of shadow as “volume of darkness”

illumination inhibited inside the volume Control:

Shadow selection Shadow direction Shadow sharing Fake shadows Shape trimming Shadow softening

Techniques can be implemented using shadowmaps & procedural shading

Page 26: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

26

Basic Shadows

Page 27: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

27

Shadow Selection

Cube casts no shadow

Page 28: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

28

Shadow Direction

move shadowmap camera away from light position to control where shadows fall surprisingly acceptable, especially for shadows cast on distant surface

Page 29: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

29

Shadow Sharing

use one light’s shadowmap for other lights prevent other lights from washing out important shadows

Page 30: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

30

Fake shadows

Place a virtual shadow-casting superellipse in space. known as a “blocker” (Real-world, place opaque cards in front of light)

Page 31: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

31

Shape Trimming

Make large blocker, place it to trim the shape of the light Can animate blocker for effects like door opening offscreen

Page 32: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

32

Shadow Softening

Effect of shadow on light doesn’t need to be binary on/off:

Only partially inhibit the light (scale down rather than remove)

Soften edges• shadowmap edge blurring techniques• smooth falloff in shadow blockers

Rather than inhibiting light, lerp to a different color• e.g. can be effective to lerp to dark blue• default: lerp to black gives normal shadowing

Page 33: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

33

Texture

We use images to create texture on surfaces Can also use images to create texture in lighting, via

projection Cookie: single-channel matte used as a “cookie cutter”

(a.k.a. cucaloris)• changes shape• breaks up light

Slide: color image used as a slide projector• can blur based on distance for getting unfocused projection (e.g.

from a TV) Noise: 2D procedural noise

• makes light “dirty”

Page 34: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

34

Texture files

Page 35: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

35

Cookie changing light shape

Page 36: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

36

Cookie breaking up light

Page 37: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

37

Projecting a color slide

Page 38: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

38

Intensity distribution

The intensity of the light can vary across the shape Beam distribution

• cosinen across beam Distance falloff

• inverse-linear, inverse-square, etc.

Usually only used for practical light effects Choosing dropoff exponent parameters not intuitive Easier to adjust lighting using soft shape, cutoff, blockers

Page 39: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

39

Uniform Intensity

Page 40: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

40

Beam Distribution

Page 41: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

41

Distance Falloff

Page 42: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

42

Light Ray Direction

Two common CG options: radial from apex of pyramid parallel

Subtle effect on shading and highlights effect more noticeable as light source is close to object

Page 43: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

43

Light Properties

Properties of the “photons” that are incident on the surfaces

Intensity: nominal intensity at a target point within the shape• Attenuated by: shape boundary, shadows, cookies, noise, dropoff

Color: nominal RGB color of the light• Filtered by: slide, noise, colored shadow

Effect: how much light contributes to CG illumination model• Separate scale factor for ambient, diffuse, specular• Fill lights typically ambient-only, to avoid unwanted specular

hilights Other… depending on what the surface shading model can handle

• “ultraviolet” 4th color channel. “fluorescent” surface responds by self-illuminating

Lights that don’t actually light… Surface can react specially to specific “light” types:

• lights whose effect is to attenuate other lights• lights that affect surface properties

• e.g. use a slide to project a bump map?

• etc…

Page 44: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

44

Example 1

Page 45: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

45

Example 1 notes

Light shape/placement for image composition Barn door light frames character Nominally shines from offscreen window Placed for visual effect, not necessarily consistent with window

Softened (partial opacity) shadows of bed on wall

Page 46: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

46

Example 2

Page 47: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

47

Example 2 notes

Strips of light on the characters Not actually cast by the venetian blind slats Generated using a cookie, adjusted for best effect

Slats are lit from below to get desired glow

Page 48: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

48

Example 3

Page 49: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

49

Example 3 notes

Cookie (the one from slide 33) used for dappled leaves Separate cone-shaped spotlight w/cookie on soldier in

rear Characters in foreground lit by blue light for blue

highlights Practical light source: red LED

Page 50: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

50

Example 4

Page 51: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

51

Example 4 notes

Practical light source: Flashlight Cookie for lens ring effect Two light sources:

• one illuminates character• one generates fog effect, with cutoff to avoid obscuring character

“Ultraviolet” light white shirt responds with blue glow

Page 52: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

52

Example 5

Page 53: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

53

Example 5 notes

Shadow placement. Milk crate shadows adjusted so that “X” lands on Woody’s face Doesn’t obscure eyes or mouth

Blockers darken background Darkens mood Focuses attention on face in the foreground

Page 54: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

54

Example 6

Page 55: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

55

Example 6 notes

Soft edges of key light Buzz’s shadow direction adjusted for compositional effect Grazing-angle light on desk only, accentuates its texture Separate lights on Buzz only for extra highlighting Cookie animates from one frame to next for falling-rain

effect

Page 56: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

56

Fog in computer graphics

Simple version: depth cueing After lighting computation Blend between lit surface color and constant fog color, based

on depth Typically have a “near fog plane” then linear or exponential

fogging with distance Compute in pixel shaders Supported by some hardware No beam of light effects

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.

Lerp(e−dz,Clit,C fog)

Page 57: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

57

Atmospheric effects

Participating Medium Light bounces off air particles Some light gets absorbed by air particles Full simulation of multiple scattering is possible, using

monte carlo techniques• Gets best results for clouds, etc.

Simple approximation: ray marching, single scattering (Used for examples today) Start at surface, with lit color Take incremental steps along ray towards eye At each step:

• attenuate existing color / merge towards fog color• look up lighting (with shadows)• compute amount of light scattered towards eye• add to current color

Can be implemented in pixel shader Some systems support procedural volume shaders to run after

surface shading

Page 58: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

58

Real-time clouds

Various approximation techniques. Billboards, transparency, frustum culling, … Video shows some of the acceleration techniques Steve talked

about last class [play video]

Page 59: #16: Computer Cinematography: The Toy Story Lighting Model CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

59

Done

Next class: Guest Lecture: Daniel Maskit, Digital Domain “A View From

The Trenches”