Graphics Graphics Korea University 1 Jang Sumi 2002.1.29 Texture Mapping Environment Mapping Stencil Buffer.

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
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.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 6, 2014 TEXTURE MAPPING TEXTURES BUMP MAPPING ENVIRONMENT MAPPING PROCEDURAL TEXTURING.
3D Graphics for Game Programming (J. Han) Chapter VIII Image Texturing.
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Computer Graphics Shadows
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Computer Graphics Mirror and Shadows
1 Texturing. 2 What is Texturing? 3 Texture Mapping Definition: mapping a function onto a surface; function can be:  1, 2, or 3D  sampled (image) or.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
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.
1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.
Queensland University of Technology CRICOS No J INB382/INN382 Real-Time Rendering Techniques Lecture 13: Revision Ross Brown.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Computer Graphics Texture Mapping
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)
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.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Chapter 6 Special Effects 강 신 진강 신 진
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
Game Programming (Mapping) Spring.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
Textures Repeated patterns Texture can be uniform or irregular Ex:fabric,soil,brick Surface finish also known as surface texture T = P 1 * V 1 * V c T=
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
CSCI 440.  So far we have learned how to  build shapes  create movement  change views  add simple lights  But, our objects still look very cartoonish.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Module 06 –environment mapping Module 06 – environment mapping Module 06 Advanced mapping techniques: Environment mapping.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
Non-Photorealistic Rendering FORMS. Model dependent Threshold dependent View dependent Outline form of the object Interior form of the object Boundary.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
Mapping: Image Texturing CPSC 591/691. Texture Mapping Two-dimensional techniques place a two-dimensional (flat) image onto an object using methods similar.
Texturing CMSC 435/ What is Texturing? 2 Texture Mapping Definition: mapping a function onto a surface; function can be: – 1, 2, or 3D – sampled.
Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.

Discrete Techniques.
Computer Graphics Chapter 9 Rendering.
ATEC Procedural Animation
ATCM 3310 Procedural Animation
3D Graphics Rendering PPT By Ricardo Veguilla.
Chapters VIII Image Texturing
Interactive Graphics Algorithms Ying Zhu Georgia State University
Real-time Rendering Shadow Maps
3D Game Programming Texture Mapping
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
OpenGL Texture Mapping
3D Game Programming Texture Mapping
Presentation transcript:

Graphics Graphics Korea University 1 Jang Sumi Texture Mapping Environment Mapping Stencil Buffer

CGVR Graphics Korea University 2 1. Texture Mapping Mip-Mapping 2. Environment Mapping 3. Stencil Buffer 4. Demonstration Contents

CGVR Graphics Korea University 3 Basic Texturing Concepts Texture Addressing Modes Wrap, Mirror, Clamp, Border Color Texture coordinates Texture Filtering 1. Texture Mapping

CGVR Graphics Korea University 4 Basic Texturing Concepts Textures In real World  object's smoothness or roughness Computer Graphics  a bitmap of pixel colors that give an object the appearance of texture  creating realism in computer-generated 3-D images

CGVR Graphics Korea University 5 Basic Texturing Concepts Textures 2D texture 3D texture

CGVR Graphics Korea University 6 Addressing Modes (Warp) Wrap Texture Address Mode repeat the texture on every integer junction (default mode)

CGVR Graphics Korea University 7 Addressing Modes (Warp) CF. Texture Wrap A texture wrapA flat wrapA cylindrical wrapA spherical wrap (cutaway view)

CGVR Graphics Korea University 8 Addressing Modes (Mirror) Mirror Texture Address Mode mirror the texture at every integer boundary

CGVR Graphics Korea University 9 Addressing Modes (Clamp) Clamp Texture Address Mode apply the texture once, then smear the color of edge pixels

CGVR Graphics Korea University 10 Addressing Modes (Border Color) Border Color Texture Address Mode use an arbitrary color (=border color) for any texture coordinates outside the range of 0.0 through 1.0, inclusive

CGVR Graphics Korea University 11 Addressing Modes (source code) IDirect3DDevice8::SetTextureStageState() Parameters  1 st : specify the desired texture stage identifier  2 nd : update the u-, v-, or w-addressing modes individually.  3 rd : determine which mode is being set. typedef enum _D3DTEXTUREADDRESS { D3DTADDRESS_WRAP= 1, D3DTADDRESS_MIRROR= 2, D3DTADDRESS_CLAM= 3, D3DTADDRESS_BORDER= 4, D3DTADDRESS_MIRRORONCE = 5, D3DTADDRESS_FORCE_DWORD= 0x7fffffff } D3DTEXTUREADDRESS;

CGVR Graphics Korea University 12 Texture Filtering Purpose Magnify or minify a texture When a texture is being mapped onto a primitive image that is larger or smaller than itself

CGVR Graphics Korea University 13 Texture Filtering Nearest Point Sampling A simple texture-mapping technique that places texels on a textured object. Performance  If similar sizes  fast and efficient  If not  chunky, aliased, or blurred result chunky

CGVR Graphics Korea University 14 Texture Filtering Linear Texture Filtering Computes a weighted average of the texels (above, below, left, right of the nearest sample point)  +: shows better result than Nearest Point Sampling  -: edges or a chunky result Pixel center Nearest Point SamplingLinear Texture Filtering

CGVR Graphics Korea University 15 Texture Filtering Anisotropic Texture Filtering

CGVR Graphics Korea University 16 Texture Filtering (Mip-Map) Texture Filtering with Mip-map Use sequence of textures Performance  +: High quality  -: Memory overhead

CGVR Graphics Korea University 17 Texture Filtering (Mip-Map) Mip-Map Result (1) The ugly 'bitty' look near the top is the moiré pattern in action. Same scene rendered using mip-mapping.

CGVR Graphics Korea University 18 Texture Filtering (Mip-Map) Mip-Map Result (2) This demonstrates where the different mip-map levels are used by inverting the texture colour at each level.

CGVR Graphics Korea University 19 Texture Filtering (Source) Mip-Map IDirect3DTexture8 * pMipMap; d3dDevice->CreateTexture(256, 256, 5, 0, D3DFMT_R8G8B8, D3DPOOL_MANAGED, &pMipMap); d3dDevice->SetTexture(0, pMipMap); d3dDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_POINT);

CGVR Graphics Korea University Environment Mapping Purpose simulates highly reflective surfaces without using ray tracing T-1000 knows all about environment mapping.

CGVR Graphics Korea University Environment Mapping Cubic Environment Mapping  textures that contain image data representing the scene surrounding an object  as if the object were in the center of a cube.

CGVR Graphics Korea University 22 Cubic Env. Mapping Cubic Environment Mapping (1) textures that contain image data representing the scene surrounding an object as if the object were in the center of a cube.

CGVR Graphics Korea University 23 Cubic Env. Mapping Cubic Environment Mapping (2)

CGVR Graphics Korea University 24 Cubic Env. Mapping Mipmapped Cubic Environment Maps  IDirect3DCubeTexture8::GetCubeMapSurface

CGVR Graphics Korea University 25 Cubic Env. Mapping Texture Coordinates for Cubic Environment Maps Fomula: if D3DRS_LOCALVIEWER is TRUE else R is the reflection vector being computed E is the normalized Position -to-eye vector N is the camera-space vertex normal N Z is the world space reflection vector from either formula

CGVR Graphics Korea University 26 Cubic Env. Mapping DWORD dwFVF= D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVFTEX1 | D3DFVF_TEXCOORDSIZE3(0); m_d3dDevice->SetTextureStageState ( 2, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR | 1);

CGVR Graphics Korea University 27 Cubic Env. Mapping Creating Cubic Environment Map Surfaces IDirect3DDevice8::CreateCubeTexture LPDIRECT3DCUBETEXTURE8 m_pCubeMap; m_d3dDevice->CreateCubeTexture( 256, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R8G8B8, D3DPOOL_DEFAULT, &m_pCubeMap );

CGVR Graphics Korea University 28 Cubic Env. Mapping Accessing Cubic Environment Map Faces IDirect3DCubeTexture8::GetCubeMapSurface LPDIRECT3DSURFACE8 pFace2; m_pCubeMap->GetCubeMapSurface( D3DCUBEMAP_FACE_POSITIVE_Y, 0, &pFace2);

CGVR Graphics Korea University 29 Spherical Environment Mapping 2-D representation of the full 360-degree view of the scene surrounding of an object as if taken through a fish-eye lens

CGVR Graphics Korea University 30 Spherical Environment Mapping Texture Coordinates for Spherical Environment Maps Formula u and v are the texture coordinates being computed Nx and Ny are the x and y components of the camera-space vertex normal.

CGVR Graphics Korea University 31 Spherical Environment Mapping Applying Spherical Environment Maps  IDirect3DDevice8::SetTexture  IDirect3DTexture8

CGVR Graphics Korea University Stencil Buffer Purpose mask pixels in an image The mask controls whether the pixel is drawn. This helps to reduce the workload and increases performance.

CGVR Graphics Korea University 33 Dissolve one image is gradually replaced by another Fade (in/out) Dissolve from/to a black or white image to a scene A special case of dissolving Swipe series of stencil masks 3. Stencil Buffer

CGVR Graphics Korea University Stencil Buffer Decaling control which pixels from a particular primitive image are drawn to the rendering target surface Compositing occlude an area of the rendering target surface Write some other texture to the occluded area Outline mask same shape but slightly smaller Silhouette stencil mask is the same size and shape as the primitive

CGVR Graphics Korea University Stencil Buffer How the Stencil Buffer Works 1. Stencil ReferenceAND Stencil Mask 2. Stencil Buffer ValueAND Stencil Mask 3. Compare the result of step 1 to the result of step 2, using the comparison function.  (StencilRef & StencilMask) CompFunc (StencilBufferValue & StencilMask)

CGVR Graphics Korea University Stencil Buffer Source Code Comparison function  typedef enum _D3DRENDERSTATETYPE { ……. D3DRS_STENCILFUNC …… }

CGVR Graphics Korea University Stencil Buffer  typedef enum _D3DCMPFUNC { D3DCMP_NEVER = 1, D3DCMP_LESS = 2, D3DCMP_EQUAL = 3, D3DCMP_LESSEQUAL = 4, D3DCMP_GREATER = 5, D3DCMP_NOTEQUAL = 6, D3DCMP_GREATEREQUAL = 7, D3DCMP_ALWAYS = 8, D3DCMP_FORCE_DWORD = 0x7fffffff } D3DCMPFUNC;

CGVR Graphics Korea University Demonstration Cube Map

CGVR Graphics Korea University Demonstration Fish Eye

CGVR Graphics Korea University Demonstration Shadow Volume (Stencil buffer)Stencil Mirror

CGVR Graphics Korea University Demonstration Stencil Depth