Week 15 -Wednesday What did we talk about last time? Review up to - - PowerPoint PPT Presentation

week 15 wednesday what did we talk about last time review
SMART_READER_LITE
LIVE PREVIEW

Week 15 -Wednesday What did we talk about last time? Review up to - - PowerPoint PPT Presentation

Week 15 -Wednesday What did we talk about last time? Review up to Exam 2 We already talked about reflections! Environment mapping was our solution But it only works for distant objects The reflected object can be copied,


slide-1
SLIDE 1

Week 15 -Wednesday

slide-2
SLIDE 2

 What did we talk about last time?  Review up to Exam 2

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6

 We already talked about

reflections!

 Environment mapping was our

solution

 But it only works for distant

  • bjects
slide-7
SLIDE 7

 The reflected object can be

copied, moved to reflection space and rendered there

 Lighting must also be

reflected

 Or the viewpoint can be

reflected

slide-8
SLIDE 8

 This problem can by solved by

using the stencil buffer

 The stencil buffer is set to

areas where a reflector is present

 Then the reflector scene is

rendered with stenciling on

slide-9
SLIDE 9

 Ray tracing can be used to

create general reflections

 Environment mapping can be

used for recursive reflections in curved surfaces

 To do so, render the scene

repeatedly in 6 directions for each reflective object

slide-10
SLIDE 10

 Transmittance is the amount of light

that passes through a sample

 When the materials are all a uniform

thickness, a simple color filter can be used

 Otherwise, the Beer-Lambert Law

must be used to compute the affect

  • n the light
  • T = e-αcd

d

slide-11
SLIDE 11

 Refraction is how a wave bends when it the medium it is

traveling through changes

 Examples with light:

  • Pencil looks bent in water
  • Mirages
slide-12
SLIDE 12

 The amount of refraction is governed by Snell's Law  It relates the angle of incidence and the angle of refraction of

light by the equation:

2 1 2 1

sin sin n n = θ θ

slide-13
SLIDE 13

 Light is focused by reflective or refractive surfaces  A caustic is the curve or surface of concentrated light  The name comes from the Greek for burning

Reflective: Refractive:

slide-14
SLIDE 14

 Subsurface scattering is where light enters an object bounces

around and exits at a different point than it entered

 Causes:

  • Foreign Particles (pearls)
  • Discontinuities (air bubbles)
  • Density variations
  • Structural changes
slide-15
SLIDE 15

 To create a realistic scene, it is

necessary for light to bounce between surfaces many times

 This causes subtle effects in how

light and shadow interact

 This also causes certain lighting

effects such as color bleeding (where the color of an object is projected onto nearby surfaces)

slide-16
SLIDE 16

 Radiosity simulates this  Turn on the light sources and allow the environmental light to

reach equilibrium (stable state)

 While the light is in stable state, each surface may be treated

a light source

 The equilibrium is found by forming a square matrix out of

form factors for each patch times the patch’s reflectivity

 Gaussian Elimination on the resulting matrix gives the

exitance (color) of the patch in question

slide-17
SLIDE 17

 Trace rays from the camera through the

screen to the closest object, the intersection point.

 For each intersection point, rays are

traced:

  • A ray to each light source
  • If the object is shiny, a reflection ray
  • If the object is not opaque, a refraction ray

 Opaque objects can block the rays, while

transparent objects attenuate the light

 Repeat recursively until all points on the

screen are calculated

slide-18
SLIDE 18

 Classical ray tracing is relatively fast

but performs poorly for environmental lighting and diffuse interreflections

 In Monte Carlo ray tracing, ray

directions are randomly chosen, weighted by the BRDF

 This is called importance sampling.  Monte Carlo ray tracing gets

excellent results but takes a huge amount of time

slide-19
SLIDE 19

 Full global illumination is expensive  If the scene and lighting are static, much can be

precomputed

 Simple surface prelighting uses a radiosity render to

determine diffuse lighting ahead of time

 Directional surface prelighting stores directional lighting

information that can be used for specular effects

  • Much more expensive in memory

 Volume information can be precomputed to light dynamic

  • bjects
slide-20
SLIDE 20

 Global illumination algorithms

precompute various quantities other than lighting

 Often, a measure of how much parts of

a scene block light are computed

  • Bent normal, occlusion factor

 These precomputed occlusion

quantities can be applied to changing light in a scene

 Create a more realistic appearance

than precomputed lighting alone

slide-21
SLIDE 21

 Precomputed ambient occlusion factors are only valid on

stationary objects

  • Example: a racetrack

 For moving objects (like a car), ambient occlusion can be

computed on a large flat plane

 This works for rigid objects, but deformable objects would need

many precomputed poses

  • Example: a human

 Also can be used to model occlusion effects of objects on each

  • ther
slide-22
SLIDE 22

 The total effect of dynamic lighting conditions can be

precomputed and approximated

  • This method is trying to take into account all possible lightings from all

possible angles

 Computing all this stuff is difficult, but a compact representation

is even more difficult

 Spherical harmonics is a way of storing the data, sampled in many

directions

  • Storage requirements can be large

 Results generally hold only for distant lights and diffuse shading

slide-23
SLIDE 23
slide-24
SLIDE 24

 We can imagine all the different rendering techniques as

sitting on a spectrum reaching from purely appearance based to purely physically based

Sprites Layers Billboards Triangles

Appearance Based

Lightfields

Physically Based

Global illumination

slide-25
SLIDE 25

 When objects are close to the viewer, small changes in

viewing location can have big effects

 When objects are far away, the effect is much smaller  As you know by now, a skybox is a large mesh containing the

entire scene

 Some skyboxes look crappy because there isn't enough

resolution

  • Minimum texture resolution (per cube face) =

tan(fov/2) resolution screen

slide-26
SLIDE 26

 If you are trying to recreate a complex scene from reality, you

can take millions of pictures from of it from many possible angles

 Then, you can use interpolation and warping techniques to

stitch them together

 Huge data storage requirements  Each photograph must be catalogued based on location and

  • rientation

 High realism output!

slide-27
SLIDE 27

 A sprite is an image that moves

around the screen

 Sprites were the basis of most old

2D video games (back when those existed, before the advent of Flash)

 By putting sprites in layers, it is

possible to make a compelling scene

 Sequencing sprites can achieve

animation

slide-28
SLIDE 28

 Applying sprites to 3D gives billboarding  Billboarding is orienting a textured polygon based on view direction  Billboarding can be effective for objects without solid surfaces  If the object is supposed to exist in the world, it needs to change as the world

changes

 For small sprites (such as particles) the billboard's surface normal can be the

negation of the view plane normal

 Larger sprites should have different normals that point the billboard directly at

the viewpoint

slide-29
SLIDE 29

In a particle system, many small, separate objects are controlled using some algorithm

Applications:

  • Fire
  • Smoke
  • Explosions
  • Water

Particle systems refer more to the animation than to the rendering

Particles can be points or lines or billboards

Modern GPUs can generate and render particles in hardware

slide-30
SLIDE 30

 An impostor is a billboard created

  • n the fly by rendering a complex
  • bject to a texture

 Then, the impostor can be rendered

more cheaply

 This technique should be used to

speed up the rendering of far away

  • bjects

 The resolution of the texture should

be at least:

tan(fov/2) distance 2 size

  • bject

resolution screen ⋅ ⋅

slide-31
SLIDE 31

 Impostors have to be recomputed for different viewing angles  Certain kinds of models (trees are a great example) can be

approximated by a cloud of billboards

 Finding a visually realistic set of cutouts is one part of the problem  The rendering overhead of overdrawing is another

  • Billboards may need to be sorted if transparency effects are important
slide-32
SLIDE 32

 Image processing takes an input image and manipulates it

  • Blurring
  • Edge detection
  • Color correction
  • Tone mapping

 Much of this can be done on the GPU

slide-33
SLIDE 33

 Lens flare is an effect caused by bright light hitting the

crystalline structure of a camera lens

 The bloom effect is where bright areas spill over into other

areas

 Depth of field simulates a camera's behavior of blurring

  • bjects based on how far they are from the focal plane

 Motion blur blurs fast moving objects  Fog can be implemented by blending a color based on

distance of an object from the viewpoint

slide-34
SLIDE 34

 Most of the work we've

focused on all semester is doing rendering that in some way mirrors the natural world

 However, a wide area of

rendering is non- photorealistic rendering (NPR)

 Goals:

  • Simplified technical drawings
  • Simulating artistic styles
slide-35
SLIDE 35

 The most common form of NPR in video

games is toon shading

  • Also called cel shading

 The goal is to render 3D models as if

they were cartoons

  • Shading is often done with either a single

color or a two tone (color and shading) approach

  • Then a thick black silhouette is added

around edges

slide-36
SLIDE 36

 The color is often determined by the dot product n · l (surface

normal dot light vector)

 If negative, the surface should be darkened  Otherwise, it's some flat color  Or a threshold other than 0 can be used  A more complex system uses a one dimensional texture indexed

into with the dot product

Highlight Normal Shadow

slide-37
SLIDE 37

 The more complicated problem is properly

rendering edges with a thick dark line

 A number of different edges are of interest

  • Boundary or border edges are edges where one

polygon is not adjacent to any other

▪ Not found in 3D solid objects

  • A crease, hard, or feature edge is an edge between two

polygons that is sharper than some threshold angle

  • A material edge is an edge between two polygons with

different materials

  • A silhouette edge is when two neighboring polygons

face different directions, relative to the eye

slide-38
SLIDE 38

 Cel shading focuses on rendering silhouette edges  Many of these techniques rely on manipulating back facing

polygons

  • The crossover between front facing and back facing polygons is the

silhouette

  • It's easy to determine which is which

 After some manipulation of the backfaces, they are rendered

in black

slide-39
SLIDE 39

 If the backfaces are rendered in black without any change, they will be hidden  Before rendering, all backfaces can be translated to be closer to the viewer  Translation can be by

  • A fixed amount
  • An amount that takes into account non-linear z-depths
  • An amount based on the angle of the polygon normal

 None of these techniques give uniform thickness lines

slide-40
SLIDE 40

 Another approach is to fatten each backface triangle  The slope of the triangle and the distance from the viewer

determine the expansion of each edge

 It doesn't work well for thin traingles

slide-41
SLIDE 41

 A similar approach is to expand backface vertices along their

normals

  • The expansion amount is proportional to their z-distance

 This technique fails for situations like a cube, in which faces

with very different normals share vertices

slide-42
SLIDE 42

 Rather than using geometry, there is an image

processing approach

 Render all the normal values or depth values to a

buffer and use edge detection algorithms to draw lines where the values change abruptly

  • Using normal values can find crease edges

 This technique works for many cases that failed

before

  • Even GPU generated surfaces are not a problem
slide-43
SLIDE 43

 NPR techniques are very broad  Many approaches try to recreate hand-drawn or hand-painted styles  Silhouette lines can be drawn as paintbrush strokes of varying thickness  Tonal art maps (TAMs) use palettes of hand-drawn textures to do black

and white crosshatch-style shading

slide-44
SLIDE 44

 For CAD programs and other 3D tools, we may want to

highlight certain lines or all polygon edges

 Rendering polygon edges on top of existing polygons can be a

pain

  • Z-buffer algorithms might hide the lines

 In practice, a small bias is usually added to the polygons

slide-45
SLIDE 45

 For drawing simplified models, we may want to include or exclude

the hidden lines

 Wireframe is the easiest, since it is just the lines  Hidden-line uses the z-buffer directly  Obscured-line renders twice, rendering z-fail lines in a lighter color  Haloed lines also use the z-buffer, drawing thick white lines first

and then black lines on top

  • Problems happen when lines get too close
slide-46
SLIDE 46
slide-47
SLIDE 47
slide-48
SLIDE 48

 Work day for Project 3

slide-49
SLIDE 49

 Fill out course evaluations!  Finish Project 3

  • Due Friday before midnight

 Study for final exam

  • 2:45 - 4:45 p.m., Monday, 12/09/2019