Lecture 5. Scan Conversion Textures hw2
|
|
- Myrtle Manning
- 5 years ago
- Views:
Transcription
1 Lecture 5 Scan Conversion Textures hw2
2 Announcements Homework deadlines Mini Project Proposals due June 26th
3 E.T. 06 Vector Graphics Algebraic equations describe shapes. Can render type and large areas of color with relatively small file sizes Can be reduced/enlarged with no loss of quality Cannot show continuous tone images (photographs, color blends) Examples: Plotters, Oscilloscopes, Illustrator, Flash
4 Raster Graphics aka. Pixel-based / Bit-mapped graphics Grid of pixels Size of grid = resolution of image Best for large photographic images Poor scalability : zoom in - loss of quality (jagged look) Modification at pixel level - texture mapping, blending, alpha channels, antialiasing, etc. Examples : E.T. 06 CRT, LCD, Dot-matrix printers Adobe Photoshop
5 Rasterization = Scan Conversion = Converting a continuous object such as a line or a circle into discrete pixels. E.T. 06
6 Scan Conversion of Lines
7 Scan conversion of lines Given two points with integer coordinates p 1 =[x 1, y 1 ], and p 2 =[x 2, y 2 ] the algorithm has to find a sequence of pixels approximating the line. Slope: (y 2 -y 1 )/(x 2 - x 1 ) We can always reorder p 1 and p 2 so that x 2 - x 1 is nonnegative. It is convenient to look at only nonnegative slopes; if the slope is negative, change the sign of y. Bunch of simplifications!
8 E.T. 06 Result: slope positive, and x2>x1 +y positive slope, x 2<x1 (x1,y1) (x2,y2) +x (x2,y2) negative slope (x1,y1) (x1,y1) y=0 (x2,y2) y=0 (x1,-y1) (x2,-y2)
9 Slope Slope reduction: it is convenient to have the slope of the line between 0 and 1; then we are able to step along x axis. slope > 1, cannot step along x To handle slope > 1, swap x and y slope < 1, can step along x
10 DDA Assume that the slope is between 0 and 1 Simplest algorithm (pompously called differential digital analyzer): Step along x, increment y by slope at each step. Round y to nearest pixel. float y = y1; float slope = (y2-y1)/(float)(x2-x1); int x; for(x = x1; x <= x2; x++) { } drawpixel(x, floor(y)); y += slope;
11 Bresenham Algorithm What is wrong with DDA? It requires floating-point operations. These operations are expensive to implement in hardware. They are not really necessary if the endpoints are integers. Idea: instead of incrementing y and rounding it at each step, decide if we just go to the right, or to the right and up using only integer quantities.
12 Increment decision pixel corners on different sides of the line increment both x and y pixel corners on the same side of the line increment only x Need: fast way to determine on which side of a line a point is.
13 Half-plane test Implicit equation can be used to perform the test. ( n (q # p)) " 0 (n (q # p)) $ 0 t he point on the same side with the normal n the point on the other side n q p p q
14 Implicit line equation The implicit equation of the line through p 1 =[x 1, y 1 ], and p 2 =[x 2, y 2 ] is (n,q-p 1 ) = 0, with n = [y 2, -y 1, x 1, -x 2 ] We need to test on which side of the line is the point q+d 1 = [x,y] +[1/2,1/2] d 1 [x,y] To do this, we need to determine the sign of F = (n,2q+2d 1-2p 1 ) Note that multiplication by two makes everything integer again! Key idea: compute this quantity incrementally.
15 Incremental computation At each step q = [x,y] changes either to [x+1,y] (step to the right) or to [x+1,y+1] (step to the right and up ); in vector form, the new value of q is either q +D 1 or q+d 2, with D 1 =[1,0] and D 2 =[1,1] Fnext = (n,2q+2d + 2d 1-2p 1 ) = (n,2q+ 2d 1-2p 1 ) + 2(n,D) = F + 2(n,D), where D is D 1 or D 2 At each step, to get new F we have to increment old F either by (n,d 1 ) or (n,d 2 ) (n,d 1 ) = y 2 -y 1 (n,d 2 ) = (y 2 -y 1 ) - (x 2 -x 1 )
16 Bresenham algorithm Assume the slope to be between 0 and 1. int y = y1; int dy = y2-y1; int dxdy = y2-y1+x1-x2; int F = y2-y1+x1-x2; int x; for( x = x1; x < =x2; x++ ) { drawpixel(x,y); if( F < 0 ) { F += dy; } else { y++; F+= dxdy; } }
17 Bresenham algorithm In For your an implementation you need to handle all slopes! First, reorder endpoints so that x 1, <= x 2 Then consider 4 cases: y 2, -y 1 >= 0, x 2, -x 1 >= y 2, -y 1 positive slope <= 1 y 2, -y 1 >= 0, x 2, -x 1 < y 2, -y 1 positive slope > 1 y 2, -y 1 < 0, x 2, -x 1 >= y 1, -y 2 negative slope >= -1 y 2, -y 1 < 0, x 2, -x 1 < y 1, -y 2 negative slope < -1 In each case, make appropriate substitutions in the algorithm.
18 Scan converting polygons
19 Polygons convex with self-intersections non-convex with holes We focus on the convex case
20 Scan Conversion of Convex Polygons General idea: decompose polygon into tiles scan convert each tile, moving along one edge
21 E.T. 06 Scan Convert a Convex Polygon void ScanY(Vertex2D v[],int num_vert,int bot_ind) Array of vertices ccw order V Index of vertex with smallest y Algorithm 1. Find left edge of tile Go around clockwise, starting from v[bot_ind], until an edge that is not contained in a scanline is found... vn-3 v1 vn-2 v0 vn-1
22 E.T. 06 Scan Convert a Convex Polygon void ScanY(Vertex2D v[],int num_vert,int bot_ind) Array of vertices ccw order Algorithm 1. Find left edge of tile 2. Find right edge of tile V Index of vertex with smallest y This time go ccw! vn-3... v1 vn-2 v0 vn-1
23 E.T. 06 Scan Convert a Convex Polygon void ScanY(Vertex2D v[],int num_vert,int bot_ind) Array of vertices ccw order V Index of vertex with smallest y Algorithm 1. Find left edge of tile 2. Find right edge of tile 3. Scan convert all scan lines going from left to right... vn-3 v1 vn-2 v0 vn-1
24 E.T. 06 Scan Convert a Convex Polygon void ScanY(Vertex2D v[],int num_vert,int bot_ind) Array of vertices ccw order V Index of vertex with smallest y Algorithm 1. Find left edge of tile 2. Find right edge of tile 3. Scan convert all scan lines going from left to right... vn-3 v1 vn-2 v0 vn-1
25 E.T. 06 Scan Convert a Convex Polygon void ScanY(Vertex2D v[],int num_vert,int bot_ind) Array of vertices ccw order V Index of vertex with smallest y Algorithm 1. Find left edge of tile 2. Find right edge of tile 3. Scan convert all scan lines going from left to right Repeat until... either endpt is v1 vn-3 reached vn-2 v0 vn-1
26 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
27 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
28 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
29 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
30 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
31 Convex Polygons void ScanY( Vertex2D v[], int num_vertices, int bottom_index) { } Initialize variables remaining_vertices = num_vertices; while(remaining_vertices > 0) { } Find the left top row candidate Determine the slope and starting x location for the left tile edge Find the right top row candidate Determine the slope and starting x location for the right tile edge for(row = bottom_row; row < left_top_row && row < right_top_row; row++) { ScanX(ceil(left_pos),ceil(right_pos),row); left_pos += left_step; right_pos += right_step; }... bottom_row = row; vn-3 v1 vn-2 v0 E.T. 06 vn-1
32 Find a tile Find the left top row candidate while( left_top_row <= bottom_row && remaining_vertices > 0) { Move to next edge: edge_start = left_edge_end; Be careful with C % operator, (N-1) % M will give -1 for N = 0, need to use (N+M-1) % M to get (N-1) mod M = N-1 left_edge_end = (left_edge_end+num_vertices-1)%num_vertices; left_top_row = ceil(v[left_edge_end].y); remaining_vertices--; } We found the first edge that sticks out over bottom_row determine the slope and starting x location for the left tile edge. if(left_top_row > bottom_row ) { left_step = (v[left_edge_end].x - v[edge_start].x)/ (v[left_edge_end].y - v[edge_start].y); left_pos = v[edge_start].x + (bottom_row-v[edge_start].y)*left_step; } vn-3 v1 vn-2 v0
33 Find a tile Find the right top row candidate; determine the slope and starting x location for the right tile edge. Exactly as for the left edge. Scan convert a single row: void ScanX(int left_col, int right_col, int row, int R, int G, int B) { } if( left_col < right_col) { } for( int x = left_col; x < right_col; x++) { } draw_pixel(x,y);
34 E.T. 06 Antialiasing
35 Texture Mapping
36 Why Textures? Brick wall - each brick separate polygon There may be bumps, rough spots... But a wall is just one large flat rectangle Then model it as one and glue a picture of a brick wall on the polygon. E.T. 06
37 Texture mapping Texture slides are based on E. Angel s slides y z x geometry screen image
38 Texture Example The texture (below) is a 256 x 256 image that has been mapped to a rectangular polygon which is viewed in perspective
39 E.T. 06 Steps in Texture Mapping 1. Specify a texture and create a texture object 2. Indicate how the texture is to be applied to each pixel 3. Enable texture mapping 4. Draw the scene supplying both texture and geometric coordinates
40 Specifying the Texture Define a texture image from an array of pixels in memory E.T. 06 void glteximage2d( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height GLint border, GLenum format, GLenum type, const GLVoid * texels ) GL_TEXTURE_2D if multiple resolutions, 0 otherwise components and resolutions GL_RGBA 2 M +2b GL_RGBA GL_UNSIGNED_BYTE
41 Converting A Texture Image If dimensions of image are not power of 2 gluscaleimage( format, w_in, h_in, type_in, *data_in, w_out, h_out, type_out, *data_out );! *_in is for source image! *_out is for destination image Image interpolated and filtered during scaling
42 Specifying a Texture: Other Methods Specifying a Texture: Other Methods Use frame buffer as source of texture image! uses current buffer as source image glcopyteximage2d(...) glcopyteximage1d(...) Modify part of a defined texture gltexsubimage2d(...) gltexsubimage1d(...) no size restriction Do both with glcopytexsubimage2d(...), etc.
43 E.T. 06 Texture Objects Stores texture data and makes it readily available. Have many textures and go back and forth using them Much faster than reloading an image using glteximage Sometimes a high-performance subset.
44 E.T. 06 Texture Objects 1. Generate texture names glgentextures(n, *texnames ); Return n unused names in array texnames creates, uses and stops using texture objects 2. Initially bind texture objects to texture data glbindtextures(target, id); Following calls to glteximage(), gltexsubimage(), gltexparameteri() store data in this texture object 3. If high-performance available - priorities 4. Bind and rebind to make textures available for models 5. Cleaning up gldeletetextures(n, *texnames);
45 E.T. 06 Steps in Texture Mapping 1. Specify a texture and create a texture object 2. Indicate how the texture is to be applied to each pixel 3. Enable texture mapping 4. Draw the scene supplying both texture and geometric coordinates
46 Texture Application Methods Filter Modes! minification or magnification! special mipmap minification filters Wrap Modes! clamping or repeating Texture Functions! how to mix primitive s color with texture s color! blend, modulate or replace texels
47 Filter Modes Example: gltexparameteri( target, type, mode ); Texture Magnification Polygon Texture Minification Polygon target: GL_TEXTURE_*D type : GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER mode: GL_NEAREST, GL_LINEAR, GL_*_MIPMAP_*(for min only) E.T. 06
48 E.T. 06 GL_NEAREST texel with coords nearest the center of the pixel is used. may cause aliasing artifacts. less computation GL_LINEAR weighted avg of 2x2 array texels that lie nearest to the center of the pixel. smoother results
49 Mipmaps multum in parvo -- many things in a small place A texture LOD technique Prespecify a series of prefiltered texture maps of decreasing resolutions Requires more texture storage Eliminates shimmering and flashing as objects move
50 MIPMAPS Arrange different versions into one block of memory
51 MIPMAPS With versus without MIPMAP
52 Mipmapped Textures Mipmap allows for prefiltered texture maps of decreasing resolutions Lessens interpolation errors for smaller textured objects Declare mipmap level during texture definition glteximage*d( GL_TEXTURE_*D, level, ) GLU mipmap builder routines glubuild*dmipmaps( ) (also scales orig. image) OpenGL 1.2 introduces advanced LOD controls
53 MipMaps OpenGL 1.2 introduces advanced LOD controls before: no on the fly changes (e.g. additional levels) could not pick lowest resolution popping effect GL_TEXTURE_BASE_LEVEL GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MIN_LOD GL_TEXTURE_MAX_LOD glubuild*dmipmaplevels(...) IF YOU FAIL TO LOAD A (NEC.) MIPMAP LEVEL BUT CALL FOR IT, TEXTURES GET DISABLED
54 Wrapping Mode Example: gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ) gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ) t texture s GL_REPEAT wrapping GL_CLAMP wrapping
55 Texture Functions Controls how texture is applied gltexenv{fi}[v]( GL_TEXTURE_ENV, prop, param ) GL_TEXTURE_ENV_MODE modes! GL_MODULATE! GL_BLEND! GL_REPLACE -use texture with lighting - different blending values per each color -overwrite current color with texture. Set blend color with GL_TEXTURE_ENV_COLOR [ GL_DECAL ] - if texture or model has translucency,it will be preserved
56 Perspective Correction Hint Texture coordinate and color interpolation! either linearly in screen space! or using depth/perspective values (slower) Noticeable for polygons on edge glhint( GL_PERSPECTIVE_CORRECTION_HINT, hint ) where hint is one of! GL_DONT_CARE! GL_NICEST! GL_FASTEST
57 E.T. 06 Steps in Texture Mapping 1. Specify a texture and create a texture object 2. Indicate how the texture is to be applied to each pixel 3. Enable texture mapping 4. Draw the scene supplying both texture and geometric coordinates
58 E.T. 06 glpixelstorei(gl_unpack_alignment, 1);... glenable() / gldisable() GL_TEXTURE_1D,GL_TEXTURE_2D,...
59 E.T. 06 Steps in Texture Mapping 1. Specify a texture and create a texture object 2. Indicate how the texture is to be applied to each pixel 3. Enable texture mapping 4. Draw the scene supplying both texture and geometric coordinates
60 Mapping a Texture Based on parametric texture coordinates gltexcoord*() specified at each vertex " &$%# Texture Space 1 #$%# Object Space '!$%"(%)%'&*+$%&*,(. &$%& 2 3 #$%&! '&*-$%&*+( / 0 '&*,$%&*-(
61 E.T. 06 Automatic Generation of Texture Coordinates gltexgen{ifd}[v] (coord, pname, param); glenable(gl_texture_gen_s/t/r) coord: GL_S, GL_T, GL_R PNAME GL_TEXTURE_GEN_MODE GL_OBJECT_PLANE GL_EYE_PLANE PARAM GL_OBJECT_LINEAR, GL_EYE_LINEAR GL_SPHERE_MAP [v] array of values
62 E.T. 06 Automatic Generation of Texture Coordinates Specify a plane: Ax+By+Cz+D = 0 Texture coordinates are defined as distances from this plane Example: GLfloat plane[4] = {A, B, C, D}; gltexgeni(gl_s, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); gltexgenfv(gl_s, GL_EYE_PLANE, plane); glenable(gl_texture_gen_s);
63 Eye vs. Object Plane
64 Applying Textures II! specify textures in texture objects! set texture filter! set texture function! set texture wrap mode! set optional perspective correction hint! bind texture object! enable texturing! supply texture coordinates for vertex! coordinates can also be generated
65 Bump Mapping Bump Mapping = + Geometry Bump map Bump mapped geometry
66 Displacement Mapping Bump mapped normals are inconsistent with surface geometry Shadow problems Displacement mapping affects surface geometry wikipedia.org
67 TGA image Pixel Hw2 Help i Has 4 entries : BGRA image=>pixels() one big array 4*(i)
68 Sphere Think of a unit circle first - parametric equation: (cos u, sin u) gives you a point on circle. Function of one variable u [0, π] Sphere has 2 variables: the angles u,v f(u,v) = (cos(v)cos(u), cos(v)sin(u), sin(v)) u [0, π], v [ π/2, π/2] m meridians, n parallels note the poles
69 Alpha Channels
Most device that are used to produce images are. dots (pixels) to display the image. This includes CRT monitors, LCDs, laser and dot-matrix
Scan Conversion of Lines Raster devices Most device that are used to produce images are raster devices, that is, use rectangular arrays of dots (pixels) to display the image. This includes CRT monitors,
More informationCS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial
CS335 Graphics and Multimedia Slides adopted from OpenGL Tutorial Texture Poly. Per Vertex Mapping CPU DL Texture Raster Frag FB Pixel Apply a 1D, 2D, or 3D image to geometric primitives Uses of Texturing
More informationCSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science
CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming Texture Mapping 2 Texture Poly. Per Vertex Mapping CPU DL Pixel Texture Raster Frag FB Apply a 1D, 2D,
More informationCS212. OpenGL Texture Mapping and Related
CS212 OpenGL Texture Mapping and Related Basic Strategy Three steps to applying a texture 1. specify the texture read or generate image assign to texture enable texturing 2. assign texture coordinates
More informationComputer Graphics. Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationObjectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)
CS 480/680 INTERACTIVE COMPUTER GRAPHICS Texture Mapping and NURBS Week 7 David Breen Department of Computer Science Drexel University Objectives Introduce Mapping Methods Texture Mapping Environmental
More informationOpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options
OpenGL Texture Mapping Objectives Introduce the OpenGL texture functions and options 1 Basic Strategy Three steps to applying a texture 1. 2. 3. specify the texture read or generate image assign to texture
More informationGraphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.
Graphics Texture Mapping 고려대학교컴퓨터그래픽스연구실 3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing
More informationImaging and Raster Primitives
Realtime 3D Computer Graphics & Virtual Reality Bitmaps and Textures Imaging and Raster Primitives Vicki Shreiner Imaging and Raster Primitives Describe OpenGL s raster primitives: bitmaps and image rectangles
More informationComputer Graphics. Three-Dimensional Graphics VI. Guoying Zhao 1 / 73
Computer Graphics Three-Dimensional Graphics VI Guoying Zhao 1 / 73 Texture mapping Guoying Zhao 2 / 73 Objectives Introduce Mapping Methods Texture Mapping Environment Mapping Bump Mapping Consider basic
More informationTextures. Texture Mapping. Bitmap Textures. Basic Texture Techniques
Texture Mapping Textures The realism of an image is greatly enhanced by adding surface textures to the various faces of a mesh object. In part a) images have been pasted onto each face of a box. Part b)
More informationOverview. Goals. MipMapping. P5 MipMap Texturing. What are MipMaps. MipMapping in OpenGL. Generating MipMaps Filtering.
Overview What are MipMaps MipMapping in OpenGL P5 MipMap Texturing Generating MipMaps Filtering Alexandra Junghans junghana@student.ethz.ch Advanced Filters You can explain why it is a good idea to use
More informationLecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation
Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options
More informationTexture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider
More informationGRAFIKA KOMPUTER. ~ M. Ali Fauzi
GRAFIKA KOMPUTER ~ M. Ali Fauzi Texture Mapping WHY TEXTURE? Imagine a Chess Floor Or a Brick Wall How to Draw? If you want to draw a chess floor, each tile must be drawn as a separate quad. A large flat
More informationTexture Mapping and Sampling
Texture Mapping and Sampling CPSC 314 Wolfgang Heidrich The Rendering Pipeline Geometry Processing Geometry Database Model/View Transform. Lighting Perspective Transform. Clipping Scan Conversion Depth
More informationLecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009
s The s Lecture 22 Sections 8.8, 8.9, 8.10 Hampden-Sydney College Wed, Oct 28, 2009 Outline s The 1 2 3 4 5 The 6 7 8 Outline s The 1 2 3 4 5 The 6 7 8 Creating Images s The To create a texture image internally,
More informationCS Rasterization. Junqiao Zhao 赵君峤
CS10101001 Rasterization Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Vector Graphics Algebraic equations describe
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due this Friday Midterm next Tuesday
More informationTexture Mapping. Mike Bailey.
Texture Mapping 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License TextureMapping.pptx The Basic Idea
More informationBuffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Buffers 1 Objectives Introduce additional WebGL buffers Reading and writing buffers Buffers and Images 2 Buffer Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number
More informationCS 130 Final. Fall 2015
CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying
More informationLecture 5 3D graphics part 3
Lecture 5 3D graphics part 3 Shading; applying lighting Surface detail: Mappings Texture mapping Light mapping Bump mapping Surface detail Shading: takes away the surface detail of the polygons Texture
More informationLecture 07: Buffers and Textures
Lecture 07: Buffers and Textures CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA October 26, 2010 OpenGL Pipeline Today s Focus Pixel Buffers: read and write image data to and from
More informationINF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry Texturing Christopher Dyken Martin Reimers 06.10.2010 Page 1 Texturing Linear interpolation Real Time Rendering: Chapter 5: Visual Appearance Chapter 6:
More informationCISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping
CISC 3620 Lecture 7 Lighting and shading Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping Exam results Grade distribution 12 Min: 26 10 Mean: 74 8 Median:
More information三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒
三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒 1 In this chapter, you will learn The basics of texture mapping Texture coordinates Texture objects and texture binding Texture specification
More informationก ก ก.
418382 ก ก ก ก 5 pramook@gmail.com TEXTURE MAPPING Textures Texture Object An OpenGL data type that keeps textures resident in memory and provides identifiers
More informationTexture Mapping and Special Effects
Texture Mapping and Special Effects February 23 rd 26 th 2007 MAE 410-574, Virtual Reality Applications and Research Instructor: Govindarajan Srimathveeravalli HW#5 Due March 2 nd Implement the complete
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 7 Part 2 Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 1 Topics Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 2
More informationCS452/552; EE465/505. Texture Mapping in WebGL
CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2
More informationTexture Mapping CSCI 4229/5229 Computer Graphics Fall 2016
Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016 What are texture maps? Bitmap images used to assign fine texture to displayed surfaces Used to make surfaces appear more realistic Must move with
More information2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into
2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel
More informationINF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry Texturing Christopher Dyken Martin Reimers 06.10.2010 Page 1 Texturing Linear interpolation Real Time Rendering: Chapter 5: Visual Appearance Chapter 6:
More informationCSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011
CSE 167: Introduction to Computer Graphics Lecture 11: Textures 2 Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework assignment #5 due Friday, Nov 4,
More informationChapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or
Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or Part of a Texture Image One Dimensional Textures Using
More informationCMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013
CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013 Surface Detail: We have discussed the use of lighting as a method of producing more realistic images. This is fine for smooth surfaces of uniform
More informationCSE 167: Introduction to Computer Graphics Lecture #9: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013
CSE 167: Introduction to Computer Graphics Lecture #9: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Added Tuesday office hours for Krishna: 11am-12
More informationGrafica Computazionale
Grafica Computazionale lezione36 Informatica e Automazione, "Roma Tre" June 3, 2010 Grafica Computazionale: Lezione 33 Textures Introduction Steps in Texture Mapping A Sample Program Texturing algorithms
More informationCSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018
CSE 167: Introduction to Computer Graphics Lecture #7: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Project 2 due this Friday at 2pm Grading in
More informationLighting and Texturing
Lighting and Texturing Michael Tao Michael Tao Lighting and Texturing 1 / 1 Fixed Function OpenGL Lighting Need to enable lighting Need to configure lights Need to configure triangle material properties
More informationTexture mapping. Computer Graphics CSE 167 Lecture 9
Texture mapping Computer Graphics CSE 167 Lecture 9 CSE 167: Computer Graphics Texture Mapping Overview Interpolation Wrapping Texture coordinates Anti aliasing Mipmaps Other mappings Including bump mapping
More informationScan Conversion. Drawing Lines Drawing Circles
Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan
More informationComputer Graphics Texture Mapping
! Computer Graphics 2013! 13. Texture Mapping Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2013-10-28 About the final examination - Next Friday (Nov. 8th) Night, - 7:30PM - 9:00PM (one and
More informationAnnouncements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics
Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons
More informationTexturing. Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology
Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1 Texturing: Glue n-dimensional images onto geometrical objects l Purpose:
More informationTexturas. Objectives. ! Introduce Mapping Methods. ! Consider two basic strategies. Computação Gráfica
Texturas Computação Gráfica Objectives! Introduce Mapping Methods! Texture Mapping! Environmental Mapping! Bump Mapping! Light Mapping! Consider two basic strategies! Manual coordinate specification! Two-stage
More informationCap. 3 Textures. Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre
Cap. 3 Textures Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre Overview Objectives Notion of texture Motivation Texture mapping, texture patterns, and texels Mapping textures to polygons,
More informationRasterization, or What is glbegin(gl_lines) really doing?
Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm
More informationToday. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik
Computergrafik Today Basic shader for texture mapping Texture coordinate assignment Antialiasing Fancy textures Matthias Zwicker Universität Bern Herbst 2009 Texture mapping Glue textures (images) onto
More informationCS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu
CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping
More informationRasterization: Geometric Primitives
Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels
More informationOpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.
D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,
More informationFrom Ver(ces to Fragments: Rasteriza(on
From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate
More informationAssignment #5: Scalar Field Visualization 3D: Direct Volume Rendering
Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering Goals: Due October 4 th, before midnight This is the continuation of Assignment 4. The goal is to implement a simple DVR -- 2D texture-based
More informationTópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.
Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,
More informationComputational Strategies
Computational Strategies How can the basic ingredients be combined: Image Order Ray casting (many options) Object Order (in world coordinate) splatting, texture mapping Combination (neither) Shear warp,
More informationCS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics
CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Project 2 is due this Friday at 2pm Next Tuesday
More informationCSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014
CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 Announcements Project 2 due Friday, Oct. 24 th Midterm Exam
More informationAnnouncements. Written Assignment 2 is out see the web page. Computer Graphics
Announcements Written Assignment 2 is out see the web page 1 Texture and other Mappings Shadows Texture Mapping Bump Mapping Displacement Mapping Environment Mapping Watt Chapter 8 COMPUTER GRAPHICS 15-462
More informationComputer Graphics. - Rasterization - Philipp Slusallek
Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive
More information+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation
Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Chalmers University of Technology Texturing: Glue n-dimensional images onto geometrical objects Purpose: more realism, and this is a cheap
More informationDiscrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of
Discrete Techniques 11 th Week, 2010 Buffer Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of bits/pixel Pixel OpenGL Frame Buffer OpenGL Buffers Color buffers
More informationComputergrafik. Matthias Zwicker Universität Bern Herbst 2016
Computergrafik Matthias Zwicker Universität Bern Herbst 2016 2 Today Basic shader for texture mapping Texture coordinate assignment Antialiasing Fancy textures 3 Texture mapping Glue textures (images)
More informationCOMP30019 Graphics and Interaction Scan Converting Polygons and Lines
COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence
More informationEinführung in Visual Computing
Einführung in Visual Computing 186.822 Rasterization Werner Purgathofer Rasterization in the Rendering Pipeline scene objects in object space transformed vertices in clip space scene in normalized device
More informationCOMP371 COMPUTER GRAPHICS
COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture
More information-=Catmull's Texturing=1974. Part I of Texturing
-=Catmull's Texturing=1974 but with shaders Part I of Texturing Anton Gerdelan Textures Edwin Catmull's PhD thesis Computer display of curved surfaces, 1974 U.Utah Also invented the z-buffer / depth buffer
More informationCSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California
CSCI 420 Computer Graphics Lecture 14 Rasterization Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California 1 Rasterization (scan conversion) Final step in pipeline:
More informationCS452/552; EE465/505. Clipping & Scan Conversion
CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:
More informationRasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)
CSCI 420 Computer Graphics Lecture 14 Rasterization Jernej Barbic University of Southern California Scan Conversion Antialiasing [Angel Ch. 6] Rasterization (scan conversion) Final step in pipeline: rasterization
More informationScan Conversion. CMP 477 Computer Graphics S. A. Arekete
Scan Conversion CMP 477 Computer Graphics S. A. Areete What is Scan-Conversion? 2D or 3D objects in real world space are made up of graphic primitives such as points, lines, circles and filled polygons.
More informationTopic #1: Rasterization (Scan Conversion)
Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but
More informationChapter 6 Texture Mapping
Chapter 6 Texture Mapping Understand what texture mapping can add to your scene Specifying the texture map and how its coordinates relate to those of the objects in your scene Control how a texture image
More informationTSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY
1(61) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(61) Lecture 6 Texture mapping Skyboxes Environment mapping Bump mapping 2(61)2(61) Texture mapping
More informationCS 543: Computer Graphics. Rasterization
CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots
More informationComputer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing
Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)
More informationFrom Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.
From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)
More informationEF432. Introduction to spagetti and meatballs
EF432 Introduction to spagetti and meatballs CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~karan/courses/418/fall2015 Instructor: Karan
More informationAssignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering
Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering Goals: Due October 9 th, before midnight With the results from your assignement#2, the
More informationCT5510: Computer Graphics. Texture Mapping
CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons
More informationFall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.
Fall 2015 CSCI 420: Computer Graphics 7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering Pipeline 2 Outline Scan Conversion for Lines Scan Conversion for Polygons Antialiasing 3 Rasterization
More informationLine Drawing. Foundations of Computer Graphics Torsten Möller
Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel
More informationClipping and Scan Conversion
15-462 Computer Graphics I Lecture 14 Clipping and Scan Conversion Line Clipping Polygon Clipping Clipping in Three Dimensions Scan Conversion (Rasterization) [Angel 7.3-7.6, 7.8-7.9] March 19, 2002 Frank
More informationLine Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller
Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism
More informationgraphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1
graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time
More informationgraphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1
graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time
More informationChapter 8: Implementation- Clipping and Rasterization
Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or
More information9.Texture Mapping. Chapter 9. Chapter Objectives
Chapter 9 9.Texture Mapping Chapter Objectives After reading this chapter, you ll be able to do the following: Understand what texture mapping can add to your scene Specify texture images in compressed
More informationThe Traditional Graphics Pipeline
Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray
More informationRealtime 3D Computer Graphics Virtual Reality
Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,
More informationComputer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1
Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line
More informationEECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing
EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate
More informationThe Traditional Graphics Pipeline
Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics
More informationChapter - 2: Geometry and Line Generations
Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics
More informationTexturing. Slides done by Tomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology
Texturing Slides done by Tomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1 Texturing: Glue n-dimensional images onto geometrical objects l Purpose:
More informationThe Traditional Graphics Pipeline
Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs
More informationComputer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer
Chapter VII Rasterizer Rasterizer The vertex shader passes the clip-space vertices to the rasterizer, which performs the following: Clipping Perspective division Back-face culling Viewport transform Scan
More informationTexture Mapping. Texture (images) lecture 16. Texture mapping Aliasing (and anti-aliasing) Adding texture improves realism.
lecture 16 Texture mapping Aliasing (and anti-aliasing) Texture (images) Texture Mapping Q: Why do we need texture mapping? A: Because objects look fake and boring without it. Adding texture improves realism.
More information