资源预览内容
第1页 / 共33页
第2页 / 共33页
第3页 / 共33页
第4页 / 共33页
第5页 / 共33页
第6页 / 共33页
第7页 / 共33页
第8页 / 共33页
第9页 / 共33页
第10页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Textures,Using Images in Modeling: Texturing,Modeling with polygons vs. Creative use of Textures (http:/www.siggraph.org/education/materials/HyperGraph/mapping/r_wolfe/r_wolfe_mapping_9.htm),The Behind story,Scan Conversion first (Lets take a triangle for example) 3 vertices (with color) are projected on to screen (triangle has a normal) On screen space, we figure out the boundaries of the triangle and scan from left to right and figure out the color for each pixel on the screen using light shading equation (e.g. using color at each vertex, normal direction and light direction),Texturing is similar,We first associate three 3D vertices with three points in the texture (rectangular) As we scan convert, we map the triangle region in texture space to triangle on screen space Figure out what “texel” to paste at a given pixel during scan conversion Many different mapping is possible: u, v U, V Planar: Linear, Bilinear, Projective Cylindrical Rectangular map Spherical Reflection Bump,2. Projection on to display screen,3.1 Map the right texel from texture through parameterization,3. Scan conversion,1. Three corresponding points between triangle vertices and region in texture,(u, v),(u, v),(U, V),(U, V),Why Projective Mapping?,Actually, if you think about it, better way? Perhaps is to, carry out the mapping between texture and 3D not between texture and projected 3D. But there is no way to compute for interior pixels original 3D location (inverse of perspective projection produces up to scale solutions) So we resort to above which should produce some kind of distortion (but probably negligible) maybe by employing projective mapping between texture space and screen space it might be a bit better Note that projective mapping needs 4 corner correspondence (may not work for triangle unless you give 4 point correspondence) Anyway these are hidden from casual users,Parameterization of each space,Source: (u, v), 0 = u,v = 1 Destination: (U, V), 0 = u,v = 1 Triangle: P0 + P1 * u + P2 * v Quadriliteral: (u, v) = f(P1, P2, P3, P4) Surface Parameterization,Linear Mapping / Affine (Rigid),Input: u, v F: au + bv (U, V) = (u v 1) a b 0 c d 0 0 0 1 4 unknowns Triangle: 3 correspondence points 6 equations to solve for,Bilinear Mapping,Input: u, v F: a * u + b * v + c * u * v + d (U, V) = (uv, u, v, 1) * (4x4 matrix) Inverse can be obtained if square (4 corresponding points) Covers whole space between arbitrary shapes? (e.g. affine is rigid and mapping is orthographic ) 8 unknowns 3 correspondence points (tri) 6 equations? 4 points (quad) 8 equations,Projective Mapping,Input: u, v F: au + bv + cw / gu + hv + i (U, V, W) = ( u, v, w ) * 3 x 3 matrix Projective TR matrix: all elements except one 0, 1) U = U/W, V = V/W Forshortening effect 8 unknowns (see notes) Quadriliteral : 4 correspondence points 8 equations,Hole Problem,Scanning the texture (forward) Holes / Overlapps Scanning the screen (inverse) U, V integers (256 x 256) (125.34, 34.56) Interpolation (Resampling),Billboards,Billboards,E.g. a picture of the plant is applied to either 1 or 2 flat polygons The most common case is a 2-polygon “X“ configuration (4 triangles) Alternately, you can use a single square polygon (2 triangles) and use code to make it turn toward the viewpoint A shadow on the ground under a tree helps a lot in “grounding“ it - making it appear to actually be on the ground, not floating above it shadow can be implemented as a black polygon with alpha = 0.5 Directional billboards The idea is to use the simple geometry of a billboard, but switch between one of several possible texture maps depending on the direction of view Billboard is rotated so that it always faces the viewer. It doesnt matter if the objects image is not rectangular. Portions of the billboard can be made transparent, so the parts of the billboard image that you dont want seen are not visible.,Moving Textures / Sprites,Sprites are pictures that can be moved around the screen. To create the effect of a moving sprite, the position of the sprite simply has to be changed between calls to Draw Frame. This can be done by redefining sprite 0 to be in a different position. Animating Sprites Sprites can also be animated easily. This can be done simply by changing the image the sprite is currently displaying. Each of the the images from 0 to 4 are displayed by the sprite in turn. This is usually done so quickly by the computer that the user just sees the sprite animate smoothly. Masks A color can be specified for each image. This color tells which color in the picture should be used as transparent. This means that wherever that color occurs in the picture will be left blank so only all the other colors will be drawn. Alpha channel masks,Billboards + Sprites + Alpha blending = Special Effects,For instance, a program can generate the appearance of fi
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号