Some errors is in result, Corrugated wall appears, under normal circumstances should not have ripples, it should be a simple diffuse material, but now it has ripples,but i cant find the problem.Please help me, thanks.
path trace code :
if (r.depth >= max_ray_depth)
return L_out;
float pdf;
Vector3D w_in;
Spectrum f = isect.bsdf->sample_f(w_out, &w_in, &pdf);
double cos_theta = std::max(0.0, w_in[2]);
if (cos_theta > 0.0 && pdf > 0.0 )
{
Vector3D pdir = (o2w * w_in - hit_p ).unit();
pdir.normalize();
Ray pr(hit_p, pdir, int(r.depth + 1));
L_out += (f*cos_theta*trace_ray(pr)*(1.0/pdf));
}