【发布时间】:2012-10-29 17:00:52
【问题描述】:
我在网上阅读了很多光线追踪算法。但是,我对阴影和阴影没有清楚的了解。根据我的理解,下面的伪代码是正确的吗?
for each primitive
check for intersection
if there is one
do color be half of the background color
Ishadow = true
break
for each ambient light in environment
calculate light contribution to the color
if ( Ishadow == false )
for each point light
calculate diffuse shading
calculate reflection direction
calculate specular light
trace for reflection ray // (i)
add color returned from i after multiplied by some coefficient
trace for refraction ray // (ii)
add color returned from ii after multiplied by some coefficient
return color value calculated until this point
【问题讨论】:
标签: c algorithm graphics pseudocode