Week 15 Wednesday COMP 4290 Last time What

  • Slides: 49
Download presentation
Week 15 - Wednesday COMP 4290

Week 15 - Wednesday COMP 4290

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

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

Questions?

Questions?

Project 3

Project 3

Reflections

Reflections

Environment mapping �We already talked about reflections! �Environment mapping was our solution �But it

Environment mapping �We already talked about reflections! �Environment mapping was our solution �But it only works for distant objects

Reflection rendering �The reflected object can be copied, moved to reflection space and rendered

Reflection rendering �The reflected object can be copied, moved to reflection space and rendered there �Lighting must also be reflected �Or the viewpoint can be reflected

Hiding incorrect reflections �This problem can by solved by using the stencil buffer �The

Hiding incorrect reflections �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

Curved Reflections �Ray tracing can be used to create general reflections �Environment mapping can

Curved Reflections �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

Transmittance �Transmittance is the amount of light that passes through a sample �When the

Transmittance �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 on the light T= e-αcd d

Refraction �Refraction is how a wave bends when it the medium it is traveling

Refraction �Refraction is how a wave bends when it the medium it is traveling through changes �Examples with light: Pencil looks bent in water Mirages

Snell's Law �The amount of refraction is governed by Snell's Law �It relates the

Snell's Law �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:

Caustics �Light is focused by reflective or refractive surfaces �A caustic is the curve

Caustics �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:

Global subsurface scattering �Subsurface scattering is where light enters an object bounces around and

Global subsurface scattering �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

Radiosity � To create a realistic scene, it is necessary for light to bounce

Radiosity � 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)

Computing radiosity �Radiosity simulates this �Turn on the light sources and allow the environmental

Computing radiosity �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

Classical ray tracing �Trace rays from the camera through the screen to the closest

Classical ray tracing �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

Monte Carlo ray tracing �Classical ray tracing is relatively fast but performs poorly for

Monte Carlo ray tracing �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

Precomputed lighting � Full global illumination is expensive � If the scene and lighting

Precomputed lighting � 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 objects

Precomputed Occlusion �Global illumination algorithms precompute various quantities other than lighting �Often, a measure

Precomputed Occlusion �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

Precomputed Ambient Occlusion �Precomputed ambient occlusion factors are only valid on stationary objects Example:

Precomputed Ambient Occlusion �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 other

Precomputed radiance transfer �The total effect of dynamic lighting conditions can be precomputed and

Precomputed radiance transfer �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

Image Based Effects

Image Based Effects

Rendering spectrum �We can imagine all the different rendering techniques as sitting on a

Rendering spectrum �We can imagine all the different rendering techniques as sitting on a spectrum reaching from purely appearance based to purely physically based Sprites Billboards Appearance Based Physically Based Layers Lightfields Triangles Global illumination

Skyboxes �When objects are close to the viewer, small changes in viewing location can

Skyboxes �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) =

Lightfields �If you are trying to recreate a complex scene from reality, you can

Lightfields �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 orientation �High realism output!

Sprites and layers � A sprite is an image that moves around the screen

Sprites and layers � A sprite is an image that moves around the screen � Sprites were the basis of most old 2 D 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

Billboarding � Applying sprites to 3 D gives billboarding � Billboarding is orienting a

Billboarding � Applying sprites to 3 D 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

Particle systems � � In a particle system, many small, separate objects are controlled

Particle systems � � 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

Impostors �An impostor is a billboard created on the fly by rendering a complex

Impostors �An impostor is a billboard created on the fly by rendering a complex object to a texture �Then, the impostor can be rendered more cheaply �This technique should be used to speed up the rendering of far away objects �The resolution of the texture should be at least:

Billboard clouds �Impostors have to be recomputed for different viewing angles �Certain kinds of

Billboard clouds �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

Image processing �Image processing takes an input image and manipulates it Blurring Edge detection

Image processing �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

Special effects �Lens flare is an effect caused by bright light hitting the crystalline

Special effects �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 objects based on how far they are from the focal plane �Motion blurs fast moving objects �Fog can be implemented by blending a color based on distance of an object from the viewpoint

Non-photorealistic rendering �Most of the work we've focused on all semester is doing rendering

Non-photorealistic rendering �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 nonphotorealistic rendering (NPR) �Goals: Simplified technical drawings Simulating artistic styles

Toon shading �The most common form of NPR in video games is toon shading

Toon shading �The most common form of NPR in video games is toon shading Also called cel shading �The goal is to render 3 D 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

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

Coloring �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

Silhouette edge rendering � The more complicated problem is properly rendering edges with a

Silhouette edge rendering � 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 3 D 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

Procedural geometry silhouetting �Cel shading focuses on rendering silhouette edges �Many of these techniques

Procedural geometry silhouetting �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

z-biased backfaces � If the backfaces are rendered in black without any change, they

z-biased backfaces � 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

Triangle fattening �Another approach is to fatten each backface triangle �The slope of the

Triangle fattening �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

Expanding shell technique �A similar approach is to expand backface vertices along their normals

Expanding shell technique �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

Silhouetting by image processing �Rather than using geometry, there is an image processing approach

Silhouetting by image processing �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

Other styles � NPR techniques are very broad � Many approaches try to recreate

Other styles � 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

Line rendering �For CAD programs and other 3 D tools, we may want to

Line rendering �For CAD programs and other 3 D 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

Hidden lines �For drawing simplified models, we may want to include or exclude the

Hidden lines �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

Quiz

Quiz

Upcoming

Upcoming

Next time… �Work day for Project 3

Next time… �Work day for Project 3

Reminders �Fill out course evaluations! �Finish Project 3 Due Friday before midnight �Study for

Reminders �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