ComputerGraphics | Lighing, Shading

light sources

  • directed/parallel light source
    position is point at infinity (x,y,z,0)^T
  • point light source
    finite position (x,y,z,1)^T
  • spot
    position, direction, opening angle
  • ambient light

type of reflection

  • specular(mirror-like)
  • diffuse
  • mixed

reflection distribution

specular + glossy光滑 + diffuse = distribution

ideal diffuse reflection

reflected radiance is independent of reflection direction
Lambert s cosine law d I = L d A 1 c o s θ 1 dI = LdA_1cos\theta_1 dI=LdA1cosθ1
在这里插入图片描述
computation:
I d i f f u s e = k d I l i g h t c o s θ I_{diffuse} = k_d I_light cos\theta Idiffuse=kdIlightcosθ
I d i f f u s e = k d I l i g h t ( n ⋅ l ) I_{diffuse} = k_d I_light (\textbf{n} \cdot \textbf{l}) Idiffuse=kdIlight(nl)
n, l is normalized.

ideal specular reflection

在这里插入图片描述

refraction

在这里插入图片描述
n 1 s i n θ 1 = n 2 s i n θ 2 n_1sin\theta_1 = n_2sin\theta_2 n1sinθ1=n2sinθ2

specular-diffuse reflection

在这里插入图片描述

  • phong model
    I p h o n g = k a I a + k d I d m a x ( n ⋅ l , 0 ) + k s I s m a x ( r ⋅ v , 0 ) α I_{phong} = k_aI_a + k_dI_dmax(n \cdot l,0)+k_sI_smax(r \cdot v,0)^\alpha Iphong=kaIa+kdIdmax(nl,0)+ksIsmax(rv,0)α
    I p h o n g I_{phong} Iphong 最终光强
    k a k_a ka 环境材质属性,反射系数,越大反射光越强
    I a I_a Ia 环境光分量
    k d k_d kd 漫反射材质
    I d I_d Id 漫射光分量
    n n n 表面法线的单位矢量
    l l l 光线的单位矢量,方向指向光源
    k s k_s ks 镜面反射材质属性
    I s I_s Is 镜面光分量
    r r r 反射光单位矢量
    v v v 视线单位矢量,指向观察者
    α \alpha α 材质的光泽度
  • blinn-phong-model
    在这里插入图片描述
    在这里插入图片描述

shading variants(intepolation 插补)

  • flat shading
    one color per face
  • gouraud shading
    one color per vertex, color on primitives get interpolated
    color get calculated in the vertex shader
  • phong shading
    one color per pixel
    color get calculated in the fragment shader
Shading\IlluminationToonLambert(+ambient)Phong(+lambert+ambient)Blinn-phong(+lambert+ambient)
FlatNoNoNoNo
GouraudNoOkOkNo
PhongOkOkOkOk

Resources

  1. <<Web高级编程:开发Web3D图形>>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值