Beispiel #1
0
def create_diffuse_area_light(light2world: Transform, paramSet: ParamSet, shape: Shape):
    L = paramSet.find_spectrum("L", Spectrum(1.0))
    sc = paramSet.find_spectrum("scale", Spectrum(1.0))
    nSamples = paramSet.find_int("nsamples", 1)
    #    if renderOptions.quickRender:
    #        nSamples = max(1, nSamples / 4)
    return DiffuseAreaLight(light2world, L * sc, nSamples, shape)
Beispiel #2
0
def create_spotLight(paramSet: ParamSet, light2world: Transform) -> PointLight:
    from maths.matrix44 import Matrix44
    from maths.vector4d import Vector4d

    I = paramSet.find_spectrum("I", Spectrum(1.0))
    sc = paramSet.find_spectrum("scale", Spectrum(1.0))
    coneangle = paramSet.find_float("coneangle", 30.0)
    conedelta = paramSet.find_float("conedeltaangle", 5.0)

    # Compute spotlight world to light transformation
    frome = paramSet.find_point("from", Point3d(0.0, 0.0, 0.0))
    to = paramSet.find_point("to", Point3d(0.0, 0.0, 1.0))
    direction = (to - frome).get_normalized()
    du, dv = Transform.create_coordinateSystem(dir)
    m = Matrix44.create_from_vector4d(
        Vector4d(du.x, du.y, du.z, 0.0),
        Vector4d(dv.x, dv.y, dv.z, 0.0),
        Vector4d(direction.x, direction.y, direction.z, 0.0),
        Vector4d(0.0, 0.0, 0.0, 1.0))
    dirToZ = Transform(m)
    light2world = light2world * Transform.create_translate(frome.ex, frome.ey, frome.ez) * dirToZ.get_invert()
    return SpotLight(light2world, I * sc, coneangle, coneangle - conedelta)
Beispiel #3
0
def create_projection_light(paramSet: ParamSet, light2world: Transform) -> PointLight:
    I = paramSet.find_spectrum("I", Spectrum(1.0))
    sc = paramSet.find_spectrum("scale", Spectrum(1.0))
    fov = paramSet.find_float("fov", 45.)
    texname = paramSet.find_filename("mapname", "")
    return ProjectionLight(light2world, I * sc, texname, fov)
Beispiel #4
0
def create_light_point(paramSet: ParamSet, light2world: Transform) -> PointLight:
    I = paramSet.find_spectrum("I", Spectrum(1.0))
    sc = paramSet.find_spectrum("scale", Spectrum(1.0))
    P = paramSet.find_point("from", Point3d(0.0, 0.0, 0.0))
    l2w = Transform.create_translate(P.x, P.y, P.z) * light2world
    return PointLight(l2w, I * sc)