University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Procedural Approaches.

Slides:



Advertisements
Similar presentations
Better Interactive Programs
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 6, 2014 TEXTURE MAPPING TEXTURES BUMP MAPPING ENVIRONMENT MAPPING PROCEDURAL TEXTURING.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Picking Week 10, Mon Mar.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Picking, Collision Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures III, Procedural.
1Notes  Textbook: matchmove 6.7.2, B.9. 2 Match Move  For combining CG effects with real footage, need to match synthetic camera to real camera: “matchmove”
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
Texture Mapping from Watt, Ch. 8 Jonathan Han. Topics Discussed Texture Map to Models Bump Maps, Light Maps Environment (Reflection) Mapping 3D Textures.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
Projections and Picking Wed 24 Sep 2003
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Picking II, Collision.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Picking and Lighting Week 4, Fri 26 Sep 2003 recap: viewports and picking.
Informationsteknologi Tuesday, November 6, 2007Computer Graphics - Class 41 Today’s class Input and interaction.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Picking. What is picking? Selecting an object on the screen What does this require? –Get Mouse Location –Compute what objects are rendered at the position.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
3D Computer Graphics: Textures. Textures: texels Texture is a way of assigning a diffuse color to a pixel – can be with 1, 2 or 3D- can use maps, interpolation.
19/4/ :32 Graphics II Syllabus Selection and Picking Session 1.
COMP 175: Computer Graphics March 24, 2015
CSE 381 – Advanced Game Programming Basic 3D Graphics
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
4/15/04© University of Wisconsin, CS559 Spring 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Textures III Week 10,
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Korea University Korea University Computer Graphics Laboratory Computer Graphics Laboratory Jung Lee, Chapter 13.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Particle Systems – Technique for Modeling a Class of Fuzzy Objects Craig Schroeder Computer Graphics I April 22, 2004.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Computing & Information Sciences Kansas State University Lecture 20 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 21 of 42 William H. Hsu.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
CSC505 Particle Systems. CSC505 Object Representations So far we have represented (rendered) objects with –Lines –Polygons (triangles) –Curves These techniques.
OpenGL Selection. Three Selection Methods Color coding (OpenGL) Selection mode (OpenGL) Selection ray (generic)
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Procedural Approaches.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures II Week 9, Fri.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Procedural II, Collision.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures III, Procedural.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Viewing/Projection V,
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
Procedural, Collision University of British Columbia
Better Interactive Programs
Better Interactive Programs
Lecture 13 Clipping & Scan Conversion
Procedural Approaches Curves Week 12, Fri 21 Nov 2003
Particle Systems - A Technique for Modeling a Class of Fuzzy Objects
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Procedural Approaches II, Picking Week 10, Wed Mar 21

2 News showing up for your project grading slot is not optional 5 people have missed their slot, without notifying the TA in advance of the need to change 2% penalty for noshows for P3 and P4

3 Review: Environment Mapping cheap way to achieve reflective effect generate image of surrounding map to object as texture sphere mapping: texture is distorted fisheye view point camera at mirrored sphere use spherical texture coordinates

4 Review: Cube Environment Mapping 6 planar textures, sides of cube point camera outwards to 6 faces use largest magnitude of vector to pick face other two coordinates for (s,t) texel location

5 Review: Volumetric Texture define texture pattern over 3D domain - 3D space containing the object texture function can be digitized or procedural for each point on object compute texture from point location in space 3D function   x,y,z)

6 Review: Perlin Noise: Procedural Textures function marble(point) x = point.x + turbulence(point); return marble_color(sin(x))

7 Review: Perlin Noise coherency: smooth not abrupt changes turbulence: multiple feature sizes

8 Review: Generating Coherent Noise just three main ideas nice interpolation use vector offsets to make grid irregular optimization sneaky use of 1D arrays instead of 2D/3D one

9 Review: Procedural Modeling textures, geometry nonprocedural: explicitly stored in memory procedural approach compute something on the fly not load from disk often less memory cost visual richness adaptable precision noise, fractals, particle systems

10 Procedural Approaches II

11 Fractal Landscapes fractals: not just for “showing math” triangle subdivision vertex displacement recursive until termination condition

12 Self-Similarity infinite nesting of structure on all scales

13 Fractal Dimension D = log(N)/log(r) N = measure, r = subdivision scale Hausdorff dimension: noninteger D = log(N)/log(r) D = log(4)/log(3) = 1.26 coastline of Britain Koch snowflake

14 Language-Based Generation L-Systems: after Lindenmayer Koch snowflake: F :- FLFRRFLF F: forward, R: right, L: left Mariano’s Bush: F=FF-[-F+F+F]+[+F-F-F] } angle 16

15 1D: Midpoint Displacement divide in half randomly displace scale variance by half

16 2D: Diamond-Square fractal terrain with diamond-square approach generate a new value at midpoint average corner values + random displacement scale variance by half each time

17 Particle Systems loosely defined modeling, or rendering, or animation key criteria collection of particles random element controls attributes position, velocity (speed and direction), color, lifetime, age, shape, size, transparency predefined stochastic limits: bounds, variance, type of distribution

18 Particle System Examples objects changing fluidly over time fire, steam, smoke, water objects fluid in form grass, hair, dust physical processes waterfalls, fireworks, explosions group dynamics: behavioral birds/bats flock, fish school, human crowd, dinosaur/elephant stampede

19 Particle Systems Demos general particle systems boids: bird-like objects flocking/swarming behavior procedural motion

20 Particle Life Cycle generation randomly within “fuzzy” location initial attribute values: random or fixed dynamics attributes of each particle may vary over time color darker as particle cools off after explosion can also depend on other attributes position: previous particle position + velocity + time death age and lifetime for each particle (in frames) or if out of bounds, too dark to see, etc

21 Particle System Rendering expensive to render thousands of particles simplify: avoid hidden surface calculations each particle has small graphical primitive (blob) pixel color: sum of all particles mapping to it some effects easy temporal anti-aliasing (motion blur) normally expensive: supersampling over time position, velocity known for each particle just render as streak

22 Procedural Approaches Summary Perlin noise fractals L-systems particle systems not at all a complete list! big subject: entire classes on this alone

23 Picking

24 Reading Red Book Selection and Feedback Chapter all Now That You Know Chapter only Object Selection Using the Back Buffer

25 Interactive Object Selection move cursor over object, click how to decide what is below? ambiguity many 3D world objects map to same 2D point four common approaches manual ray intersection bounding extents backbuffer color coding selection region with hit list

26 Manual Ray Intersection do all computation at application level map selection point to a ray intersect ray with all objects in scene. advantages no library dependence disadvantages difficult to program slow: work to do depends on total number and complexity of objects in scene x VCS y

27 Bounding Extents keep track of axis-aligned bounding rectangles advantages conceptually simple easy to keep track of boxes in world space

28 Bounding Extents disadvantages low precision must keep track of object-rectangle relationship extensions do more sophisticated bound bookkeeping first level: box check. second level: object check

29 Backbuffer Color Coding use backbuffer for picking create image as computational entity never displayed to user redraw all objects in backbuffer turn off shading calculations set unique color for each pickable object store in table read back pixel at cursor location check against table

30 advantages conceptually simple variable precision disadvantages introduce 2x redraw delay backbuffer readback very slow Backbuffer Color Coding

31 for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) { glPushMatrix(); switch (i*2+j) { case 0: glColor3ub(255,0,0);break; case 1: glColor3ub(0,255,0);break; case 2: glColor3ub(0,0,255);break; case 3: glColor3ub(250,0,250);break; } glTranslatef(i*3.0,0,-j * 3.0) glCallList(snowman_display_list); glPopMatrix(); } glColor3f(1.0f, 1.0f, 1.0f); for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) { glPushMatrix(); glTranslatef(i*3.0,0,-j * 3.0); glColor3f(1.0f, 1.0f, 1.0f); glCallList(snowman_display_list); glPopMatrix(); } Backbuffer Example

32 Select/Hit use small region around cursor for viewport assign per-object integer keys (names) redraw in special mode store hit list of objects in region examine hit list OpenGL support

33 Viewport small rectangle around cursor change coord sys so fills viewport why rectangle instead of point? people aren’t great at positioning mouse Fitts’ Law: time to acquire a target is function of the distance to and size of the target allow several pixels of slop

34 nontrivial to compute invert viewport matrix, set up new orthogonal projection simple utility command gluPickMatrix(x,y,w,h,viewport) x,y: cursor point w,h: sensitivity/slop (in pixels) push old setup first, so can pop it later Viewport

35 Render Modes glRenderMode(mode) GL_RENDER: normal color buffer default GL_SELECT: selection mode for picking (GL_FEEDBACK: report objects drawn)

36 Name Stack again, "names" are just integers glInitNames() flat list glLoadName(name) or hierarchy supported by stack glPushName(name), glPopName can have multiple names per object

37 for(int i = 0; i < 2; i++) { glPushName(i); for(int j = 0; j < 2; j++) { glPushMatrix(); glPushName(j); glTranslatef(i*10.0,0,j * 10.0); glPushName(HEAD); glCallList(snowManHeadDL); glLoadName(BODY); glCallList(snowManBodyDL); glPopName(); glPopName(); glPopMatrix(); } glPopName(); } Hierarchical Names Example

38 Hit List glSelectBuffer(buffersize, *buffer) where to store hit list data on hit, copy entire contents of name stack to output buffer. hit record number of names on stack minimum and minimum depth of object vertices depth lies in the z-buffer range [0,1] multiplied by 2^32 -1 then rounded to nearest int

39 Integrated vs. Separate Pick Function integrate: use same function to draw and pick simpler to code name stack commands ignored in render mode separate: customize functions for each potentially more efficient can avoid drawing unpickable objects

40 Select/Hit advantages faster OpenGL support means hardware acceleration avoid shading overhead flexible precision size of region controllable flexible architecture custom code possible, e.g. guaranteed frame rate disadvantages more complex

41 Hybrid Picking select/hit approach: fast, coarse object-level granularity manual ray intersection: slow, precise exact intersection point hybrid: both speed and precision use select/hit to find object then intersect ray with that object

42 OpenGL Precision Picking Hints gluUnproject transform window coordinates to object coordinates given current projection and modelview matrices use to create ray into scene from cursor location call gluUnProject twice with same (x,y) mouse location z = near: (x,y,0) z = far: (x,y,1) subtract near result from far result to get direction vector for ray use this ray for line/polygon intersection

43 Picking and P4 you must implement true 3D picking! you will not get credit if you just use 2D information