Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Spectrum MirrorBSDF::f(const Vector3D& wo, const Vector3D& wi) {
- return reflectance * (1.0 / abs_cos_theta(wo));
- }
- Spectrum light_L = light->sample_L(hit_p, &dir_to_light, &dist_to_light, &pdf);
- // convert direction into coordinate space of the surface, where
- // the surface normal is [0 0 1]
- Vector3D w_in = w2o * dir_to_light;
- double cos_theta = std::max(0.0, w_in[2]);
- Spectrum f = isect.bsdf->f(w_out, w_in);
- // TODO:
- // Construct a shadow ray and compute whether the intersected surface is
- // in shadow and accumulate reflected radiance
- Ray shadow_ray(hit_p + EPS_D * dir_to_light, dir_to_light, dist_to_light - (EPS_D * dir_to_light).norm(), 0);
- if (!bvh->intersect(shadow_ray))
- {
- L_out += (f * light_L * (cos_theta * scale / pdf));
- }
Add Comment
Please, Sign In to add comment