Example #1
0
Spectrum DensityRegion::tau(const Ray &r, float stepSize,
                            float u) const {
    float t0, t1;
    float length = r.d.Length();
    if (length == 0.f) return 0.f;
    Ray rn(r.o, r.d / length, r.mint * length, r.maxt * length, r.time);
    if (!IntersectP(rn, &t0, &t1)) return 0.;
    Spectrum tau(0.);
    t0 += u * stepSize;
    while (t0 < t1) {
        tau += sigma_t(rn(t0), -rn.d, r.time);
        t0 += stepSize;
    }
    return tau * stepSize;
}
Example #2
0
bool BBox::IntersectP(const Ray &ray, float *hitt0, float *hitt1) const {
	return IntersectP(ray, pMin, pMax, hitt0, hitt1);
}
Example #3
0
	Spectrum Tau(const Ray &ray, float, float) const {
		float t0, t1;
		if (!IntersectP(ray, &t0, &t1)) return 0.;
		return Distance(ray(t0), ray(t1)) * (sig_a + sig_s);
	}