Пример #1
0
 def make_context(n):
     mi = MediumInteraction3f.zero(n)
     mi.wi = wi
     ek.set_slices(mi.wi, n)
     mi.sh_frame = Frame3f(-mi.wi)
     mi.wavelengths = []
     ctx = PhaseFunctionContext(None)
     return mi, ctx
Пример #2
0
def test02_eval(variant_scalar_rgb):
    from mitsuba.core.math import Pi
    from mitsuba.render import PhaseFunctionContext, MediumInteraction3f
    from mitsuba.core.xml import load_string

    p = load_string("<phase version='2.0.0' type='isotropic'/>")
    ctx = PhaseFunctionContext(None)
    mi = MediumInteraction3f()
    for theta in np.linspace(0, np.pi / 2, 4):
        for ph in np.linspace(0, np.pi, 4):
            wo = [np.sin(theta), 0, np.cos(theta)]
            v_eval = p.eval(ctx, mi, wo)
            assert np.allclose(v_eval, 1.0 / (4 * Pi))
def test01_create_and_eval(create_phasefunction):
    p = load_string("<phase version='2.0.0' type='myisotropic'/>")
    assert p is not None

    assert has_flag(p.m_flags, PhaseFunctionFlags.Isotropic)
    assert not has_flag(p.m_flags, PhaseFunctionFlags.Anisotropic)
    assert not has_flag(p.m_flags, PhaseFunctionFlags.Microflake)

    ctx = PhaseFunctionContext(None)
    mi = MediumInteraction3f()
    for theta in np.linspace(0, np.pi / 2, 4):
        for ph in np.linspace(0, np.pi, 4):
            wo = [np.sin(theta), 0, np.cos(theta)]
            v_eval = p.eval(ctx, mi, wo)
            assert np.allclose(v_eval, 1.0 / (4 * Pi))