Textures, Mappings (06) RNDr. Martin Madaras, PhD. - - PowerPoint PPT Presentation

textures mappings 06
SMART_READER_LITE
LIVE PREVIEW

Textures, Mappings (06) RNDr. Martin Madaras, PhD. - - PowerPoint PPT Presentation

Principles of Computer Graphics and Image Processing Textures, Mappings (06) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk Overview Texture mapping 3D Models with texture coordinates UV map parametrization Perspective


slide-1
SLIDE 1

Principles of Computer Graphics and Image Processing

Textures, Mappings (06)

  • RNDr. Martin Madaras, PhD.

martin.madaras@stuba.sk

slide-2
SLIDE 2

2

 Texture mapping

 3D Models with texture coordinates  UV map parametrization  Perspective correction

 Aliasing  Anti-aliasing

 Supersampling  Mip Maps

 Advanced textures

 Environment mapping  Bump mapping  Normal mapping, Displacement mapping etc.

Overview

slide-3
SLIDE 3

3

  • Ask questions, please!!!
  • Be communicative
  • www.slido.com #PPGSO06
  • More active you are, the better for you!

How the lectures should look like #1

slide-4
SLIDE 4

4

 Visually distinguishes 2 objects with identical geometry  For now, we focus on object’s own color

Material

slide-5
SLIDE 5

5

 Used to define object’s color appearance

 2D bitmap  Volumetric - texels  Procedural texture

Texture

slide-6
SLIDE 6

6

Texture mapping

 Mapping between object space and 2D texture space  New coordinate system: Texture coordinates

slide-7
SLIDE 7

7

Texture mapping

slide-8
SLIDE 8

8

Texture mapping

slide-9
SLIDE 9

9

Texture mapping

slide-10
SLIDE 10

10

Texture mapping

slide-11
SLIDE 11

3D rendering pipeline

11

3D polygons Modeling Transformation Lighting Viewing Transformation Projection Transformation Clipping Scan Conversion 2D Image

1

 Lighting + color from image

 Could be implemented here

slide-12
SLIDE 12

3D rendering pipeline

12

3D polygons Modeling Transformation Lighting Viewing Transformation Projection Transformation Clipping Scan Conversion 2D Image

1

 GPU Texture mapping

 Fragment shader implementation

slide-13
SLIDE 13

13

 Add visual detail to surfaces of 3D objects

 1) Parameterized mesh  2) Final textured model

Texture mapping

slide-14
SLIDE 14

14

 Remember polygon rasterization

Intermediate pixels

S C A N L I N E projected scanline Screen space Texture space

slide-15
SLIDE 15

15

 object diffuse color

 patterns, decals

 modulate surface properties

 bumps, displacements

 modulate lighting properties

 e.g. shininess

 simulate physical phenomena

 reflection, refraction, global illumination

Texture usage

slide-16
SLIDE 16

16

Texture mapping

slide-17
SLIDE 17

17

 Unwrapping earth into a plane

Example – cartography

slide-18
SLIDE 18

18

Parameterization

slide-19
SLIDE 19

19

 Implicit parametrization by geometrical primitives

Parameterization

slide-20
SLIDE 20

20

 XYZ to UV for sphere:

Parameterization

2 2 2 2 2 2

z y x y v z y x x u + + = + + =

http://tobias.preclik.de/codeblog/?p=9

slide-21
SLIDE 21

21

 Parameterization using an intermediate surface

Parameterization

slide-22
SLIDE 22

22

Parameterization

slide-23
SLIDE 23

23

 When drawing pixels, map from ...

 image coordinate system (x,y) to  modeling coordinate system (u,v) to  texture coordinate system (t,s)

Texture mapping

slide-24
SLIDE 24

24

 Scan conversion

 Interpolate texture coordinates down/across scan lines  Distort due to bilinear interpolation approximation  Cut polygons into smaller ones, or  Perspective divide at each pixel

UV mapping

slide-25
SLIDE 25

25

 Scan conversion

 Interpolate texture coordinates down/across scan lines  Distort due to bilinear interpolation approximation  Cut polygons into smaller ones, or  Perspective divide at each pixel

Perspective correction

slide-26
SLIDE 26

26

Perspective correction

INCORRECT CORRECT

tQ P t T + − = ) 1 (

z z

Q Q t P P t T + − = ) 1 (

slide-27
SLIDE 27

27

 Texture mapping

 3D Models with texture coordinates  UV map parametrization  Diffuse color textures  Other textures

 Bump mapping  Environment mapping

 Aliasing  Anti-aliasing

 Supersampling  Mip Maps

Overview

slide-28
SLIDE 28

28

 “Moire pattern”

Nyquist frequency

Sampling frequency >= 2x signal frequency

Aliasing

slide-29
SLIDE 29

29

 Ideally, use elliptically shaped convolution filter  In practice we use rectangles

Texture filtering

slide-30
SLIDE 30

30

 Size of filter depends on projective wrap  Images can be pre-filtered

 Mip Maps  Summed area tables

Texture filtering

slide-31
SLIDE 31

31

 Keep textures pre-filtered at multiple resolutions

 For each pixel, linearly interpolate between two closest levels

(e.g., trilinear filtering)

 Fast and easy for hardware

Mip maps

slide-32
SLIDE 32

32

Environment mapping

https://www.youtube.com/watch?v=LOeEfkzZ1ps

slide-33
SLIDE 33

33

Light maps

slide-34
SLIDE 34

34

 Pre-computed high-quality lighting  Stored into special texture (light map)  Light map combined with the texture  Texture baking (permanent)

Light maps

slide-35
SLIDE 35

35

Light maps

http://www.cs.bath.ac.uk/~pjw/NOTES/pics/lightmap.html

slide-36
SLIDE 36

36

 A modified surface normal is calculated from the height map  Modified normal is used during shading  Geometry is not altered

Bump mapping

slide-37
SLIDE 37

37

 Combine multiple textures

Multitexturing

slide-38
SLIDE 38

Overview

38

 Advanced Shading and Mapping

 Deferred Shading  Shadow Mapping  Normal Mapping  Displacement Mapping  Vector Displacement Mapping

slide-39
SLIDE 39

Deferred Shading

39

 Compute Lighting in Screen-Space  Two pass approach  Decoupling of geometry and lighting  G-Buffer stores positions, normals, materials …  Lighting is a per-pixel operation  Problems with transparency and G-buffer size  O(objects+lights)

slide-40
SLIDE 40

Deferred Shading

40

Diffuse Color Z Buffer Surface Normals Final Composition

slide-41
SLIDE 41

Normal Mapping

41

 Fake lighting of bumps and dents  “Dot3 bump mapping”  Add lighting details without additional geometry  Store normals from high-polygon object in texture  Encode X,Y,Z as R,G,B color information

slide-42
SLIDE 42

Normal Mapping

42

slide-43
SLIDE 43

Normal Mapping

43

a)

Normal map

(encoded in object space)

b)

Original high-res model

c)

Rendered low-res model

d)

Applied normal map

slide-44
SLIDE 44

Displacement Mapping

44

 Move geometry as specified in texture  Displacement in direction of surface normal  Can add additional detail to a subdivided model  Relies on dense geometry  Usually used with adaptive tessellation techniques

slide-45
SLIDE 45

Displacement Mapping

45

slide-46
SLIDE 46

Displacement Mapping

46

bump mapping displacement mapping

slide-47
SLIDE 47

Vector Displacement Mapping

47

 Displace geometry in any direction  Generalization of displacement mapping  Possible to store detailed geometry in textures  Excellent for sculpting purposes (Z-Brush)

slide-48
SLIDE 48

Vector Displacement Mapping

48

slide-49
SLIDE 49

Shadow Mapping

49

 Two pass technique  Obtain Light view depth buffer  Compare each pixel rendered to with light depth  Pixels further away are in shadow  Needs margin of error for lit pixels  Implementation usually has artifacts

slide-50
SLIDE 50

Shadow Mapping

50

slide-51
SLIDE 51

Lights, visibility, texture...

51

slide-52
SLIDE 52

What’s missing is shadow

52

slide-53
SLIDE 53

53

Shadows

Next Week

slide-54
SLIDE 54

54

Acknowledgements

 Thanks to all the people, whose work is shown here and whose

slides were used as a material for creation of these slides:

Matej Novotný, GSVM lectures at FMFI UK Peter Drahoš, PPGSO lectures at FIIT STU

slide-55
SLIDE 55

55

www.slido.com #PPGSO06 martin.madaras@stuba.sk

Questions ?!