Пример #1
0
def FinalConfiguration(name='final', **kwargs):
    conf = haps.Configuration(name, base='base_final')
    conf.add_parms([("lighting_engine", "pt"), ("passes", "1"),
                    ("pixel_renderer", "uniform"), ("sampling_mode", "qmc"),
                    ("shading_result_framebuffer", "ephemeral"),
                    ('spectrum_mode', 'rgb'), ('rendering_threads', '0')])

    conf.add(
        haps.Parameters('light_sampler').add_parms([('algorithm', 'cdf')]))

    conf.add(
        haps.Parameters('uniform_pixel_renderer').add_parms([
            ('samples', 9), ('decorrelate_pixels', 'true'),
            ('force_antialiasing', 'true')
        ]))

    conf.add(
        haps.Parameters('pt').add_parms([("dl_light_samples", "1.000000"),
                                         ("dl_low_light_threshold",
                                          "0.000000"),
                                         ("enable_caustics", "true"),
                                         ("enable_dl", "true"),
                                         ("enable_ibl", "true"),
                                         ("ibl_env_samples", "1.000000"),
                                         ("max_bounces", "-1"),
                                         ("max_diffuse_bounces", "-1"),
                                         ("max_glossy_bounces", "-1"),
                                         ("max_specular_bounces", "-1"),
                                         ("next_event_estimation", "true"),
                                         ("rr_min_path_length", "6")]))

    conf.add(
        haps.Parameters('sppm').add_parms([
            ("alpha", "0.700000"),
            ("dl_mode", "rt"),
            ("enable_caustics", "true"),
            ("enable_ibl", "true"),
            ("env_photons_per_pass", "1000000"),
            ("initial_radius", "0.100000"),
            ("light_photons_per_pass", "1000000"),
            ("max_photons_per_estimate", "100"),
            ("path_tracing_max_bounces", "-1"),
            ("path_tracing_rr_min_path_length", "6"),
            ("photon_tracing_max_bounces", "-1"),
            ("photon_tracing_rr_min_path_length", "6"),
            ("photon_type", "poly"),
        ]))

    return conf
Пример #2
0
def MeshInstance(name, object, **kwargs):
    """Create mesh instance with xform  applied.
    :parm name     : Name of the object we are instance of
    :parm materials: List of materials we will assign
    :parm slots    : List of slots we will assign to
    :parm xforms   : list of tuples/lists with 4x4 floats (can be None)
    :parm times    : list of times samples for xforms    (can be None)
    :parm kwargs   : additional args          
    """
    obj_inst = haps.Object_Instance(name, object=object)

    # This is ugly, but I don't know how to add only stuff
    # which is not at default state now.
    if True in [key.startswith('visibility') for key in kwargs]:
        obj_inst.add(
            haps.Parameters('visibility').add_parms([
                ('shadow', 'true'),
                ('camera', 'true'),
                ('specular', 'true'),
                ('glossy', 'true'),
            ]))

    obj_inst = update_parameters(obj_inst, **kwargs)

    xforms = kwargs.get('xforms')  # [] is correct
    times = kwargs.get('times')
    materials = kwargs.get('materials')
    slots = kwargs.get('slots')

    if not materials:
        materials = ('default', )

    if not slots:
        slots = ('default', )

    if xforms and not times:
        times = [time * 1.0 / len(xforms) for time in range(len(xforms))]

    if xforms and times:
        obj_inst = TransformBlur(obj_inst, xforms, times)

    assert (isinstance(slots, collections.Iterable))
    assert (isinstance(materials, collections.Iterable))

    for slot, material in zip(slots, materials):
        obj_inst.add(
            haps.Assign_Material(None,
                                 slot=slot,
                                 side='front',
                                 material=material))
        obj_inst.add(
            haps.Assign_Material(None,
                                 slot=slot,
                                 side='back',
                                 material=material))

    return obj_inst
Пример #3
0
def InteractiveConfiguration(name='interactive', **kwargs):
    conf = haps.Configuration(name, base='base_interactive')
    conf.add_parms([("lighting_engine", "pt"), ("sampling_mode", "qmc")])
    conf.add(
        haps.Parameters('pt').add_parms([("dl_light_samples", "1.000000"),
                                         ("dl_low_light_threshold",
                                          "0.000000"),
                                         ("enable_caustics", "true"),
                                         ("enable_dl", "true"),
                                         ("enable_ibl", "true"),
                                         ("ibl_env_samples", "1.000000"),
                                         ("max_bounces", "4"),
                                         ("max_diffuse_bounces", "4"),
                                         ("max_glossy_bounces", "4"),
                                         ("max_specular_bounces", "4"),
                                         ("next_event_estimation", "true"),
                                         ("rr_min_path_length", "6")]))
    return conf
Пример #4
0
def AssemblyInstance(name, assembly, **kwargs):
    '''An instance of the assembly. Has own trasform and visibility flags.
    '''
    assembly_inst = haps.Assembly_Instance(name, assembly=assembly)
    if True in [key.startswith('visibility') for key in kwargs]:
        assembly_inst.add(
            haps.Parameters('visibility').add_parms([
                ('shadow', 'true'),
                ('camera', 'true'),
            ]))
    xforms = kwargs.get('xforms')  # [] is correct
    times = kwargs.get('times')

    if xforms and times:
        assembly_inst = TransformBlur(assembly_inst, xforms, times)

    assembly_inst = update_parameters(assembly_inst, **kwargs)

    return assembly_inst
Пример #5
0
def DisneyMaterialLayer(name, layer_number, **kwargs):
    parms = haps.Parameters(name)
    parms.add_parms([
        ("anisotropic", "0"),
        ("base_color", "[0.619608, 0.309804, 0.164706]"),
        ("clearcoat", "0.0"),
        ("clearcoat_gloss", "1.0"),
        ("folded", "false"),
        ("layer_name", name),
        ("layer_number", layer_number),
        ("mask", "1"),
        ("metallic", "0.85"),
        ("roughness", "0.15"),
        ("sheen", "0.0"),
        ("sheen_tint", "0.0"),
        ("specular", "0.5"),
        ("specular_tint", "0.0"),
        ("subsurface", "0.0"),
    ])
    parms = update_parameters(parms, **kwargs)
    return parms