texture mapping -...

121
© Machiraju/Zhang/Möller 1 © Machiraju/Zhang/Möller Texture Mapping Introduction to Computer Graphics Torsten Möller

Upload: others

Post on 13-Sep-2019

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 1© Machiraju/Zhang/Möller

Texture Mapping

Introduction to Computer Graphics

Torsten Möller

Page 2: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 2© Machiraju/Zhang/Möller

Reading

Angel - Chapter 7.4-7.10, 9.9 and 11.8

Hughes, van Dam: Chapter 20 (+17)

Shirley+Marshner: Chapter 11

Page 3: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 3© Machiraju/Zhang/Möller

Overview

What is texture mapping / what types of mappings do we have?

Two-pass mapping Texture transformations Billboards, bump, environment,

chrome, light, and normal maps 3D texture mapping / volume

rendering Hypertextures

Page 4: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 4© Machiraju/Zhang/Möller

Texture Mapping

(sophisticated) illumination models gave us “realistic” (physics-based)

looking surfaces not easy to model mathematically and computationally

challenging Phong illumination/shading

easy to model relatively quick to compute only gives us dull surfaces

Page 5: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 5© Machiraju/Zhang/Möller

Texture Mapping (2)

surfaces “in the wild” are very complex

cannot model all the fine variations we need to find ways to add

surface detail How?

Page 6: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 6© Machiraju/Zhang/Möller

Texture Mapping (3)

solution - (it’s really a cheat!!)

How?

Map surface detail from a predefined (easy to model) table (“texture”) to a simple polygon

Page 7: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 7© Machiraju/Zhang/Möller

Texture Mapping (4)

Problem #1 Fitting a square peg in a round hole we deal with non-linear transformations which parts map where?

Page 8: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 8© Machiraju/Zhang/Möller

Texture Mapping (5)

Problem #2 Mapping from a pixel

to a “texel” aliasing is a huge problem!

Page 9: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 9© Machiraju/Zhang/Möller

What is an image?

How can I find an appropriate value for an arbitrary (not necessarily integer) index? How would I rotate an image 45

degrees? How would I translate it 0.5 pixels?

Page 10: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 10© Machiraju/Zhang/Möller

What is a texture?

Given the (texture/image index) (u,v), want: 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) } = ...

Page 11: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 11© Machiraju/Zhang/Möller

What is a texture? (2)

Color specular ‘color’ (environment map) normal vector perturbation (bump

map) displacement mapping transparency ...

Page 12: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 12© Machiraju/Zhang/Möller

RGB Textures

Places an image on the object “typical” texture mapping

Page 13: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 13© Machiraju/Zhang/Möller

Dependent Textures

Perform table look-ups after the texture samples have been computed.

http://geomorph.sourceforge.net/

Page 14: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 14© Machiraju/Zhang/Möller

Intensity Modulation Textures

Multiply the objects color by that of the texture.

Page 15: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 15© Machiraju/Zhang/Möller

Opacity Textures

A binary mask, really redefinesthe geometry.

Page 16: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 16© Machiraju/Zhang/Möller

Bump Mapping This modifies the surface normals.

http://www.siggraph.org/education/materials/HyperGraph/hypergraph.htm

Page 17: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 17© Machiraju/Zhang/Möller

Displacement Mapping

Modifies the surface position in the direction of the surface normal.

http://www.chromesphere.com/Tutorials/Vue6/Optics-Basic.html

Page 18: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 18© Machiraju/Zhang/Möller

Reflection Properties

Kd, Ks BRDF’s

Brushed Aluminum Tweed Non-isotropic or anisotropic surface

micro facets.

Page 19: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 19© Machiraju/Zhang/Möller

Two-pass Mapping

Idea by Bier and Sloan S: map from texture space to

intermediate space O: map from intermediate space to

object space

Page 20: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 20© Machiraju/Zhang/Möller

Two-pass Mapping (2)

Map texture to intermediate surface (S map): Plane Cylinder Sphere Box

Map object to same(O map).

u

v

u-axis

Page 21: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 21© Machiraju/Zhang/Möller

S map

Mapping to a 3D Plane Simple Affine transformation

rotate scale translate

z

y

x

v

u

Page 22: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 22© Machiraju/Zhang/Möller

S map (2)

Mapping to a Cylinder Rotate, translate and scale in the uv-

plane u -> θ v -> z x = r cos(θ), y = r sin(θ)

v

u

Page 23: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 23© Machiraju/Zhang/Möller

S map (3)

Mapping to Sphere Impossible!!!! Severe distortion at the poles u -> θ v -> φ x = r sin(θ) cos(φ) y = r sin(θ) sin(φ) z = r cos(θ)

Page 24: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 24© Machiraju/Zhang/Möller

S map (4)

Mapping to a Cube

u

vcommon seam

Page 25: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 25

S map (5) Mapping to a Cube

Page 26: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 26© Machiraju/Zhang/Möller

O map

O mapping: reflected ray (environment map) object normal object centroid intermediate surface normal (ISN)

that makes 16 combinations only 5 were found useful

Page 27: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 27© Machiraju/Zhang/Möller

O map (2)

Cylinder/ISN (shrinkwrap) Works well for solids of revolution

Plane/ISN (projector) Works well for planar objects

Box/ISN Sphere/Centroid Box/Centroid

Works well for roughlyspherical shapes

Page 28: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 28© Machiraju/Zhang/Möller

O map (3)

Plane/ISN Resembles a slide

projector Distortions on

surfaces perpendicular to the plane.

Page 29: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 29© Machiraju/Zhang/Möller

O map (4)

Cylinder/ISN Distortions on

horizontal planes

Page 30: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 30© Machiraju/Zhang/Möller

O map (5)

Sphere/ISN Small distortion

everywhere.

Page 31: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller© Machiraju/Zhang/Möller

In Practice: Texture Atlas

3D models are manually unwrapped onto texture maps by artists, e.g. in games Then they paint textures into the partial mappings

https://www.deviantart.com/mrninjutsu/art/Hand-painted-Acorn-268825230

Page 32: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 32© Machiraju/Zhang/Möller

Texture Mapping - Practice I

A lot of interaction is required to “get it right” - modeler needs patience

with other words - modeling tools are not that good yet

can’t really get distortion-free maps can’t get size-preserving maps (there

are some approaches) what else do we care about under the

topic “practical”?

Page 33: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 33© Machiraju/Zhang/Möller

Texture Mapping - Practice II we need real-time performance

“pre”-compute map of vertices (in the modeling package; store these with the mesh data)

quickly find an inverse mapping between internal points of polygon and texels

hardware support we need high quality (anti-aliasing)

convolve with anti-aliasing filter “pre”-compute blurred (scaled-down) version “pre”-compute high-res (magnified) version hardware support

Page 34: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 34© Machiraju/Zhang/Möller(c) Pascal Vuylsteker

Page 35: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 35© Machiraju/Zhang/Möller

Image space scan

For each y For each x

compute u(x,y) and v(x,y) copy texture(u,v) to image(x,y)

Samples the warped texture at the appropriate image pixels.

inverse mapping

Page 36: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 36© Machiraju/Zhang/Möller

Image space scan (2) Problems:

Finding the inverse mapping Use one of the analytical mappings Bi-linear or triangle inverse mapping

May miss parts of the texture map

(c) Pascal Vuylsteker

Page 37: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 37© Machiraju/Zhang/Möller

Texture space scan

For each v For each u

compute x(u,v) and y(u,v) copy texture(u,v) to image(x,y)

Places each texture sample on the mapped image pixel.

Forward mapping

Page 38: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 38© Machiraju/Zhang/Möller

Texture space scan (2)

Problems: May not fill image Forward mapping

needed

(c) Laurent Saboret, Pierre Alliez and Bruno Lévy

Page 39: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 39© Machiraju/Zhang/Möller

Texture Mapping - Real-Time

Given: list of vertices Need: a 1-to-1 correspondence

between pixels of the screen projection of the polygon to the texels in the texture

3 main approaches: triangle mapping projective transformation (inverse) bilinear mapping

Page 40: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 40© Machiraju/Zhang/Möller

Triangle Interpolation

The equation: f(x,y) = Ax+By+C defines a linear function in 2D.

Knowing the values of f() at threelocations gives usenough informationto solve for A, B,and C.

We do this for bothcomponents u(x,y) as wellas for v(x, y)

Page 41: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 41© Machiraju/Zhang/Möller

Triangle Interpolation (2) Ok for orthogonal projections, but

not for the general case Need to take care of perspective

case We need to find two 3D functions:

u(x,y,z) and v(x,y,z).

Page 42: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 42© Machiraju/Zhang/Möller

Triangle Interpolation (3)

Page 43: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 43© Machiraju/Zhang/Möller

Triangle Interpolation (4)

Page 44: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 44© Machiraju/Zhang/Möller

Inverse Bilinear Interpolation

Page 45: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 45© Machiraju/Zhang/Möller

Inverse Bilinear Interpolation

Given: (x0,y0,u0,v0) (x1,y1,u1,v1) (x2,y2,u2,v2) (x3,y3,u3,v3) (xs,ys,zs) - The screen coords. w/depth Projective mapping T

Calculate (xt,yt,zt) from T-1*(xs,ys,zs)

Page 46: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 46© Machiraju/Zhang/Möller

Inverse Bilinear Interpolation (2)Barycentric Coordinates:

x(s,t) = x0(1-s)(1-t) + x1(s)(1-t) + x2(s)(t) + x3(1-s)(t) = xt

y(s,t) = y0(1-s)(1-t) + y1(s)(1-t) + y2(s)(t) + y3(1-s)(t) = yt

z(s,t) = z0(1-s)(1-t) + z1(s)(1-t) + z2(s)(t) + z3(1-s)(t) = zt

u(s,t) = u0(1-s)(1-t) + u1(s)(1-t) + u2(s)(t) + u3(1-s)(t)

v(s,t) = v0(1-s)(1-t) + v1(s)(1-t) + v2(s)(t) + v3(1-s)(t)

Solve for s and t using two of the first three equations.

This leads to a quadratic equation, where we want the root between zero and one.

Page 47: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 47© Machiraju/Zhang/Möller

Inverse Bilinear Mapping (3)

preserves lines that are horizontal / vertical in the source space

preserves equi-spaced points along such lines

does NOT preserve diagonal lines inverse mapping is NOT bilinear!

Page 48: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 48© Machiraju/Zhang/Möller

Inverse Bilinear Mapping (4)

Page 49: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 49© Machiraju/Zhang/Möller

Projective Transformation We actually map a square to a square we know there was a perspective

distortion - let’s set up a general model:

u

v

x

y

z

ys

P0

P1

P2

P3

xs

Page 50: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 50

i can be set to one 8 equations, 8 unknowns!! Another way to look at it:

© Machiraju/Zhang/Möller

Projective Transformation (2)

Page 51: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 51

does NOT preserve equidistant points preserve lines in all orientations concatenation is projective again inverse mapping is a projective

mapping too

© Machiraju/Zhang/Möller

Projective Transformation (3)

Page 52: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 52© Machiraju/Zhang/Möller

Projective Transformation (4)

Page 53: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 53© Machiraju/Zhang/Möller

Quality Considerations

So far we just mapped one point results in bad aliasing (resampling

problems) we really need to inte-

grate over polygon super-sampling is not such a good

solution (slow!) most popular - mipmaps

Page 54: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 54© Machiraju/Zhang/Möller

Quality Considerations

Pixel area maps to “weird” (warped) shape in texture space

hence we need to: approximate this area convolve with a wide filter around the

center of this area

Page 55: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 55© Machiraju/Zhang/Möller

Quality Considerations

Page 56: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 56© Machiraju/Zhang/Möller

Quality considerations

the area is typically approximated by a rectangular region (found to be good enough for most applications)

filter is typically a box/averaging filter - other possibilities

how can we pre-compute this?

Page 57: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 57© Machiraju/Zhang/Möller

Antialiasing and Filters

Nearest neighbor(+=sampling positions)

Box filter Gaussian filter

https://de.m.wikipedia.org/wiki/Rekonstruktionsfilter

Page 58: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 58© Machiraju/Zhang/Möller

How do we get F(u,v)?

We are given a discrete set of values: F[i,j] for i=0,…,N, j=0,…,M

Nearest neighbor: F(u,v) = F[ round(N*u), round(M*v) ]

Linear Interpolation: i = floor(N*u), j = floor(M*v) interpolate from

F[i,j], F[i+1,j], F[i,j+1], F[i+1,j+1]

Page 59: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 59© Machiraju/Zhang/Möller

How do we get F(u,v)? (2)

Higher-order interpolation F(u,v) = ∑i∑j F[i,j] h(u,v) h(u,v) is called the reconstruction

kernel Gaussian Sinc function splines

Like linear interpolation, need to find neighbors. Usually four to sixteen

Page 60: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 60© Machiraju/Zhang/Möller

Quality considerations - MipMap

Downsample texture beforehand store down-sampled version as well find the right level of detail assumes symmetric square image

region (power of 2) problem - upsample?! (high-res)

Page 61: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 61© Machiraju/Zhang/Möller

Quality considerations - MipMap

Page 62: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 62© Machiraju/Zhang/Möller

Quality considerations - MipMap

Page 63: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 63© Machiraju/Zhang/Möller

Texture Mapping

Technicalities of the actual mapping (correspond polygon points with entries in a discrete table) are kind of “solved”

next question - what are we going to do with those values?

Typical - just use them as our color values (RGB)

other methods ...

Page 64: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 64© Machiraju/Zhang/Möller

Billboards

It’s a simple plane that rotates with the viewer and is always perpendicular to him/her

only works forcylindrical objects

often used for trees combination of

color/opacity map

Page 65: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 65© Machiraju/Zhang/Möller

Bump Mapping “real” texture - Many textures are

the result of small perturbations in the surface geometry

Modeling these changes would result in an explosion in the number of geometric primitives.

Bump mapping attempts to alter the lighting across a polygon to provide the illusion of texture.

Page 66: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 66© Machiraju/Zhang/Möller

Bump Mapping (2)

Consider the lighting for a modeled surface.

Page 67: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 67© Machiraju/Zhang/Möller

Bump Mapping (3)

We can model this as deviations from some base surface.

The questionis then how these deviations change the lighting.

N

Page 68: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 68© Machiraju/Zhang/Möller

Bump Mapping (4)

Assumption: small deviations in the normal direction to the surface.

Where B is defined as a 2D function parameterized over the surface:

B = f(u,v)

X = X + B N

Page 69: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 69© Machiraju/Zhang/Möller

Bump Mapping (5)

Step 1: Putting everything into the same coordinate frame as B(u,v). x(u,v), y(u,v), z(u,v) – this is given for

parametric surfaces, but easy to derive for other analytical surfaces.

Or O(u,v) = [x(u,v), y(u,v), z(u,v)]T

Page 70: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 70© Machiraju/Zhang/Möller

Bump Mapping (6)

Define the tangent plane to the surface at a point (u,v) by using the two vectors Ou and Ov.

The normal is then given by: N = Ou × Ov

N

Ou

Ov

Page 71: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 71© Machiraju/Zhang/Möller

Bump Mapping (7)

The new surface positions are then given by:

• O’(u,v) = O(u,v) + B(u,v) N• Where, N = N / |N|

Differentiating leads to:• O’u = Ou + Bu N + B (N)u ≈ Ou + Bu N

• O’v = Ov + Bv N + B (N)v ≈ Ov + Bv N

If B is small.

Page 72: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 72© Machiraju/Zhang/Möller

Bump Mapping (8)

This leads to a new normal:• N’(u,v) = Ou × Ov + Bu(N × Ov) - Bv(N × Ou)

+ Bu Bv(N × N)

= N + Bu(N × Ov) - Bv(N × Ou)

= N + D

ND

N’

Ou

Ov

Page 73: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 73© Machiraju/Zhang/Möller

Bump Mapping (9)

For efficiency, can store Bu and Bv in a 2-component texture map.

The cross products are geometry terms only.

N’ needs to be normalized after the calculation and before lighting. This floating point square root and

division makes it difficult to embed into hardware.

Page 74: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 74© Machiraju/Zhang/Möller

Bump Mapping (10)

Procedurally bump mapped object

Page 75: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 75© Machiraju/Zhang/Möller

Bump Mapping (11)

bump mapped based on a simple image cylindrical texture space used

Page 76: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 76© Machiraju/Zhang/Möller

Bump Mapping (12) Bump mapping is often combined with

texture mapping. Here a bump map has been used to (apparently) perturb the surface and a coincident texture map to colour the 'bump objects'.

Page 77: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 77© Machiraju/Zhang/Möller

Bump Mapping (13) bump mapping and texture mapping

on text

Page 78: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 78© Machiraju/Zhang/Möller

Normal Map

Pre-computation of modified normal vector N‘

Stored in texture (RGB)=(Nx, Ny, Nz) Illumination computation per pixel

For example in fragment program Per-vertex light vector (toward light

source) is interpolated

Page 79: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 79© Machiraju/Zhang/Möller

Normal Map cont.

Color

Height

Normal Normal - z

Gra

dien

t

Normal - x Normal - y

Page 80: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 80© Machiraju/Zhang/Möller

3D Textures Representation on 3D

domain Often used for volume

representation and rendering Texture = uniform grid

Page 81: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 81© Machiraju/Zhang/Möller

Environment Mapping

Used to show the reflected colors in shiny objects.

Page 82: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 82© Machiraju/Zhang/Möller

Environment Mapping (2)

Create six views from the shiny object’s centroid.

When scan-converting the object, index into the appropriate view and pixel.

Use reflection vector to index. Largest component of reflection

vector will determine the face.

Page 83: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 83© Machiraju/Zhang/Möller

Environment Mapping (3)

Problems: Reflection is about object’s centroid. Okay for small objects and distant

reflections. N

N

Page 84: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 84© Machiraju/Zhang/Möller

Environment Mapping (4)

Problems! – which one is ray-traced?

Page 85: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 85© Machiraju/Zhang/Möller

Environment Mapping (5)

Page 86: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 86© Machiraju/Zhang/Möller

Chrome Mapping

Cheap environment mapping Material is very glossy, hence

perfect reflections are not seen. Index into a pre-computed view

independent texture. Reflection vectors are still view

dependent.

Page 87: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 87© Machiraju/Zhang/Möller

Chrome Mapping (2)

Usually, we set it to a very blurred landscape image. Brown or green on the bottom White and blue on the top. Normals facing up have a white/blue

color Normals facing down on average have

a brownish color.

Page 88: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 88© Machiraju/Zhang/Möller

Chrome Mapping (3)

Also useful for things like fire. The major point is that it is not

important what actually is shown in the reflection, only that it is view dependent.

Page 89: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 89© Machiraju/Zhang/Möller

Light Maps

Precompute the light in the scene typically works only for view-

independent light (diffuse light) combine (texture-map) these light

maps onto the polygon

Page 90: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 90© Machiraju/Zhang/Möller

Light Map

ReflectanceQuake2 light map

Combination: Structural texture Light texture

Light maps for diffuse reflection Only Luminance channel Low resolution is sufficient Packing in “large” 2D texture

Irradiance Radiosity

Page 91: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 91© Machiraju/Zhang/Möller

Light Map cont.

Combination with textured scene

Page 92: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 92© Machiraju/Zhang/Möller

Light Map cont.

Example: moving spot light

Page 93: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 93© Machiraju/Zhang/Möller

Our aim today

What is texture mapping / what types of mappings do we have?

Two-pass mapping Texture transformations

real-time vs. quality Billboards, bump, environment,

chrome, light, and normal maps 3D texture mapping / volume

rendering Hypertextures

Page 94: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 94© Machiraju/Zhang/Möller

Participating Media

Page 95: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 95© Machiraju/Zhang/Möller

Participating Media

Page 96: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 96© Machiraju/Zhang/Möller

Participating Media

Page 97: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 97© Machiraju/Zhang/Möller

Direct Volume Rendering

Emission-absorption model (Ch. 9 of PBRT book) No scattering

Ray casting (ray marching without scattering) Image-space approach

Possible on modern GPUs Fragment loop for traversal along ray Data stored in 3D texture, accessed by 3D

texture lookup

Integration segment(along eye ray)

Page 98: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 98© Machiraju/Zhang/Möller

Direct Volume Rendering: Texture Slicing

Data stored in 3D texture Object space approach with slices (= proxy

geometry) Fast method that does not need programmable

GPUsSlices parallel to

image planeTextured

slicesFinal

image

Texturing(trilinear interpolation)

Compositing(alpha blending)

Page 99: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 99© Machiraju/Zhang/Möller

Solid Textures

Problems of 2D textures Only on surface (no internal, volumetric structure) Substantial texture deformation for strongly curved

surfaces Texture coordinates difficult for complex objects /

topology

Solid textures 3D textures for surface objects Cut a curved surface out of a volumetric texture block Example: wood, marble

Disadvantages Large memory consumption

Page 100: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 100© Machiraju/Zhang/Möller

Procedural Textures

3D textures based on noise and mathematical modeling

analogous to sculpting or carving

Page 101: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 101© Machiraju/Zhang/Möller

Solid Textures: Examples

Page 102: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 102© Machiraju/Zhang/Möller

Our aim today

What is texture mapping / what types of mappings do we have?

Two-pass mapping Texture transformations

real-time vs. quality Billboards, bump, environment,

chrome, light, and normal maps 3D texture mapping / volume

rendering Hypertextures

Page 103: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 103© Machiraju/Zhang/Möller

Noise and Turbulence

How to model texture for natural phenomena? Physical simulation: time-consuming Instead: stochastic modeling by noise

2D and 3D textures Compact description of phenomena

Typically only a few parameters

Page 104: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 104© Machiraju/Zhang/Möller

Noise

Natural objects are subject to stochastic variations On different length scales With spatial coherence

Goal: stochastic structures, not just white noise

Requirements: Spatial correlation (important for changing

viewpoint) Reproducibility Controlled frequency behavior Band-limited (to avoid aliasing) No (visible) periodicity Rotation and translation invariant Restricted range of values (for mapping to

colors, etc.)

Page 105: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 105© Machiraju/Zhang/Möller

Noise cont.

Basis for stochastic modeling: noise function according to Perlin[Ken Perlin, An image synthesizer, Computer Graphics (ACM SIGGRAPH 85), (3)19:287-296, 1985]

Starting point: white noise (pseudo random numbers)

Two kinds of Perlin noise: Lattice value noise Gradient noise

Page 106: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 106© Machiraju/Zhang/Möller

Perlin Lattice Value Noise

Random number on lattice In-between: interpolation (higher-order)

Leads to spatial correlation Band-limited

Length scale is important Actual implementation:

1D lattice with random numbersand hash function

Index(ix,iy,iz) = Permut(ix + Permut(iy + Permut(iz)))

Avoids repeating patterns

Page 107: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 107© Machiraju/Zhang/Möller

Perlin Lattice Value Noise cont.

Smooth across small intervals

0 7.5 15 22.5 30

-1.00

-0.50

0.00

0.50

1.00

0 1.25 2.5 3.75 5

-0.8

-0.4

0.0

0.4

0.8

25 points

5 points

Page 108: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 108© Machiraju/Zhang/Möller

Perlin Lattice Value Noise cont.

64x64 lattice10x10 lattice

Page 109: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 109© Machiraju/Zhang/Möller

Perlin Lattice Gradient Noise

Random gradients on lattice Normalized to unit length

Scalar product of gradients and distance vectors

Interpolation of scalar products (higher-order) Higher frequencies than lattice value noise

G(x0, y1)

G(x1, y0)

G(x1, y1)

Diff.

G(x0, y0)

Page 110: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 110© Machiraju/Zhang/Möller

Perlin Lattice Gradient Noise cont.

20x20 lattice10x10 lattice

Page 111: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 111© Machiraju/Zhang/Möller

Perlin Lattice Gradient Noise cont.

10x10 lattice noise10x10 lattice gradient noise

Page 112: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 112© Machiraju/Zhang/Möller

Application of Perlin Noise

• noise(frequency * x + offset)• noise(2 * x) generates

noise with doubled spatial frequencies

• Different offset leads to different noise of same characteristics

Page 113: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 113© Machiraju/Zhang/Möller

Turbulence

Spectral synthesis Combine noise of different frequencies:

turbulence(x) = åk 1/2k |noise(2kx)|

– Discontinuities in derivatives due to absolute value

– Alternative: åk 1/2k noise(2kx)

– Adding up details proportionalto size (self similarity, fractals)

– Frequency spectrum 1/f– 1/f fractal noise

Page 114: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 114© Machiraju/Zhang/Möller

Turbulence cont.

Spectral synthesis Example for

combination of different frequencies

Page 115: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 115© Machiraju/Zhang/Möller

Turbulence: Examples

Page 116: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 116© Machiraju/Zhang/Möller

Noise and Turbulence

Simple noise å 1/f noise()

Page 117: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 117© Machiraju/Zhang/Möller

Turbulence with Structures

å 1/f |noise()| sin(x + å 1/f |noise()|)

Page 118: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 118© Machiraju/Zhang/Möller

Natural Phenomena

Example: fireball Spatial / color variations

according to turbulence Also temporal variations

Page 119: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 119© Machiraju/Zhang/Möller

Hypertextures

Perlin[K. Perlin , E. M. Hoffert, Hypertexture. Proc. ACM SIGGRAPH 89, 253-262,

1989] Idea: mix between geometry and texture Extension of solid textures Volumetric description of densities Types of density functions:

Object density function (DF) Density modulation function (DMF): fuzzy boundaries

Hypertexture = apply DMFs to a DF repeatedly DMF often based on noise or turbulence Semi-transparent volume rendering

Page 120: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 120© Machiraju/Zhang/Möller

Hypertextures: Examples

Page 121: Texture Mapping - vda.univie.ac.atvda.univie.ac.at/Teaching/Graphics/18w/LectureNotes/12_texture_w18.pdf · Texture Mapping - Practice II we need real-time performance “pre”-compute

© Machiraju/Zhang/Möller 121© Machiraju/Zhang/Möller

Hypertextures: Examples cont.