Guest User

Untitled

a guest
Jan 17th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Spectrum MirrorBSDF::f(const Vector3D& wo, const Vector3D& wi) {
  2. return reflectance * (1.0 / abs_cos_theta(wo));
  3. }
  4.  
  5. Spectrum light_L = light->sample_L(hit_p, &dir_to_light, &dist_to_light, &pdf);
  6. // convert direction into coordinate space of the surface, where
  7. // the surface normal is [0 0 1]
  8. Vector3D w_in = w2o * dir_to_light;
  9. double cos_theta = std::max(0.0, w_in[2]);
  10. Spectrum f = isect.bsdf->f(w_out, w_in);
  11. // TODO:
  12. // Construct a shadow ray and compute whether the intersected surface is
  13. // in shadow and accumulate reflected radiance
  14. Ray shadow_ray(hit_p + EPS_D * dir_to_light, dir_to_light, dist_to_light - (EPS_D * dir_to_light).norm(), 0);
  15. if (!bvh->intersect(shadow_ray))
  16. {
  17. L_out += (f * light_L * (cos_theta * scale / pdf));
  18. }
Add Comment
Please, Sign In to add comment