ComputerGraphics | Raytracing

Recursive raytracing

send a ray from eye center through each pixel center
draw the object that intersect the ray closest to the image plane:

algorithm:
For every of the screen{
1. generate primary ray: eye -> pixel center
2. color(ray)
}

color(ray){

  1. computer 1. intersection; if no, return background color
  2. set C to zero vector
  3. For each light source{
    1.compute line segment from intersection to light source
    2. test for intersection with objects
    3. if no intersection, add phong model color for light source and intersection to C
    }
  4. if object at intersection is mirror-like, generate refelcted ray and add color to C
  5. if object at intersection is transparent, generate refracted ray and add color to C
  6. return color
    }

Ray Object Intersection

ray definition: R ( t ) = R 0 + t ∗ R d R(t) = R_0+t*R_d R(t)=R0+tRd
R 0 R_0 R0 origin of the ray
R d R_d Rd direction

  • Sphere
  • Triangle
  • Triangle better
  • Algebraic Surfaces
  • Implicit surface

ray tracing is slow:
n #primitives in the scene
m #primary rays
comlexity: at least O(mn)

Faster/fewer ray object intersection

  • spatial data structure/bounding volume hierarchies
    non-intersection faster
  • directional precomputation
    light-buffer
  • hierarchical spatial subdivison
    kd-tree traversal

Fewer rays

adaptive recursion depth

Faster ray object intersection

bounding volume hierarchies: culling algorithm
(adaptive) spatial subdivision
hierarchical spatial subdivison

Directional precomputation

  • light buffer

Distribution ray tracing

  • soft shadows 软阴影
  • Gloss/Blurred reflection 光泽/反射模糊
  • Blurred transparency 透明度模糊
  • Motion Blur 运动模糊
  • Depth of field 景深

Advantages

only ray intersection and normal computation at intersection

Disadvantages

sampling => aliasing =>solution: super sampling, but expensive
high computation effort
expensive shadow edges - penumbra/soft shadows 阴影边缘–半影/柔和阴影
recomputed for each new viewpoint

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值