示例#1
0
 Spectrum PointLight::sample_ray_radiance(const Scene&, 
     Ray& out_ray, Normal& out_nn, float& out_pdf,
     LightRaySample sample) const
 {
   Vec3 wi = uniform_sphere_sample(sample.uv_dir.x, sample.uv_dir.y);
   out_ray = Ray(this->pt, Vector(wi), 0.f);
   out_nn = Normal(wi);
   out_pdf = uniform_sphere_pdf();
   return this->intensity;
 }
示例#2
0
	virtual float3 sample_direct(UniformRandomGenerator & gen, const float3 & P, float3 & Wi, float & pdf) const override final
	{
		Wi = normalize(lightPos - P) * uniform_sphere({ gen.random_float(), gen.random_float() }); // comment the sphere sample for hard shadows
		pdf = uniform_sphere_pdf();
		return intensity / distance2(lightPos, P);
	}
示例#3
0
 float SphereShape::point_pdf(const Point&) const {
   return uniform_sphere_pdf() / this->area();
 }