3: textures 1. Quest for Visual Realism Need for fine details in - - PowerPoint PPT Presentation

3 textures 1 quest for visual realism
SMART_READER_LITE
LIVE PREVIEW

3: textures 1. Quest for Visual Realism Need for fine details in - - PowerPoint PPT Presentation

3: textures 1. Quest for Visual Realism Need for fine details in color variation! 1 Motivations 2. Limit the number of polygons Problem: Everything cannot be modeled at the scale of geometry! Micro-polygons would be needed! 2 Textures


slide-1
SLIDE 1

1

  • 1. Quest for Visual Realism

Need for fine details in color variation!

3: textures

slide-2
SLIDE 2

2

Motivations

  • 2. Limit the number of polygons

Micro-polygons would be needed! Problem: Everything cannot be modeled at the scale of geometry!

slide-3
SLIDE 3

3

Textures

Modeling changes of material

Enable the material attributes to vary inside a face – The local attribute will be used during rendering Examples of attributes: color, shininess, normals, transparency…

Still a single face, but several colors

slide-4
SLIDE 4

4

Textures

Modeling changes of material

Enable the material attributes to vary inside a face – The local attribute will be used during rendering Examples of attributes: color, shininess, normals, transparency… Typically:

diffuse ambiant specular

slide-5
SLIDE 5

5

Textures

Modeling changes of material

diffuse ambiant specular

https://www.marmoset.co/posts/pbr-texture-conversion/

slide-6
SLIDE 6

6

2D Textures: picture of attributes + mapping

  • Planar image I (u,v)

0,0 1,1 u v

slide-7
SLIDE 7

7

2D Textures: picture of attributes + mapping

  • Planar image I (u,v)+ mapping f: P(x,y,z) → (u,v)

0,0 1,1 u v

f

slide-8
SLIDE 8

8

2D Textures: picture of attributes + mapping

  • Planar image I (u,v)+ mapping f: P(x,y,z) → (u,v)

0,0 1,1 u v

f

depends on

  • bject, effect, etc...
slide-9
SLIDE 9

9

Mapping function: flat/planar mapping

f: (x,y,z) → [0,1] x [0,1]

  • Planar mapping: f (x,y,z) = ( x , y )

Rosalee Wolfe / siggraph.org

slide-10
SLIDE 10

10

Mapping function: projective mapping

Map the texture like with a slide projector Advantage

  • No need for texture coordinates!

Inc

  • One viewpoint
  • Distortions
  • Blending
slide-11
SLIDE 11

11

Mapping function: spherical mapping

f: (x,y,z) → [0,1] x [0,1]

  • Spherical mapping: f (θ,ψ) = ( θ/2π , (π/2 – ψ) / π/4 )

Rosalee Wolfe / siggraph.org

slide-12
SLIDE 12

12

Mapping function: cylindrical mapping

f: (x,y,z) → [0,1] x [0,1]

  • Cylindrical mapping: f (θ,z) = ( θ/2π , z )

Rosalee Wolfe / siggraph.org

slide-13
SLIDE 13

13

Mapping function: cube mapping

f: (x,y,z) → [0,1] x [0,1]

  • Cube mapping: depends on x,y,z signs

Rosalee Wolfe / siggraph.org

slide-14
SLIDE 14

14

Mapping function: parametric mapping

f: (x,y,z) → [0,1] x [0,1]

  • Parametric mapping: f (S(u,v)) = (u,v)

Rosalee Wolfe / siggraph.org

slide-15
SLIDE 15

15

Mapping function: uv mapping

f: (x,y,z) → [0,1] x [0,1]

  • UV mapping: define uv at each vertex and exploit rasterization

Rosalee Wolfe / siggraph.org

slide-16
SLIDE 16

16

2D Textures: picture of attributes + mapping

  • Planar image I (u,v) + mapping f: P(x,y,z) → (u,v)
  • Store: mesh point + normal + texture coordinates (u,v)
  • In a face, interpolate (u,v) using barycentric coords
slide-17
SLIDE 17

17

Aliasing problems

Brick wall picture mapped on one face At the front

  • The texture pixels can be seen

At the back

  • Many colors in the same pixel
  • The one at the center is picked!
slide-18
SLIDE 18

18

Aliasing problems

Solution 1: Pre-filtering

  • compute multiple samples per pixel
  • and average result

Advantage: “ground truth” Drawback: expensive!

slide-19
SLIDE 19

19

Aliasing problems

Solution 2: Pre-filtering

  • Pre-compute an “image pyramid” (mip-map) of the texture: down sampling
  • Pick the best texture resolution while rendering (rasterization phase)

256x256 128x128 64x64 32x32

Advantage: fast Drawback: incorrect filter

slide-20
SLIDE 20

mip-map sampling

  • Multiple options

– Nearest scale, nearest neighbor texel sampling – Nearest scale, bilinear texel sampling – Trilinear sampling

  • Trilinear sampling

– Find nearest two scales – Bilinear sampling in each scale – Linear interpolation of the result

20

https://cglearn.codelight.eu/pub/textures-and-sampling

Trilinear sampling

slide-21
SLIDE 21

Mip-mapping

  • Andrew Flavell has a nice (old) article on

mip-mapping

http://www.gamasutra.com/view/feature/131708/runtime_mipmap_filtering.php

21

Without mip-mapping With mip-mapping

slide-22
SLIDE 22

22

Aliasing problems

Solution 3: Post-filtering

  • screen-space anti-aliasing (SSAA)
  • multiple algorithms
  • more and more used

Advantage: fast, GPU friendly Drawback: cannot handle all types of artifacts

slide-23
SLIDE 23

23

Creating a texture

  • From real data

– colors/normals/coefs, – stored in 2D images

  • Proceduraly

– using a small program – usually on the GPU

slide-24
SLIDE 24

24

Creating a texture

  • From real data

– Paint a self similar texture – use torus topology for textures

f ?

slide-25
SLIDE 25

25

Creating a texture

  • From real data

– texture synthesis – analyse a small sample – generate a large similar texture

slide-26
SLIDE 26

26

Creating a texture

  • From real data

– re-shading problem

slide-27
SLIDE 27

27

Creating a texture

  • Proceduraly

– combination of simple functions

+ Easy to implement + Compact + Infinite resolution

  • Non-intuitive
  • Difficult to match existing textures
slide-28
SLIDE 28

28

Procedural textures

slide-29
SLIDE 29

29

Procedural cellular textures

  • Generate a bunch of random points
  • For each pixel

– Find the nearest distance to the nearest couple points – Use these values to determine a color

  • Voronoi-like
slide-30
SLIDE 30

30

Perlin textures

  • Requirements

– Pseudo random – Arbitrary dimension – Smooth – Band pass (one scale) – Little memory usage – Implicit evaluation

slide-31
SLIDE 31

31

Perlin textures

  • Distribute random values at particular locations (a grid)...
slide-32
SLIDE 32

32

Perlin textures

  • Distribute random values at particular locations (a grid)...
  • … and interpolate
slide-33
SLIDE 33

33

Perlin textures

  • At a given point:

r1 r2

slide-34
SLIDE 34

34

Perlin textures

  • At a given point:

– Get the associated 2 random values?

r1 r2

slide-35
SLIDE 35

35

Perlin textures

  • At a given point:

– Get the associated 2 random values?

  • Pseudo random function
  • Precomputed in an array

r1 r2

slide-36
SLIDE 36

36

Perlin textures

  • At a given point:

– Get the associated 2 random values?

  • Pseudo random function
  • Precomputed in an array

– Get relative position of x (between 0 and 1) – mix!

r1 r2

slide-37
SLIDE 37

37

Perlin textures

  • At a given point:

– Get the associated 2 random values?

  • Pseudo random function
  • Precomputed in an array

– Get relative position of x (between 0 and 1) – mix! S-Shaped function:

slide-38
SLIDE 38

38

Perlin textures

  • At a given point:

– Get the associated 2 random values?

  • Pseudo random function
  • Precomputed in an array

– Get relative position of x (between 0 and 1) – mix!

slide-39
SLIDE 39

39

Perlin textures

  • At a given point:

– Get the associated 2 random values?

  • Pseudo random function
  • Precomputed in an array

– Get relative position of x (between 0 and 1) – mix!

slide-40
SLIDE 40

40

Perlin textures

  • Controls

– Frequency: evalNoise( x * freq )

slide-41
SLIDE 41

41

Perlin textures

  • Controls

– Frequency: evalNoise( x * freq )

– Amplitude: evalNoise( x ) * amplitude

slide-42
SLIDE 42

42

Perlin textures

  • Controls

– Frequency: evalNoise( x * freq )

– Amplitude: evalNoise( x ) * amplitude – Offsetting: evalNoise( x + offset )

slide-43
SLIDE 43

43

Perlin textures

  • In 2D

– needs a 2D grid – requires 3 interpolations instead of 1

demo: https://www.shadertoy.com/view/lsf3WH

slide-44
SLIDE 44

44

Perlin textures

  • In 3D

– same principle, with a 3D grid – requires 7 interpolations

demo: https://www.shadertoy.com/view/XsXfRH

slide-45
SLIDE 45

45

Fractal Perlin textures

  • Noise at one scale = 1 octave
  • Multiple octave usually used

– Frequency multiplied by 2 each time – Hence the name octave – Different amplitudes too

  • Sum of all noises =

– Fractal noise

slide-46
SLIDE 46

46

Fractal Perlin textures

  • Compute the ith texture using:

(relation between frequency and amplitude)

slide-47
SLIDE 47

47

Fractal Perlin textures

slide-48
SLIDE 48

48

Fractal Perlin textures

slide-49
SLIDE 49

49

Fractal Perlin textures

  • Marble
  • Wood
slide-50
SLIDE 50

50

Perlin’s textures : Examples