Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics
- Texturing & Procedural Methods -
Computer Graphics - Texturing & Procedural Methods - Hendrik - - PowerPoint PPT Presentation
Computer Graphics - Texturing & Procedural Methods - Hendrik Lensch Computer Graphics WS07/08 Texturing & Procedural Methods Overview Last time Shading Texturing Today Texturing (Cont.) Procedural textures
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Shading – Texturing
– Texturing (Cont.) – Procedural textures – Fractal landscapes
– Texture Filtering – Alias & signal processing
Computer Graphics WS07/08 – Texturing & Procedural Methods
Texture-Surface Transformation Viewing/Projection Transformation The texture is mapped onto a surface in 3-D object space, which is then mapped to the screen by the viewing projection. These two mappings are composed to find the overall 2-D texture space to 2-D image space mapping, and the intermediate 3-D space is often
image warping and geometric distortion. Texture space (u,v) Object space (xo,yo,zo) Screen space (x,y)
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– ray hits surface – surface location corresponds to coordinate inside a texture
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Object surface parameterization – Projective transformation
– Find corresponding pre-image/footprint of each pixel in texture – Integrate over pre-image
Computer Graphics WS07/08 – Texturing & Procedural Methods
– The texture-to-screen mapping is difficult to invert – The texture image does not fit into memory
Texture scanning: for v for u compute x(u,v) and y(u,v) copy TEX[u,v] to SCR[x,y]
(or in general
rasterize image of TEX[u,v])
Computer Graphics WS07/08 – Texturing & Procedural Methods
Parameterization
– Sphere: spherical coordinates (ϕ, θ) = (2π u, π v) – Cylinder: cylindrical coordinates (ϕ, z) = (2 π u, H v) – Parametric surfaces (such as B-spline or Bezier surfaces later)
– Polygons, implicit surfaces, …
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Has implicit parameterization (e.g. barycentric coordinates) – But we need more control: Placement of triangle in texture space
– In homogeneous coordinates (by embedding (u,v) as (u',v',1)) – Transformation coefficients determined by 3 pairs (u,v)→(x,y)
( ) ( ) ( ) ( )
w v' w, v' = v u, w y' w, x' = y x, q v' u' i h g f e d c b a = w y' x' / / / / ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Rasterization
– Ray tracing
⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ = ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ q v' u' i h g f e d c b a w y' x' ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ − − − − − − − − − = ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ = ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ w y' x' bd ae ah bg eg dh af cd cg ai di fg ce bf bi ch fh ei q v' u' w y' x' I H G F E D C B A q v' u'
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Mapping from 2D texture space to a simple 3D intermediate surface (S mapping)
– Mapping from the intermediate surface to the destination object surface (O mapping)
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Reflected view ray
environment mapping
– Normal mapping – Line through
– Shrinkwrapping
from intermediate surface
Computer Graphics WS07/08 – Texturing & Procedural Methods
– May introduce undesired texture distortions if the intermediate surface differs too much from the destination surface – Still often used in practice because of its simplicity
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Strong distortion where object surface normal ⊥ plane normal
– Reasonably uniform mapping (symmetry !)
– Problems with concave regions
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Slide projector
– View-dependent texturing
RenderMan Companion
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Surface curvature: beam tracing – Map filtering
– Intermediate surface in 2-stage mapping – Often cube, sphere, or double paraboloid
– Parallax-free illumination – No self-reflections, distortion of near objects
– Often necessary to be reasonable accurate – Reflections of other objects – Maps must be recomputed after changes
Computer Graphics WS07/08 – Texturing & Procedural Methods
– i.e. photo of a reflecting sphere (gazing ball)
Peter Chou
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Single image – Bad utilization of the image area – Bad scanning on the edge – Artifacts, if map and image do not have the same direction
– Subdivide in 2 images (facing and back facing side) – Less bias on the edge – Arbitrarily reusable – Supported by OpenGL extensions
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Enclose object in cube – Images on faces are easy to compute – Poorer filtering at edges – Support in OpenGL
Computer Graphics WS07/08 – Texturing & Procedural Methods
Terminator II motion picture
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Two maps: diffuse & specular – Diffuse: index by surface normal – Specular: indexed by reflected view vector
RenderMan Companion
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Pre-calculated illumination (local irradiance)
– Multiplication of irradiance with base texture
– Provides surface radiosity
– Animated light maps
Reflectance Irradiance Radiosity
texture mesh
Representing radiosity in a mesh or texture
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Surface normals changed only
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Surface normals are known
– Surface is offset in normal direction according to bump map intensity – New normal directions N’(u,v) are calculated based on virtually displaced surface O’(u,v) – Originals surface is rendered with new normals N’(u,v)
Grey-valued texture used for bump height
Computer Graphics WS07/08 – Texturing & Procedural Methods
N’=N+D
Computer Graphics WS07/08 – Texturing & Procedural Methods
David Ebert
Computer Graphics WS07/08 – Texturing & Procedural Methods
RenderMan Companion
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Combination of multiple textures
RenderMan Companion
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Often with transparency texture
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Simple acquisition – Illumination „frozen“ during acquisition – Limited resolution, aliasing – High memory requirements – Mapping issues
– Non-trivial programming – Flexibility & parametric control – Unlimited resolution – Anti-aliasing possible – Low memory requirements – Low-cost visual complexity – Can adapt to arbitrary geometry
Ken Perlin
Computer Graphics WS07/08 – Texturing & Procedural Methods
– world space, texture coordinates, ...
– Ray tracing: At intersection point with surface
– Similarity between patches at different locations
– Similarity on different resolution scales
– But never completely identical
– Mimics statistical properties of natural textures – Purely empirical approach
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Statistical invariance under rotation – Statistical invariance under translation – Roughly one specific frequency
– Value noise: Random number at lattice
– Gradient lattice noise
– Fixed fundamental frequency of ~1 Hz over lattice
– Tri-linear interpolation – Cubic interpolation (Hermite spline → later)
– http://www.cs.cmu.edu/~mzucker/code/perlin-noise-math-faq.html
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– “White” frequency spectrum
– Decreasing power spectrum towards high frequencies
– Turbulence(x) = ∑k
i=0 abs(noise(2i x) / pi )
– persistence p typically p=2 – Summation truncation
– 1. Term: noise(x) – 2. Term: noise(2x)/2 – … – Power spectrum: 1/f – (Brownian motion has 1/f2)
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
Computer Graphics WS07/08 – Texturing & Procedural Methods
– fmarble(x,y,z) :=marble_color(sin(x)) – marble_color : transfer function (see lower left)
– fmarble(x,y,z) :=marble_color(sin(x+turbulence(x,y,z)))
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Turbulated sawtooth function – Bump mapping
– White blobs – Turbulated transparency along edge – Transparency mapping
– Vary procedural texture function’s parameters over time
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Can be difficult to ray trace !!
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Vertex insertion at edge-midpoints
– Random displacement along normal – Scale of perturbation depends on subdivision level
– Level of detail (LOD) determined by # subdivisions
– LOD generated locally when/where needed (bounding box test) – Minimal I/O cost (coarse mesh only)
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Insert new vertices at edge midpoints – 1:4 triangle subdivision
– Along original triangle normal
Courtesy http://www.uni-paderborn.de/SFB376/projects/a2/zBufferMerging/
Computer Graphics WS07/08 – Texturing & Procedural Methods
vertex displacement
Courtesy http://www.uwp.edu/academic/computer.science/morris.csci/CS.320/Week.11/Ch11b.www/Ch11b.html
Computer Graphics WS07/08 – Texturing & Procedural Methods
– Triangle mesh not a-priori known
– Maximum possible bounding box around each triangle – Decreasing displacement amplitude: finite bounding box
– Intersect ray with bounding box – Subdivide corresponding triangle – Compute bounding boxes of 4 new triangles – Test against 4 new bounding boxes – Iterate until termination criterion fulfilled (LOD / pixel size)