Texture Mapping Outline Texture Mapping Texture Mapping

Texture Mapping Outline Texture Mapping Texture Mapping

Texture Mapping Outline • 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 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 take into consideration. How many times has the object – How does the image map to the vertices or set 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 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? 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? • How would I rotate an image 45 degrees? • Given the (u,v), want: • How would I translate it 0.5 pixels? – F(u,v) ==> a continuous reconstruction • = { 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) } • = ... What is the source of your Texture? Procedural Texture • Procedural Image Periodic and everything else • RGB Image Checkerboard • Intensity image Scale: s= 10 • Opacity table If (u * s) % 2=0 && (v * s)%2=0 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 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 • More on this later. direction of the surface normal. Lao 1998 Lao 1998 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 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 • Samples the warped texture at the – May miss parts of the texture map appropriate image pixels. Image Texture • 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. Texture Image • forward mapping Continuous functions F(u,v) How do we get F(u,v)? • We are given a discrete set of values: • Higher-order interpolation – F[i,j] for i=0,…,N, j=0,…,M – F(u,v) = ∑ i∑j F[i,j] h(u,v) • Nearest neighbor: – h(u,v) is called the reconstruction kernel – F(u,v) = F[ round(N*u), round(M*v) ] • Guassian • 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 Texture Parameterization Texture Parameterization • Mapping to a Cylinder • Mapping to Sphere – Rotate, translate and scale in the uv-plane – Impossible!!!! – u -> theta – Severe distortion at the poles – v -> z – u -> theta – 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 Texture Parameterization Example (Rogers) Part of a sphere x(θ,φ) = sin θ sin φ 0 ≤θ≤π/2 y(θ,φ) = cos φ • Mapping to a Sphere π/4 ≤φ≤π/2 z(θ,φ) = cos θ sin φ (u,v) = (0,0) ⇔ (θ,φ) = (0, π/2) (u,v) = (1,0) ⇔ (θ,φ) = (π/2, π/2) v (u,v) = (0,1) ⇔ (θ,φ) = (0, π/4) (u,v) = (1,1) ⇔ (θ,φ) = (π/2, π/4) • Setup up surface, define correspondence, and voila! u 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 θ π −φ u(θ ,φ) = v(θ ,φ) = 2 π π 2 4 So looks like we have the texture space ⇔ object space part done! Started with squares and ended with curves / 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 v – Box common seam • Map object to same. u 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 (u,v) (xi,yi)(xo,yo,zo) θ −θ z − z s = A t = A Texture space Intermediate space Object space θ B −θ A zB − z 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 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 perpendicular to the – The vector will intersect plane. the plane at some point depending on the coordinate system Watt 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 – Vector connects point point on the surface to cylinder axis and intersect it with the sphere. Watt Watt Texture Parameterization Texture Parameterization • What is this ISN? • Flip direction of – Intermediate surface vector such that it normal. points in the same – Needed to handle half-space as the concave objects outward surface properly. normal. – Sudden flip in texture coordinates when the object crosses the axis. 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) = Ax+By+C defines a linear • u(x,y,z) = Ax + By + Cz + D function in 2D. • v(x,y,z) = Ex + Fy + Gz + H • Knowing the values of f() at three 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. Triangle Interpolation Triangle Interpolation • We need to find two 3D functions: u(x,y,z) • A linear function in 3D is defined as and v(x,y,z). – f(x,y,z) = Ax + By + Cz + D • However, there is a relationship between x, • Note, four points uniquely determine this y and z, so they are not independent. equation, hence a tetrahedron has a unique • The plane equation of the triangle yields: linear function through it.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us