1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,

Slides:



Advertisements
Similar presentations
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Advertisements

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.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
(conventional Cartesian reference system)
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping.
Texture mapping. Adds realism to computer graphics Texture mapping applies a pattern of color Bump mapping alters the surface Mapping is cheaper than.
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
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.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
Computer Graphics Texture Mapping Eriq Muhammad Adams
CS 638, Fall 2001 Admin Grad student TAs may have had their accounts disabled –Please check and the lab if there is a problem If you plan on graduating.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping. Example Mappings Mapping Techniques Consider the problem of rendering a sphere in the examples The geometry is very simple - a sphere.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Texture Mapping Course: Computer Graphics Presented by Fan Chen
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
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.
Texture Mapping. 2 Motivation A typical modern graphics card can handle 10s of millions of polygons a second. How many individual blades of grass are.
CS 445 / 645: Introductory Computer Graphics Light.
OpenGL Texture Mapping. 2 Objectives Introduce the OpenGL texture functions and options.
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CS418 Computer Graphics John C. Hart
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
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.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
第三课. Overview of this Section Concept of Texture Mapping ( 纹理映射 ) 2D Texture 3D Texture Environment Mapping Bump Mapping Others OpenGL Implementation.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Madhulika (18010), Assistant Professor, LPU.
Texture Mapping Fall, 2016.
© University of Wisconsin, CS559 Spring 2004
OpenGL Texture Mapping
The Graphics Rendering Pipeline
So Far We have assumed that we know: The point The surface normal
© University of Wisconsin, CS559 Fall 2004
3D Game Programming Texture Mapping
Textures II Week 10, Mon Mar 22
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Advanced Computer Graphics: Texture
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping Jung Lee.
OpenGL Texture Mapping
Presentation transcript:

1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates, Texgen  Rendering, Blending  Environmental, bump mapping  Billboards  3D (solid) textures  Shadows Eric Wernert

2 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Motivation  Texture mapping: Apply (paint) image on a polygon  Add realism to the scene without having to design and represent detailed geometry –Reduces modeling cost –Adds realism Wood, fabric –Improves performance Fewer polygons to transform Eric Wernert

3 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Process for using texture mapping  Create an image for texture –Load image of texture (its pixels are called texels) May be generated procedurally –Create mipmap (multi-resolution pyramid of textures)  Assign texture coordinates to vertices –In the application or using transforms  Enable texturing –Define context and select texture –Specify how to combine (blend) texture with shading color  Render the object –Send texture coordinates with each vertex

4 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Texture generation  Images (photos, paintings)  Math functions  Image effects, perturbations  Tiling (seems?)  Procedural –On mesh –In 3D Eric Wernert Durand&Cutler, MIT

5 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Mipmap Used to reduce aliasing when objects are small, a slight motion would assign a different texel to the same pixel  Computed using 2  2 averaging  Computed by OpenGL: gluBuild3DMipmaps()

6 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Assign/bind texture glTexImage2D(target, level, internalFormat, width, height, border, format, type, *texels); –target = GL_TEXTURE_2D –level = level of detail for mipmapping; default is 0 –internalFormat = GL_RGB, GL_RGBA, … –width, height = dimensions of image (powers of 2) –border = used when repeating is enabled, default = 0 –format = GL_RGB, GL_RGBA, etc. –type = GLubyte, GLuint, –texels = pointer to actual data

7 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Perspective distortion of texture  When using linear interpolation of (s,t) in screen space Durand&Cutler, MIT The rasterizer uses linear interpolation for texture coordinates. Perspective projection of uniform sampling is not uniform.

8 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Texture coordinates  Assign texture coordinates (s,t) in [0,1] to each vertex –Hard-coded by developer in your program –Assigned procedurally by application –Computed by OpenGL from vertex location & normal glMatrixMode(GL_TEXTURE); glPushMatrix(); glTranslatef(..); glRotatef(..).. glBegin(GL_POLYGON); glTexCoord2f(0.2, 0.5); glVertex3f(1.0, 2.5, 1.5); … glEnd(); glPopMatrix(); Eric Wernert

9 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Computed texture (using reprojection)  Assume projector C projecting an image into an object s t E C (s,t) identify a point in the projected image S S’ Use the perspective inversion and reprojection of fragment to get S’ Need (s,t) for S in the projector coordinate system S fragment (pixel+depth) generated by rasterizer. Not vertex! object projector viewer inversion reprojection

10 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Correct interpolation of reprojected texture texture For each fragment: Perspective coordinates of P: x’,y’,z’ Screen : (x,y,z)=(x’,y’,z’)/(d–z’) Model P=O+xI+yJ+zK Texture (s,t,r) =(O t P  I t, O t P  J t, O t P  K t ) Perspective texture (s’,t’,r’)=(s,t,r)/(d t +r) Use 2D texel (s’,t’) or 3D texel (s’,t’,r’) dtdtdtdt d screen P KtKtKtKt O OtOtOtOt K

11 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Blending texture and shaded color  You can blend texture color with the shaded color (reflection) Eric Wernert Modulate (default) multiplies shaded color by texture color. Alpha of texture modulates transparency. Decal replaces shaded color by texture color. Alpha of texture allows shaded color to show through. Blend texture intensity controls blend between shaded color and specified constant color.

12 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Billboards  For trees  Always orient towards viewer –Or select image based on orientation  Use transparency Eric Wernert

13 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Particles  Use particles as small billboards to render liquid, fire, smoke Eric Wernert

14 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Phong normal interpolation  Flat shading produces sharp ridges along edges  Gouraud smooth shading interpolates vertex colors across the triangle, but misses highlights  Phong shading interpolates normals across the triangle and uses each fragment’s normal for lighting

15 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Bump mapping  Intensity of texture used to perturb fragment’s normal –Height function, derivatives added to normal  Lighting is performed with the perturbed normal –Surface is not modified –Inconsistencies along silhouette Okion Graphics Durand&Cutler, MIT

16 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Texture coordinates generation (texgen)  OpenGL can generate texture coordinates automatically for you –linear combination of coordinates (eye- or object-space): glTexGenf(S, TEXTURE_GEN_MODE, OBJECT_LINEAR) glTexGenf(S, TEXTURE_GEN_MODE, EYE_LINEAR) glTexGenf(S, TEXTURE_GEN_MODE, SPHERE_MAP) or using sphere map for environment mapping.

17 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Environmental mapping  Developer specifies surrounding shape (cube, sphere) + texture  GPU uses as texture the color where reflected ray hits the surrounding shape

18 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Texture coordinates generation (texgen)  OpenGL also provides a 4  4 texture matrix –It can be used to transform the per-vertex texture coordinates, whether supplied explicitly or implicitly through texture coordinate generation. –Rescale, translate, project texture coordinates before the texture is applied during rasterization. s t E C S S’ object projector viewer inversion reprojection

19 SIC / CoC / Georgia Tech MAGIC Lab Rossignac 3D (solid) textures  3D array of texels T[s,t,r]  Great for procedural 3D textures –objects carved out of wood, marble  Mipmap must be provided by application 2  2  2 averaging  Enable 3D texture mapping glEnableGL_TEXTURE_3D_EXT(GL_TEXTURE_3D_EXT)  Transform texture by texture matrix as desired Eric Wernert

20 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Resources Mark Kilgard (Nvidia) with sample program “Fast Shadows and Lighting Effects Using Texture Mapping” Segal, Korobkin, van Widenfelt, Foran, Haeberli. SIGGRAPH Eric Wernert (Indiana): Texture generation: