Ying Zhu Georgia State University

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Michael I. Gold NVIDIA Corporation
Exploration of bump, parallax, relief and displacement mapping
Bump Mapping CSE 781 Roger Crawfis.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
3D Graphics Rendering and Terrain Modeling
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Guilford County Sci Vis V204.01
Image Processing.  a typical image is simply a 2D array of color or gray values  i.e., a texture  image processing takes as input an image and outputs.
Digital Images The digital representation of visual information.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Computer Graphics Texture Mapping
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Game Programming 06 The Rendering Engine
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
Computer Graphics Imaging Lecture 13 and 14 UV Mapping.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
Introduction to Computer Graphics
Computer Graphics Imaging
Week 7 - Wednesday CS361.
Week 7 - Monday CS361.
Programmable Pipelines
ATEC Procedural Animation
ATCM 3310 Procedural Animation
CSc 8820 Advanced Graphics Algorithms
Graphics Processing Unit
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
Basic Rendering Techniques
CS451Real-time Rendering Pipeline
Chapter 14 Shading Models.
Interactive Graphics Algorithms Ying Zhu Georgia State University
Reflections from Bumpy Surfaces
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Introduction to Computer Graphics with WebGL
CSE 381 – Advanced Game Programming Terrain
Chapter IX Bump Mapping
Computer Animation UV Mapping.
Computer Animation Texture Mapping.
(c) University of Wisconsin, CS 559
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
Chapter XIV Normal Mapping
CS-378: Game Technology Lecture #4: Texture and Other Maps
Advanced Computer Graphics: Texture
CS5500 Computer Graphics April 24, 2006.
Presentation transcript:

Ying Zhu Georgia State University Computer Graphics Algorithms Advanced Texture Mapping Techniques: displacement mapping, multi-texture, bump mapping, and projective texture mapping Ying Zhu Georgia State University

Heightmap and displacement mapping Heightmap is an image used to store surface elevation data for display in 3D computer grahics. In displacement mapping, a heightmap can be used to displace the position of vertices. In bump mapping, a heightmap can be used for generating the normal map.

Heightmap

Heightmap Heightmaps are widely used in games, terrain rendering software, GIS, scientific visualization, etc. Another name for heightmaps is “digital elevation models” Heightmaps are good for storing digital terrain elevations because they require less memory for a given level of detail than regular polygon mesh models.

Heightmap How to generate a heightmap? Terragen Picogen Many video games have editors for generating heightmaps See http://en.wikipedia.org/wiki/Heightmap for a list

Displacement mapping in OpenGL/GLSL Create a heightmap Load the heightmap in an OpenGL program, and then pass it to the vertex shader as a texture image. In the vertex shader, retrieve an RGB or RGBA vector from the heightmap for the vertex. This is called vertex texture.

Displacement mapping Convert the RGB or RGBA vector to a grayscale value. This is the amount of displacement for this vertex. Multiply the grayscale value to the normal vector of this vertex, and then add the result to the current vertex position. The normal vector guides the direction of the displacement. Multiply the new vertex position with the model-view-projection matrix.

Displacement mapping After vertex displacement, the original normal is no longer valid. You may need to recalculate the normal vectors, or create a normal map from the heightmap, or simply don’t do lighting at all. http://en.wikipedia.org/wiki/Displacement_mapping

Displacement mapping

Multi-texture mapping Multi-texture is quite easy with GLSL Load multiple texture images in the OpenGL program and then pass them to the shader. In the pixel shader, you can multiple, add, or mix the texture colors from multiple texture images. http://www.opengl.org/wiki/Multitexture_with_GLSL

Multi-texture mapping

Bump mapping Create the illusion of a bumpy, uneven surface without using a lot of small polygons Bump mapping is actually a per-pixel lighting technique

Bump mapping Basic idea Create a normal map that stores the normals for each pixel The “bumpiness” is encoded in the normal map. Load the normal map in the OpenGL program and then pass the normal map to the shader program as a texture image. In the fragment shader, retrieve the normal for the pixel from the normal map and then calculate lighting color with this normal vector. The key idea: Instead of interpolating the normals from the vertices, the normals are retrieved from the normal map.

Normal maps

Normal maps How to create a normal map? Convert a picture to a normal map using image editors (e.g. Photoshop, GIMP) Create a high resolution version and a low resolution version of the same 3D model, and then generate a normal map from the high resolution version for the low resolution version. Advanced modeling tools: Maya, Blender, etc. Nvidia’s Melody (http://developer.nvidia.com/object/melody_home.htm)

Normal maps How to generate normal map in GIMP? Install GIMP (http://gimp-win.sourceforge.net/) Download the GIMP Normalmap plugin (http://code.google.com/p/gimp-normalmap/) and follow the instructions in the readme file to install it. Open an image in GIMP. From the menu, choose Filters  Map  Normalmap Change the “Scale” value if you want to increase the “bumpiness”. Create the normal map and save it to an image file.

Simple bump mapping Bump mapping on a flat surface is quite easy Simply use the normal retrieved from the normal map for per-pixel lighting calculation. There is no need to transform the normal. This is because the coordinate system of the normal map and the coordinate system of the pixel is the same.

Simple bump mapping

General bump mapping Bump mapping on a curved surface is more complicated Retrieve the normal from the normal map Transform the pixel position to the tangent space (i.e. the normal map’s coordinate space) Calculate lighting in the tangent space. This is called tangent space bump mapping

General bump mapping Tutorials on the tangent space bump mapping http://wiki.gamedev.net/index.php/OpenGL:Tutorials:GLSL_Bump_Mapping http://www.blacksmith-studios.dk/projects/downloads/bumpmapping_using_cg.php http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter08.html

Projective texture mapping Project a texture from a (sometimes invisible) projector. Projective texture mapping is the basis for shadow mapping, lightmap, texture decal, etc.

Projective texture mapping

Projective texture mapping In regular texture mapping, the texture coordinates from each vertex is static, often calculated in the modeling software such as Maya, 3DS Max, or Blender. In projective texture mapping, the texture coordinates are calculated dynamically from the position of the vertex. Ignore the texture coordinates provided by the 3D model file.

Projective texture mapping The basic idea Suppose you look from the projector’s viewpoint, you will always see the texture image -- front and center. If you can project a 3D vertex to this 2D image, then the 2D location of the projected vertex is its projective texture coordinate. So the key is to construct a matrix to project any vertex to a 2D image from the projector’s viewpoint.

Projective texture mapping The steps: Construct a model-view-projection-bias matrix from the projector's viewpoint, using GLM’s lookat() and perspective() functions. A scale and bias matrix is used to scale the eventual texture coordinates to [0, 1] range. Pass this projectorMVPB matrix to the vertex shader.

Projective texture mapping The steps (continued): In the vertex shader, multiply the vertex position with this projectorMVPB matrix, and then use the first two component's of the transformed position as the texture coordinates for this vertex. Pass the texture coordinates to the fragment shader. Carry out texture mapping in the fragment shader as usual.

Projective texture mapping Since the texture may be clamped at the border, it’s better to use a texture with a black border.

Projective texture mapping An (old) tutorial on projective texture mapping from Nvidia http://developer.nvidia.com/object/Projective_Texture_Mapping.html This tutorial describes the matrices for transforming the vertex position to projective texture coordinates.