29
1 projects in digital art • shading © 2007 fabio pellacini • 1 shading projects in digital art • shading © 2007 fabio pellacini • 2 overview what is shading? surface characteristics color, light response, texture, roughness light response brdfs, non-physical styles texturing and painting projections, parameterization, procedurals bumps and displacements shader creation shading trees, shading languages

shading - Fabio Pellacini13 projects in digital art • shading © 2007 fabio pellacini • 25 mapping • takes an image and apply on a surface • mapping function – for each point

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • 1

    projects in digital art • shading © 2007 fabio pellacini • 1

    shading

    projects in digital art • shading © 2007 fabio pellacini • 2

    overview

    • what is shading? •  surface characteristics

    –  color, light response, texture, roughness •  light response

    –  brdfs, non-physical styles •  texturing and painting

    –  projections, parameterization, procedurals –  bumps and displacements

    •  shader creation –  shading trees, shading languages

  • 2

    projects in digital art • shading © 2007 fabio pellacini • 3

    what is shading?

    • defining the material characteristics –  color –  light response –  textures –  roughness

    projects in digital art • shading © 2007 fabio pellacini • 4

    examples

  • 3

    projects in digital art • shading © 2007 fabio pellacini • 5

    examples - color

    projects in digital art • shading © 2007 fabio pellacini • 6

    examples - light response

  • 4

    projects in digital art • shading © 2007 fabio pellacini • 7

    examples - texture

    projects in digital art • shading © 2007 fabio pellacini • 8

    examples – roughness

  • 5

    projects in digital art • shading © 2007 fabio pellacini • 9

    color

    •  the main color of an object

    • what is color? –  human perception of light, i.e. power spectrum of

    electromagnetic radiation –  very complicated subjects!

    •  involves a lot of physiology and psychology • not fully understood yet

    –  we will only care about color in digital images

    projects in digital art • shading © 2007 fabio pellacini • 10

    color

    •  visible colors can be describe using 3 numbers –  which ones? –  choose the easier representation

    •  red, green, blue (RGB) –  color used by monitors to create images

    1,0,0 0,1,0 0,0,1 1,1,1

    0,0,0 0.5,0,0 0,0.5,0 0,0,0.5

    1,1,0 1,1,0 1,1,0

  • 6

    projects in digital art • shading © 2007 fabio pellacini • 11

    color

    • RGB is hard to use –  changes to lightness and saturation

    • hue, saturation, value (HSV) –  easier to specify colors –  based on human perception

    0,1,1 0.4,1,1 0.7,1,1 0,0,1

    0,0,0 0,1,0.5 0.4,1,0.5 0.7,1,0.5

    0.2,1,1 0.9,1,1 0.5,1,1

    projects in digital art • shading © 2007 fabio pellacini • 12

    light response

    •  specifies how a surface reflects light –  will be covered in detail in upcoming lecture –  often called Light reflection model

  • 7

    projects in digital art • shading © 2007 fabio pellacini • 13

    light response – phong model

    N

    R V L

    projects in digital art • shading © 2007 fabio pellacini • 14

    light response – phong model

  • 8

    projects in digital art • shading © 2007 fabio pellacini • 15

    light response – phong model

    projects in digital art • shading © 2007 fabio pellacini • 16

    light response – phong model

  • 9

    projects in digital art • shading © 2007 fabio pellacini • 17

    light response – phong model

    projects in digital art • shading © 2007 fabio pellacini • 18

    light response – phong model

  • 10

    projects in digital art • shading © 2007 fabio pellacini • 19

    non-photorealistic styles (NPR)

    •  realistic materials or cartoon-like ones? –  choice of animation style

    projects in digital art • shading © 2007 fabio pellacini • 20

    non-photorealistic styles (NPR)

    Phong NPR

    © G

    ooch

    et

    al.

  • 11

    projects in digital art • shading © 2007 fabio pellacini • 21

    cartoon look: real or NPR?

    •  avoid 2d cell animation look –  today’s 2D animation often rendered in 3D

    • Pixar/PDI look: a mixture of the real and NPR –  realistic, physically-based building boxes –  combined in non-realistic ways

    projects in digital art • shading © 2007 fabio pellacini • 22

    texturing

    •  real world: surface properties vary across surfaces

  • 12

    projects in digital art • shading © 2007 fabio pellacini • 23

    texturing

    • CG: change shading parameters –  for each point on the surface

    projects in digital art • shading © 2007 fabio pellacini • 24

    texturing

    •  often textures are images

  • 13

    projects in digital art • shading © 2007 fabio pellacini • 25

    mapping

    •  takes an image and apply on a surface

    • mapping function –  for each point on the surface specifies a point in the

    image

    Mapping Function

    Surface Image

    projects in digital art • shading © 2007 fabio pellacini • 26

    projections

    • defines mapping by projection –  projection follows simple shapes

    • plane, box, cylinder, sphere

    • useful for man made object and simple shapes

  • 14

    projects in digital art • shading © 2007 fabio pellacini • 27

    projections - planar

    projects in digital art • shading © 2007 fabio pellacini • 28

    projections - cubical

  • 15

    projects in digital art • shading © 2007 fabio pellacini • 29

    projections - cylindrical

    projects in digital art • shading © 2007 fabio pellacini • 30

    projections – spherical

  • 16

    projects in digital art • shading © 2007 fabio pellacini • 31

    tiling

    •  repeat texture when mapping is out of it

    Untiled Tiled

    projects in digital art • shading © 2007 fabio pellacini • 32

    distortions

    •  textures get minified and magnified on surfaces –  always try to minimize this

    Distorted Undistorted

  • 17

    projects in digital art • shading © 2007 fabio pellacini • 33

    seems

    •  seems are created by tiling or joining texture edges

    projects in digital art • shading © 2007 fabio pellacini • 34

    fundamental problems

    •  seems and distortions are unavoidable –  inherent in any form of mapping

    • mathematically speaking –  seems originates from discontinuities in the mapping

    function –  distortions originates from the behavior of the second

    derivative of the mapping function

  • 18

    projects in digital art • shading © 2007 fabio pellacini • 35

    parameterization

    • projections do not work if geometry if different

    •  store the mapping function onto the geometry –  store texture coordinates for each control point –  interpolate along the surface –  often called UV mapping

    • parameterization: process of assigning intrinsic texture coordinates onto objects

    projects in digital art • shading © 2007 fabio pellacini • 36

    subdivision surfaces and mapping

    Level 0 Level 1 Level 2

  • 19

    projects in digital art • shading © 2007 fabio pellacini • 37

    subdivision surfaces and mapping

    Parameterization Projection

    projects in digital art • shading © 2007 fabio pellacini • 38

    visualizing and editing UV maps

  • 20

    projects in digital art • shading © 2007 fabio pellacini • 39

    procedural texturing

    •  texture variations are generated algorithmically –  user can tweak parameters that control texture look –  often specified in 3d for solid materials

    [Wol

    fe /

    SG

    97 S

    lide

    set]

    projects in digital art • shading © 2007 fabio pellacini • 40

    painting

    •  in industry almost all textures are from paintings –  better match with the rest of the look –  only required details

    • paint directly on the surface –  avoid seems and distortions –  but cannot be reused on other meshes

  • 21

    projects in digital art • shading © 2007 fabio pellacini • 41

    painting

    projects in digital art • shading © 2007 fabio pellacini • 42

    painting

    • painted textures appear distorted when viewed

    •  this “pre-distortion” avoid distortion issues when applied to the given surface

    •  if not using a 3d paint tool, the artist needs to apply this distortion as he works –  in practice this is never done

  • 22

    projects in digital art • shading © 2007 fabio pellacini • 43

    painting - example

    projects in digital art • shading © 2007 fabio pellacini • 44

    painting - atlas

    • breaks up model into a single texture

    © Discreet

  • 23

    projects in digital art • shading © 2007 fabio pellacini • 45

    painting - stretching

    projects in digital art • shading © 2007 fabio pellacini • 46

    types of maps

    •  can modify every surface property –  diffuse color –  specular color –  transparency –  surface geometry

  • 24

    projects in digital art • shading © 2007 fabio pellacini • 47

    diffuse maps

    •  variations to diffuse color

    projects in digital art • shading © 2007 fabio pellacini • 48

    specular maps

    •  variation of the highlights

  • 25

    projects in digital art • shading © 2007 fabio pellacini • 49

    transparency maps

    •  variation of object transparency

    projects in digital art • shading © 2007 fabio pellacini • 50

    bump maps

    •  variations of surface normals

  • 26

    projects in digital art • shading © 2007 fabio pellacini • 51

    displacement maps

    •  variations of surface position and normals

    projects in digital art • shading © 2007 fabio pellacini • 52

    bump vs. displacement maps

    Bump map Displacement map

  • 27

    projects in digital art • shading © 2007 fabio pellacini • 53

    bump vs. displacement maps

    Bump map Displacement map

    projects in digital art • shading © 2007 fabio pellacini • 54

    type of maps

    •  almost always combine various types

  • 28

    projects in digital art • shading © 2007 fabio pellacini • 55

    shader creation

    •  shading trees –  shaders are collections of nodes in a graph –  visual representation –  used in all the modeling software

    •  shading languages –  shaders are programs –  programmer representation

    • much more flexible –  used in productions by the more technically inclined

    • but disappearing since too hard to control

    projects in digital art • shading © 2007 fabio pellacini • 56

    shading trees - examples

    • phong shading with a texture

  • 29

    projects in digital art • shading © 2007 fabio pellacini • 57

    shading languages - examples

    • phong shading with a texture

    surface phong(uniform color C; uniform float Kd, Ks, roughness; string txt) { Cs = C * texture(txt, s, t) * diffuse(N) + Ks * specular(N,E,roughness); }