计算机图形学(Lec7)

visibility/occlusion - z buffering

Painter's Algorithm

 - Paint from back to front, overwrite in the same framebuffer 

距离观测者举例 —— 深度

shortcoming - 相叠时无法计算(如上图)


z - buffer

idea 

  • store current min z-value for each sample(pixel)
  • Needs an addition buffer for depth values

           -- frame buffer store color values

           -- depth buffer(z-buffer) stores depth(深度图、深度缓存)

Important :for simplicity wo suppose z is always positive

(smaller z --> closer、larger z --> further)

z-buffer example

for(each triangle T)
    for(each sample(x, y, z) in T)
        if(z < zbuffer(x, y)) //closest sample so far
            framebuffer(x, y) = rgb;  //update color
            zbuffer(x, y) = z;  //update depth
        else
            ;  // do nothing, this sample is occluded

Complexity

  • O(n) for no triangles(assuming constant coverage) 只需记录每个像素的最小值

Drawing triangles in different orders? ==> no connection with orders!

Most important visibility algorithm

  • Implemented in hardware for all GPUs

Summary 


Shading 着色 对不同的物体应用不同的材质

Perceptual Observation

  • Specular highlights --> 高光
  • Diffuse reflection --> 漫反射
  • Ambient lighting --> 环境光照

Inputs :

  • View direction V
  • surface normal n
  • light direction I ( for each of many lights)
  • surface parameters ( color、shininess ...)

Note : shading(着色) ≠ shadow(阴影) shading is local

Blinn-Phong reflectance model

① Diffuse reflection

已知点光源和shading poin距离

L_{d} = K_{d}(\frac{I}{r^{^{2}}})max(0, \vec{n}\cdot \vec{l})

Ld --> diffusely reflected light

Kd --> diffuse cofficient(color)  不同吸收率产生不同的颜色

max(0, \vec{n}\cdot \vec{l}) --> energy received by the shading point

Noted that shading independent of view angle.

Result

经验模型,并非完全是物理模型

参考链接:https://www.bilibili.com/video/BV1X7411F744?p=7(GAMES101-现代计算机图形学入门-闫令琪)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值