outline texture mapping
play

Outline Texture Mapping Modeling surface details with images. - PowerPoint PPT Presentation

Outline Texture Mapping Modeling surface details with images. Roger Crawfis Texture parameterization Ohio State University Texture evaluation Anti-aliasing and textures. Texture Mapping Texture Mapping Why use textures?


  1. Outline Texture Mapping • Modeling surface details with images. Roger Crawfis • Texture parameterization Ohio State University • Texture evaluation • Anti-aliasing and textures. Texture Mapping Texture Mapping • Why use textures? • Modeling complexity

  2. Quote Texture Mapping “I am interested in the effects on an object that speak of • Given an object and an image: human intervention. This is another factor that you must – How does the image map to the vertices or set take into consideration. How many times has the object been painted? Written on? Treated? Bumped into? of points defining the object? Scraped? This is when things get exciting. I am curious about: the wearing away of paint on steps from continual use; scrapes made by a moving dolly along the baseboard of a wall; acrylic paint peeling away from a previous coat of an oil base paint; cigarette burns on tile or wood floors; chewing gum – the black spots on city sidewalks; lover’s names and initials scratched onto park benches…” - Owen Demers [digital] Texturing & Painting, 2002 Jason Bryan Texture Mapping Texture Mapping Jason Bryan Jason Bryan

  3. Texture Mapping Texture Mapping Jason Bryan Jason Bryan Texture Mapping Texture Mapping • Given an object and an image: • Given an object with an image mapped to it: – How does the image map to the vertices or set – How do we use the color information from the of points defining the object? texture image to determine a pixel’s color?

  4. Texture Mapping Texture Mapping • Problem #1 Fitting a square peg in a round • Problem #2 Mapping from a pixel to a texel hole What is an image? What is a Texture? • Given the (u,v), want: • How would I rotate an image 45 degrees? – F F (u,v) ==> a continuous reconstruction – • How would I translate it 0.5 pixels? • = { R(u,v), G(u,v), B(u,v) } • = { I(u,v) } • = { index(u,v) } • = { alpha(u,v) } • = { normals(u,v) } • = { surface_height(u,v) } • = ...

  5. What is the source of your Procedural Texture Texture? Periodic and everything else • Procedural Image Checkerboard • RGB Image Scale: s= 10 • Intensity image If (u * s) % 2=0 && (v * s)%2=0 • Opacity table texture(u,v) = 0; // black Else texture(u,v) = 1; // white RGB Textures Intensity Modulation Textures • Places an image on the object • Multiply the objects color by that of the texture. Camuto 1998

  6. Opacity Textures Color Index Textures • A binary mask, really redefines the • New Microsoft Extension for 8-bit textures. geometry. • Also some cool new extensions to SGI’s OpenGL to perform table look-ups after the texture samples have been computed. Lao 1998 Bump Mapping Displacement Mapping • This modifies the surface normals. • Modifies the surface position in the direction of the surface normal. • More on this later. Lao 1998 Lao 1998

  7. Reflection Properties Texture and Texel • Each pixel in a texture map is called a Texel • Kd, Ks • Each Texel is associated with a 2D, (u,v), • BDRF’s texture coordinate – Brushed Aluminum • The range of u, v is [0.0,1.0] – Tweed – Non-isotropic or anisotropic surface micro facets. (u,v) tuple Two-Stage Mapping • For any (u,v) in the range of (0-1, 0-1), we 1. Model the mapping: (x,y,z) -> (u,v) can find the corresponding value in the 2. Do the mapping texture using some interpolation

  8. Image space scan Image space scan For each scanline, y • Problems: For each pixel, x – Finding the inverse mapping compute u(x,y) and v(x,y) • Use one of the analytical mappings that are copy texture(u,v) to image(x,y) invertable. • Bi-linear or triangle inverse mapping – May miss parts of the texture map • Samples the warped texture at the appropriate image pixels. Texture Image • inverse mapping Texture space scan Texture space scan For each v • Problems: For each u – May not fill image compute x(u,v) and y(u,v) – Forward mapping needed copy texture(u,v) to image(x,y) • Places each texture sample to the mapped image pixel. Image Texture • forward mapping

  9. Continuous functions F (u,v) How do we get F (u,v)? • We are given a discrete set of values: • Higher-order interpolation F (u,v) = ∑ i ∑ j F [i,j] h(u,v) – F [i,j] for i= 0 ,…,N, j= 0 ,…,M – F – • Nearest neighbor: – h(u,v) is called the reconstruction kernel • Guassian – F F (u,v) = F [ round(N*u), round(M*v) ] – • Sinc function • Linear Interpolation: • splines – i = floor(N*u), j = floor(M*v) – Like linear interpolation, need to find – interpolate from F [i,j], F [i +1 ,j], F [i,j +1 ], neighbors. F [i +1 ,j+1] • Usually four to sixteen Texture Parameterization Texture Parameterization • Definition: • Mapping to a 3D Plane – The process of assigning texture coordinates or – Simple Affine transformation a texture mapping to an object. • rotate • scale • The mapping can be applied: y • translate – Per-pixel v z – Per-vertex x u

  10. Texture Parameterization Texture Parameterization • Mapping to Sphere • Mapping to a Cylinder – Impossible!!!! – Rotate, translate and scale in the uv-plane – Severe distortion at the poles – u -> theta – u -> theta – v -> z – v -> phi – x = r cos(theta), y = r sin(theta) v – x = r sin(theta) cos(phi) – y = r sin(theta) sin(phi) – z = r cos(theta) u Part of a sphere Texture Parameterization Example (Rogers) x( θ , φ ) = sin θ sin φ 0 ≤ θ ≤ π /2 • Mapping to a Sphere y( θ , φ ) = cos φ π /4 ≤ φ ≤ π /2 z( θ , φ ) = cos θ sin φ (u,v) = (0,0) ⇔ ( θ , φ ) = (0, π /2) (u,v) = (1,0) ⇔ ( θ , φ ) = ( π /2, π /2) (u,v) = (0,1) ⇔ ( θ , φ ) = (0, π /4) v (u,v) = (1,1) ⇔ ( θ , φ ) = ( π /2, π /4) • Setup up surface, define correspondence, and voila! u

  11. Example Continued All Is Not Good • Can even solve for ( θ , φ ) and ( u , v ) • Let’s take a closer look: – A= π /2, B=0, C=- π /4, D= π /2 π π π θ = φ = − ( u , v ) u ( u , v ) v 2 2 4 θ − φ π θ φ = θ φ = 2 u ( , ) v ( , ) π π 2 4 Started with squares and ended with curves � So looks like we have the texture space ⇔ object space part done! It only gets worse for larger parts of the sphere Texture Parameterization Two-pass Mappings v • Mapping to a Cube • Map texture to: – Plane – Cylinder u – Sphere u-axis – Box v common • Map object to same. seam u

  12. S and O Mapping S Mapping Example • Pre-distort the texture by mapping it onto a • Cylindrical Mapping simple surface like a plane, cylinder, sphere, or box • Map the result of that onto the surface • Texture → Intermediate is S mapping • Intermediate → Object is O mapping S T θ − θ − z z (u,v) (x i ,y i ) (x o ,y o ,z o ) = = s A t A θ − θ − Texture space Intermediate space Object space z z B A B A O Mapping O Mappings Cont’d • A method to relate the surface to the cylinder • Bier and Sloan defined 4 main ways Reflected ray Object normal or or Object centroid Intermediate surface normal

  13. Texture Parameterization Texture Parameterization • Plane/ISN (projector) • Plane/ISN – Works well for planar objects • Cylinder/ISN (shrink-wrap) – Works well for solids of revolution • Box/ISN Works well for roughly • Sphere/Centroid spherical shapes • Box/Centroid Texture Parameterization Texture Parameterization • Plane/ISN • Plane/ISN – Resembles a slide – Draw vector from point (vertex or object space projector pixel point) in the direction of the texture plane. – Distortions on surfaces – The vector will intersect perpendicular to the plane. the plane at some point depending on the coordinate system Watt

  14. Texture Parameterization Texture Parameterization • Cylinder/ISN • Sphere/ISN – Distortions on – Small distortion horizontal planes everywhere. – Draw vector from – Draw vector from point to cylinder sphere center through point on the surface – Vector connects point and intersect it with the to cylinder axis sphere. Watt Watt Texture Parameterization Texture Parameterization • What is this ISN? • Flip direction of vector such that it – Intermediate surface points in the same normal. – Needed to handle half-space as the concave objects outward surface properly. normal. – Sudden flip in texture coordinates when the object crosses the axis.

  15. Triangle Mapping Triangle Mapping • Given: a triangle with texture coordinates at • Given: a triangle with texture coordinates at each vertex. each vertex. • Find the texture coordinates at each point • Find the texture coordinates at each point within the triangle. within the triangle. U=1,v=1 U=0,v=1 U=0,v=0 U=1,v=0 U=0,v=0 U=1,v=0 Triangle Mapping Triangle Interpolation • Triangles define linear mappings. • The equation: f(x,y) = A x +B y +C defines a linear function in 2D. • u(x,y,z) = Ax + By + Cz + D • Knowing the values of f() at three • v(x,y,z) = Ex + Fy + Gz + H locations gives us • Plug in the each point and corresponding enough information texture coordinate. to solve for A, B • Three equations and three unknowns and C. • Need to handle special cases: u==u(x,y) or • Provided the triangle v==v(x), etc. lies in the xy-plane.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend