def mitsuba_knob_with_env_light_const(scene, scene_path, **kwargs): mitsuba_knob_base(scene, scene_path, **kwargs) # Environment light Le = 1 light_env = lm.load_light('light_env', 'envconst', {'Le': [Le, Le, Le]}) scene.add_primitive({'light': light_env.loc()})
def plane_emitter(scene, scene_path): """ A scene containing only a single area light. The scene is useful to test the most simpelst configuration. """ camera = lm.load_camera( 'camera', 'pinhole', { 'position': [0, 0, 5], 'center': [0, 0, 0], 'up': [0, 1, 0], 'vfov': 30, 'aspect': 16 / 9 }) mesh = lm.load_mesh( 'mesh', 'raw', { 'ps': [-1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1], 'ns': [0, 0, 1], 'ts': [0, 0, 1, 0, 1, 1, 0, 1], 'fs': { 'p': [0, 1, 2, 0, 2, 3], 'n': [0, 0, 0, 0, 0, 0], 't': [0, 1, 2, 0, 2, 3] } }) material = lm.load_material('mat_black', 'diffuse', {'Kd': [0, 0, 0]}) light = lm.load_light('light', 'area', { 'Ke': [1, 1, 1], 'mesh': mesh.loc() }) scene.add_primitive({'camera': camera.loc()}) scene.add_primitive({ 'mesh': mesh.loc(), 'material': material.loc(), 'light': light.loc() })
def bunny_with_directional_light(scene, scene_path, **kwargs): bunny_base(scene, scene_path, **kwargs) # Directional light Le = 2 light_directional = lm.load_light('light_directional', 'directional', { 'Le': [Le, Le, Le], 'direction': [-1, -1, -1] }) scene.add_primitive({'light': light_directional.loc()})
def bunny_with_point_light(scene, scene_path, **kwargs): bunny_base(scene, scene_path, **kwargs) # Point light Le = 100 light_point = lm.load_light('light_point', 'point', { 'Le': [Le, Le, Le], 'position': [5, 5, 5] }) scene.add_primitive({'light': light_point.loc()})
def bunny_with_area_light(scene, scene_path, **kwargs): bunny_base(scene, scene_path, **kwargs) # Light source Ke = 10 mat_black = lm.load_material('mat_black', 'diffuse', {'Kd': [0, 0, 0]}) light = lm.load_light('light', 'area', { 'Ke': [Ke, Ke, Ke], 'mesh': '$.assets.model_obj.mesh_3' }) scene.add_primitive({ 'mesh': '$.assets.model_obj.mesh_3', 'material': mat_black.loc(), 'light': light.loc() })
def add_light(): s = 10 ps, fs = make_quad([-s, -s], [s, s], 5) mesh = create_lm_raw_mesh('quad_light', ps, fs, [0, 0, -1]) Ke = 10 light = lm.load_light('light', 'area', { 'Ke': [Ke, Ke, Ke], 'mesh': mesh.loc() }) scene.add_primitive({ 'mesh': mesh.loc(), 'material': mat_black.loc(), 'light': light.loc() }) pass
def sphere(scene, scene_path): camera = lm.load_camera( 'camera_main', 'pinhole', { 'position': [0, 2, 5], 'center': [0, 1, 0], 'up': [0, 1, 0], 'vfov': 30, 'aspect': 16 / 9 }) scene.add_primitive({'camera': camera.loc()}) model = lm.load_model('model_obj', 'wavefrontobj', {'path': os.path.join(scene_path, 'sphere.obj')}) mat_diffuse_white = lm.load_material('mat_diffuse_white', 'diffuse', {'Kd': [.8, .8, .8]}) # floor tex = lm.load_texture('tex_floor', 'bitmap', {'path': os.path.join(scene_path, 'default.png')}) mat_floor = lm.load_material('mat_floor', 'diffuse', {'mapKd': tex.loc()}) scene.add_primitive({ 'mesh': model.make_loc('mesh_1'), 'material': mat_floor.loc() }) # sphere # mat = lm.load_material('mat_ut', 'glass', { # 'Ni': 2 # }) mat = lm.load_material('mat_ut', 'mirror', {}) # mat = mat_diffuse_white # mat = lm.load_material('mat_ut', 'mask', {}) scene.add_primitive({ 'mesh': model.make_loc('mesh_3'), 'material': mat.loc() }) # Light source Ke = 10 mat_black = lm.load_material('mat_black', 'diffuse', {'Kd': [0, 0, 0]}) light = lm.load_light('light', 'area', { 'Ke': [Ke, Ke, Ke], 'mesh': model.make_loc('mesh_2') }) scene.add_primitive({ 'mesh': model.make_loc('mesh_2'), 'material': mat_black.loc(), 'light': light.loc() })
def mitsuba_knob_with_area_light(scene, scene_path, **kwargs): mitsuba_knob_base(scene, scene_path, **kwargs) # Area light Ke = 10 model_light = lm.load_model( 'model_light', 'wavefrontobj', {'path': os.path.join(scene_path, 'mitsuba_knob', 'light.obj')}) mat_black = lm.load_material('mat_black', 'diffuse', {'Kd': [0, 0, 0]}) light = lm.load_light('light', 'area', { 'Ke': [Ke, Ke, Ke], 'mesh': model_light.make_loc('mesh_1') }) scene.add_primitive({ 'mesh': model_light.make_loc('mesh_1'), 'material': mat_black.loc(), 'light': light.loc() })
def bunny_with_env_light(scene, scene_path, **kwargs): bunny_base(scene, scene_path, **kwargs) # Environment light light_env = lm.load_light('light_env', 'env', kwargs) scene.add_primitive({'light': light_env.loc()})