Exemple #1
0
def brdf_remap(wo: 'geo.Vector', wi: 'geo.Vector') -> 'geo.Point':
    """
	Mapping regularly sampled BRDF
	using Marschner, 1998
	"""
    dphi = geo.spherical_phi(wi) - geo.spherical_phi(wo)
    if dphi < 0.:
        dphi += 2. * PI
    if dphi > 2. * PI:
        dphi -= 2. * PI
    if dphi > PI:
        dphi = 2. * PI - dphi

    return geo.Point(
        sin_theta(wi) * sin_theta(wo), dphi * INV_PI,
        cos_theta(wi) * cos_theta(wo))
Exemple #2
0
 def test_spherical(self, theta, phi):
     st = np.sin(theta)
     ct = np.cos(theta)
     v = geo.spherical_direction(st, ct, phi)
     theta_ret = geo.spherical_theta(v)
     phi_ret = geo.spherical_phi(v)
     assert_almost_eq(theta, theta_ret)
     assert_almost_eq(phi, phi_ret)
Exemple #3
0
	def pdf(self, p: 'geo.Point', w: 'geo.Vector') -> FLOAT:
		wi = self.w2l(w)
		theta = geo.spherical_theta(wi)
		phi = geo.spherical_phi(wi)
		st = np.sin(theta)
		if st == 0.:
			return 0.
		return self.dist.pdf(phi * INV_2PI, theta * INV_PI / 
				(2. * PI * PI * st))
Exemple #4
0
    def __sphere(self, p: 'geo.Point') -> [FLOAT]:
        """
		Spherical Mapping for single
		point. Returns list
		[s, t].
		"""
        v = geo.normalize(self.w2t(p) - geo.Point(0., 0., 0.))
        theta = geo.spherical_theta(v)
        phi = geo.spherical_phi(v)
        return [theta * INV_PI, phi * INV_2PI]
Exemple #5
0
	def __scale(self, w: 'geo.Vector') -> 'Spectrum':
		"""
		__scale()

		Utility method to scale
		the amount of light projected
		in the given direction. Assume
		the scale texture is encoded
		using spherical coordinates.
		"""
		if self.MIPMap is None:
			return Spectrum(1.)

		wp = geo.normalize(self.w2l(w))
		wp.z, wp.y = wp.y, wp.z
		theta = geo.spherical_theta(wp)
		phi = geo.spherical_phi(wp)
		s = phi * INV_2PI
		t = theta * INV_PI

		return Spectrum(self.projMap.look_up([s, t]), SpectrumType.ILLUMINANT)
Exemple #6
0
	def le(self, rd: 'geo.RayDifferential') -> 'Spectrum':
		wh = geo.normalize(self.w2l(rd.d))
		s = geo.spherical_phi(wh) * INV_2PI
		t = geo.spherical_theta(wh) * INV_PI
		return Spectrum.from_rgb(self.radMap.look_up(s, t), SpectrumType.ILLUMINANT)