ground_tex = tc.Texture( 'image', filename=tc.get_asset_path('textures/metal.jpg')) mesh = tc.Mesh('plane', tc.SurfaceMaterial('pbr', diffuse_map=ground_tex), translate=(0, 0, 0), scale=10, rotation=(0, 0, 0)) scene.add_mesh(mesh) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(-10, 3, 5), scale=1, rotation=(0, 0, -90)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='volumetric_text', overwrite=True) renderer.initialize(preset='pt', scene=create_scene(), min_path_length=1, max_path_length=20, luminance_clamping=0.1) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=0.9, bloom_radius=0.0, gamma=2.2)) renderer.render(10000, 20)
with scene: scene.set_camera(camera) num_spheres = 6 for i in range(num_spheres): with tc.transform_scope(translate=(0.7 * (i - (num_spheres - 1) / 2.0), 0, 0)): r = 1.0 * i / (num_spheres - 1) r = r * r scene.add_mesh(tc.Mesh('sphere', tc.SurfaceMaterial('microfacet', color=(1, 1, 0.5), roughness=(0.01 + r, 0, 0, 0), f0=1), scale=0.3)) mesh = tc.Mesh('holder', tc.SurfaceMaterial('pbr', diffuse_map=tc.Texture.create_taichi_wallpaper(20)), translate=(0, -1, -3), scale=1, rotation=(0, 0, 0)) scene.add_mesh(mesh) envmap = tc.EnvironmentMap('base', filepath=tc.settings.get_asset_path('/envmaps/schoenbrunn-front_hd.hdr')) envmap.set_transform(tc.core.Matrix4(1.0).rotate_euler(tc.Vector(0, -30, 0))) scene.set_environment_map(envmap) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='microfacet', overwrite=True) renderer.initialize(preset='pt', scene=create_scene()) renderer.set_post_processor(tc.post_process.LDRDisplay(exposure=1.0, bloom_radius=0.05)) renderer.render(10000, 10)
fov=40, origin=(0, 10, 40), look_at=(0, 0, 0), up=(0, 1, 0)) scene = tc.Scene() with scene: scene.set_camera(camera) mesh = tc.Mesh( 'plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(0, 0, 0), scale=5, rotation=(0, 0, 0)) scene.add_mesh(mesh) #scene.add_mesh(tc.Mesh('plane', tc.SurfaceMaterial('pbr', diffuse=(1, 1, 1)), scale=20, # translate=(0, 0, 0), rotation=(90, 0, 0))) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='geometry', overwrite=True) renderer.initialize(preset='pt', scene=create_scene()) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=2, bloom_radius=0.0)) renderer.render(10000, 20)
tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(0, 10, 0), scale=2, rotation=(0, 0, 180)) scene.add_mesh(mesh) return scene if __name__ == '__main__': uw = tc.UnitWatcher(tc.settings.get_asset_path('units/sdf/mandelbulb.cpp')) while True: if uw.need_update(): renderer = None sdf = None gc.collect() uw.update() sdf = tc.core.create_sdf('mandelbulb_sdf') sdf_id = tc.core.register_sdf(sdf) renderer = tc.Renderer(output_dir='sdf', overwrite=True) renderer.initialize(preset='pt_sdf', max_path_length=4, scene=create_scene(), sdf=sdf_id, num_threads=1) renderer.set_post_processor( tc.post_process.LDRDisplay(bloom_radius=0.0)) renderer.render(1)
nested=tc.SurfaceMaterial( 'diffuse', color=colorsys.hls_to_rgb(i * 0.1 + 0.3, 0.3, 1.0))), translate=(i * 7 - 28, 3.5, -5), scale=3, rotation=(90, 0, 0))) # Lights scene.add_mesh( tc.Mesh( 'plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(0, 100, -200), scale=5, rotation=(180, 0, 0))) scene.add_mesh( tc.Mesh( 'plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(0, 100, 200), scale=3, rotation=(180, 0, 0))) return scene if __name__ == '__main__': renderer = tc.Renderer(scene=create_scene()) renderer.render()
rep = tc.Texture.create_taichi_wallpaper(10, rotation=0, scale=0.95) * tc.Texture('const', value=(0.5, 0.5, 1.0)) material = tc.SurfaceMaterial('pbr', diffuse_map=rep.id) scene.add_mesh(tc.Mesh('holder', material=material, translate=(0, -1.2, -5), scale=2)) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(-0.5 * dist, 0.7 * dist, 0.4 * dist), scale=0.01, rotation=(180, 0, 0)) scene.add_mesh(mesh) mesh = tc.Mesh('cube', tc.SurfaceMaterial( 'pbr', color=(1, 1, 1), specular=(1, 1, 1), transparent=True, ior=2.5, glossiness=-1), translate=(0, -0.5, 0), scale=0.4) scene.add_mesh(mesh) mesh = tc.Mesh('torus', tc.SurfaceMaterial( 'pbr', diffuse=(1, 0.5, 0)), translate=(0, -0.5, 0), scale=0.25, rotation=(90, 0, 0)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer('amcmcppm', 'tube_in_cube', overwrite=True) scene = create_scene() renderer.set_scene(scene) renderer.initialize(min_path_length=1, max_path_length=10, initial_radius=0.005, sampler='prand', russian_roulette=False, volmetric=True, direct_lighting=1, direct_lighting_light=1, direct_lighting_bsdf=1, envmap_is=1, mutation_strength=1, stage_frequency=3, num_threads=8, shrinking_radius=True) renderer.set_post_processor(tc.post_process.LDRDisplay(exposure=0.3, bloom_radius=0.00)) renderer.render(10000, 20)
for i in range(num_plates): fraction = -math.pi / 2 - 1.0 * i / num_plates * 0.9 z = math.cos(fraction) * 1 y = math.sin(fraction) * 1 + 0.5 board_position = tc.Vector(z, y) vec1 = eye_position - board_position vec2 = light_position - board_position vec1 *= 1.0 / math.hypot(vec1.x, vec1.y) vec2 *= 1.0 / math.hypot(vec2.x, vec2.y) half_vector = vec1 + vec2 angle = math.degrees(math.atan2(half_vector.y, half_vector.x)) mesh = tc.Mesh('plane', tc.SurfaceMaterial('pbr', diffuse=(0.1, 0.1, 0.1), specular=(1, 1, 1), glossiness=100 * 3**i), translate=(0, board_position.y, board_position.x), rotation=(90 - angle, 0, 0), scale=(0.4, 0.7, 0.05)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer() eye_position = tc.Vector(0.9, -0.3) renderer.initialize(preset='pt', scene=create_mis_scene(eye_position)) renderer.render()
translate=(0, -0.5, 0), scale=0.4) scene.add_mesh(mesh) mesh = tc.Mesh( 'torus', tc.SurfaceMaterial('pbr', diffuse=(1, 0.5, 0)), translate=(0, -0.5, 0), scale=0.25, rotation=(90, 0, 0)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer('amcmcppm', output_dir='tube_in_cube', overwrite=True) scene = create_scene() renderer.initialize( min_path_length=1, max_path_length=10, initial_radius=0.005, sampler='prand', russian_roulette=False, volmetric=True, direct_lighting=1, direct_lighting_light=1, direct_lighting_bsdf=1, envmap_is=1, mutation_strength=1, stage_frequency=3,
tc.Mesh('plane', tc.SurfaceMaterial('transparent', nested=tc.SurfaceMaterial('diffuse', color=(0, 1, 1)), mask=grid_tex), translate=(4.3, 0, 0.02), scale=3, rotation=(90, 0, 0))) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(-30, 30, 10), scale=6, rotation=(0, 0, -90)) scene.add_mesh(mesh) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(30, 0, 10), scale=2, rotation=(0, 0, 90)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='paper_cut', scene=create_scene()) renderer.render()
rotation=(-110, 45, 0)) scene.add_mesh(mesh) with tc.transform_scope(translate=(9, 10, -10), scale=(0.3, 1.3, 0.3), rotation=(88, -27, 0)): mesh = tc.Mesh( 'plane', tc.SurfaceMaterial('emissive', color=(100, 100, 10))) scene.add_mesh(mesh) surf = lambda p: tc.geometry.rotate_y( Vector(p.x * 3, p.x * p.x * 4 - 2, 0), p.y * 2 * pi) bowl = tc.geometry.create_mesh_from_functions((50, 50), surf) mesh = tc.Mesh(bowl, tc.SurfaceMaterial('diffuse', color=(0, 0, 0))) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='vaze', overwrite=True) renderer.initialize(preset='pt', scene=create_scene(), min_path_length=2, max_path_length=3) renderer.set_post_processor( tc.post_process.LDRDisplay(adaptive_exposure=False, exposure=1e3, bloom_radius=0.0)) renderer.render(10000, 20)
# Trees for i in range(-7, 7): for j in range(-7, 7): if -2 < i < 2 and -2 < j < 2: continue else: with tc.transform_scope(translate=(i * 4, 0, j * 4)): create_tree(scene) with tc.transform_scope(scale=(3, 3, 3)): create_tree(scene) # Light sources scene.add_mesh( tc.Mesh(tc.geometry.create_plane(), material=tc.SurfaceMaterial('emissive', color=(0.5, 1, 1)), scale=100, translate=(150, 100, -50), rotation=(180, 0, 0))) scene.add_mesh( tc.Mesh(tc.geometry.create_plane(), material=tc.SurfaceMaterial('emissive', color=(1, 1, 0.5)), scale=30, translate=(-50, 100, -50), rotation=(180, 0, 0))) renderer = tc.Renderer(scene=scene) renderer.render()
def render_frame(t): renderer = tc.Renderer() renderer.initialize(preset='pt', sampler='sobol', scene=create_scene(t)) renderer.set_post_processor(tc.post_process.LDRDisplay(exposure=1.0, bloom_radius=0.00)) renderer.render(spp) return renderer.get_output()
def render(): renderer = tc.Renderer(frame=0) renderer.initialize(scene=create_scene(), sampler='prand') renderer.render()
scale=0.1, rotation=(150, 0, 0)) scene.add_mesh(mesh) emission = 0.001 mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(emission, emission, emission)), translate=(0, 10, 0), scale=10, rotation=(180, 0, 0)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='gunter_rambow', overwrite=True) renderer.initialize(preset='pt', scene=create_scene(), min_path_length=2, max_path_length=4, luminance_clamping=0.01) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=1.5, bloom_radius=0.2, gamma=1.5, bloom_threshold=0.3)) renderer.render(10000, 20)
mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive_spot', color=(emission, emission, emission), exponential=100), translate=(10, 2, 1), scale=0.1, rotation=(0, 0, 100)) scene.add_mesh(mesh) for j in range(3): for i in range(14): with tc.transform_scope(translate=(i - 7, (random.random() - 0.5) * 0.4, j)): with tc.transform_scope(rotation=(0, 0, 10 - j * 10), translate=(0, -j * 0.3 + i * 0.04 - 0.4, 0)): s = random.random() * 0.5 + 0.8 r = random.random() if r < 0.5: shape = 'cube' else: shape = tc.geometry.create_cylinder((100, 2), smooth=False) mesh = tc.Mesh(shape, tc.SurfaceMaterial('diffuse', color=(0.3, 0.2, 0.1)), scale=(0.4 * s, 1 * s, 0.4 * s), rotation=(-4, -12, 0)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='shadows', overwrite=True) renderer.initialize(preset='pt', scene=create_scene(), min_path_length=2, max_path_length=4, luminance_clamping=0.1) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=0.2, bloom_radius=0.0, gamma=2.2)) renderer.render(10000, 20)
color=(0, 1, 1)), mask=grid_tex), translate=(4.3, 0, 0.02), scale=3, rotation=(90, 0, 0))) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(-30, 30, 10), scale=6, rotation=(0, 0, -90)) scene.add_mesh(mesh) mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(30, 0, 10), scale=2, rotation=(0, 0, 90)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='paper_cut', overwrite=True) renderer.initialize(preset='pt', scene=create_scene()) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=1.5, bloom_radius=0.1)) renderer.render(10000, 20)
for j in range(-7, 7): if -2 < i < 2 and -2 < j < 2: continue else: with tc.transform_scope(translate=(i * 4, 0, j * 4)): create_tree(scene) with tc.transform_scope(scale=(3, 3, 3)): create_tree(scene) # Light sources scene.add_mesh( tc.Mesh(tc.geometry.create_plane(), material=tc.SurfaceMaterial('emissive', color=(0.5, 1, 1)), scale=100, translate=(150, 100, -50), rotation=(180, 0, 0))) scene.add_mesh( tc.Mesh(tc.geometry.create_plane(), material=tc.SurfaceMaterial('emissive', color=(1, 1, 0.5)), scale=30, translate=(-50, 100, -50), rotation=(180, 0, 0))) renderer = tc.Renderer(preset='pt', output_dir='trees', scene=scene) renderer.set_post_processor(tc.post_process.LDRDisplay(exposure=4, gamma=1)) renderer.render(1000, 20)
scene.set_environment_map(envmap) return scene def dump_particles(): # Step 1: Write you particles to disk here. # For example, the following function creates a `particles.bin` generated using # taichi::write_vector_to_disk(*std::vector<taichi::RenderParticle>, "particles.bin") tc.core.test_volumetric_io() def create_volumetric_block(): fn = 'particles.bin' # or your file name... import os print(os.getcwd()) particles = tc.core.RenderParticles() assert particles.read(fn) # pls. use the same resolution as in the .bin file... res = (128, 128, 64) # 5 is the density tex = tc.Texture.from_render_particles(res, particles) * 15 with tc.transform_scope(scale=2): return tc.create_volumetric_block(tex, res=res) if __name__ == '__main__': dump_particles() renderer = tc.Renderer(overwrite=True, scene=create_scene()) renderer.render()
for i in range(10): scene.add_mesh( tc.Mesh(tc.geometry.create_mesh_from_functions( (50, 50), lambda p: Vector( p.x * 2 - 1, sin(p.x * 10 * pi) + cos(p.y * 5 * pi), p.y * 2 - 1)), material=tc.SurfaceMaterial('reflective', color=(1, 1, 1)), translate=(0, 1, -6), scale=(8, 0.2, 2))) envmap = tc.EnvironmentMap('base', filepath=tc.settings.get_asset_path( 'envmaps/schoenbrunn-front_hd.hdr')) envmap.set_transform( tc.core.Matrix4(1.0).rotate_euler(Vector(0, 30, 0))) scene.set_environment_map(envmap) return scene if __name__ == '__main__': renderer = tc.Renderer(output_dir='materials', overwrite=True) renderer.initialize(preset='pt', scene=create_scene(), luminance_clamping=1000) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=1, bloom_radius=0.0)) renderer.render(10000, 20)
'pbr', glossiness=0, transparent=True, ior=1.5, specular=(1, 0, 0)), scale=1, translate=(0, 1.5, -1))) scene.add_mesh( tc.Mesh( tc.geometry.create_sphere((30, 30)), material=tc.SurfaceMaterial( 'pbr', glossiness=0, specular=(1, 0.1, 0)), scale=1, translate=(2, 1.5, -1))) # Light sources scene.add_mesh( tc.Mesh( tc.geometry.create_plane(), material=tc.SurfaceMaterial('emissive', color=(0.5, 1, 1)), scale=0.1, translate=(0, 8, -9), rotation=(0, 0, 180))) renderer = tc.Renderer( preset='vcm', output_dir='sds', scene=scene, max_path_length=10) renderer.set_post_processor(tc.post_process.LDRDisplay(exposure=1, gamma=2.2)) renderer.render(1000, 20)
with tc.TransformScope(translate=(i, 0, 0)): for j in range(3): with tc.TransformScope(translate=(0, j, 0)): mesh = tc.Mesh( 'plane', tc.SurfaceMaterial('pbr', diffuse=(.1, .1, .1)), translate=(0, 0, -0.05), scale=0.4, rotation=(90.3, 0, 0)) scene.add_mesh(mesh) mesh = tc.Mesh( 'plane', tc.SurfaceMaterial('emissive', color=(1, 1, 1)), translate=(-30, 30, 10), scale=2, rotation=(0, 0, -90)) scene.add_mesh(mesh) return scene if __name__ == '__main__': renderer = tc.Renderer('scoping', overwrite=True) renderer.initialize(preset='pt', scene=create_scene()) renderer.set_post_processor( tc.post_process.LDRDisplay(exposure=0.5, bloom_radius=0.0)) renderer.render(10000, 20)