001-Course Iro

90 阅读1分钟

What demand ?

Theory:

  • basic representations(digitally encode shape)
  • sampling & aliasing(acquire & reproduce a signal)
  • numerical methods (manipulate signals)
  • radiometry & light transport(how light behave)
  • perception(how to relate to people)

Systems:

  • parallel hetergenous processing
  • graphics-specific programming languages
  • ...

Activity:

modeling:

Use the coordinates to discribe

Drawing the cube:

How to draw 3D cube to 2D iamge?

  1. map 3D to 2D
  2. connect 2D points with straight lines

perspective projection:

Snipaste_2024-03-08_10-20-56.png From the similar triangle,we can get that,v=yzv={\frac{y}{z}}.Similarly,like our eyes: objects close looks bigger,frr away is bigger.

algorithm:

Generally,z is bigger,iamge is smaller,thus get that :

  • camera is at c=(2,3,5)c=(2,3,5)
  • Convert (X,Y,Z)(X,Y,Z) to (u,v)(u,v)
    1. subtract c from (X,Y,Z)(X,Y,Z) to (x,y,z)(x,y,z)
    2. divide (x,y)(x,y) by z to get (u,v)(u,v)

Algorithm details:

  1. c(0,0,0)c{\ne}(0,0,0),we can get the shifting from origin.It's a way to represent relativity
  2. if c=(0,0,0)c=(0,0,0),It's the orthogonal projection
  3. divide (x,y) by z: inverse ratio about z(distance)
  4. c is camera,we can move it ,just like move the camera to get different views of objects

How to draw lines?

Rasterization:

convert continous object to a discrete representation on a raster grid

What pixels should we color ?

Diamond rule:light up pixel if line passes through

  • If check every single pixel in the image

    • O(n2)O(n^2)
    • tryO(n)O(n)
  • Incremental line rasterization:

v=v1;
for(u=u1;u<=u2;u++)
{
    v+=s
    draw(u,round(v))
}

Snipaste_2024-03-08_13-54-45.png