def render_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_scene(frame, d, t), sampler='prand', max_path_length=3) renderer.set_post_processor( LDRDisplay(exposure=1, bloom_radius=0.00, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -25, 0), async=True, num_threads=8, strength_dt_mul=4) tex = Texture('mesh', resolution=resolution, filename=tc.get_asset_path('meshes/armadillo.obj')) * 8 tex = tex.zoom((0.4, 0.4, 0.4), (0.5, 0.5, 0.5), False) # tex = Texture('rotate', tex=tex, rotate_axis=0, rotate_times=1) tex = Texture('rotate', tex=tex, rotate_axis=1, rotate_times=2) # tex = Texture('rotate', tex=tex, rotate_axis=2, rotate_times=1) mpm.add_particles(density_tex=tex.id, initial_velocity=(0, 0, -50)) levelset = mpm.create_levelset() levelset.add_cuboid((0.01, 0.01, 0.01), (0.99, 0.99, 0.99), True)
sampler='prand') renderer.set_post_processor( LDRDisplay(exposure=0.6, bloom_radius=0.0, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (432 / downsample, 144 / downsample, 432 / downsample) tex = Texture('ring', outer=0.15) * 2 tex = Texture('bound', tex=tex, axis=2, bounds=(0.0, 0.8), outside_val=(0, 0, 0)) tex = Texture('rotate', tex=tex, rotate_axis=0, rotate_times=1) mpm = MPM3(resolution=resolution, gravity=(0, -100, 0), initial_velocity=(0, 0, 0), delta_t=0.0005, num_threads=8, density_tex=tex.id) for i in range(step_number): print 'process(%d/%d)' % (i, step_number) mpm.step(0.01) if gi_render: d = mpm.get_directory() if i % 20 == 0: render_sand_frame(i, d) mpm.make_video()
def render_sand_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_sand_scene(frame, d, t), sampler='prand') renderer.set_post_processor( LDRDisplay(exposure=0.6, bloom_radius=0.0, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -100, 0), delta_t=0.001, num_threads=8) levelset = mpm.create_levelset() levelset.add_plane(0, 1, 0, -1) levelset.add_plane(1, 1, 0, -1.7) levelset.global_increase(1) tex = Texture('levelset3d', levelset=levelset, bounds=(0, 0.05 / levelset.get_delta_x())) * 6 tex = Texture('bound', tex=tex, axis=2, bounds=(0.45, 0.55), outside_val=(0, 0, 0)) tex = Texture('bound',
return scene def render_sand_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_sand_scene(frame, d, t), sampler='prand') renderer.set_post_processor(LDRDisplay(exposure=0.6, bloom_radius=0.0, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -20, 0), base_delta_t=0.001, num_threads=1, use_mpi=use_mpi) levelset = mpm.create_levelset() levelset.add_plane(0, 1, 0, -1) levelset.add_plane(1, 1, 0, -1.7) levelset.global_increase(1) tex = Texture('levelset3d', levelset=levelset, bounds=(0, 0.04 / levelset.get_delta_x())) * 6 tex = Texture('bound', tex=tex, axis=2, bounds=(0.33, 0.66), outside_val=(0, 0, 0)) tex = Texture('bound', tex=tex, axis=0, bounds=(0.05, 1.0), outside_val=(0, 0, 0)) mpm.add_particles(density_tex=tex.id, initial_velocity=(0, 0, 0), compression=1.09) tex_ball = Texture('sphere', center=(0.12, 0.40, 0.5), radius=0.06) * 10 mpm.add_particles(density_tex=tex_ball.id, initial_velocity=(0, 0, 0), compression=0.95) levelset.set_friction(1) mpm.set_levelset(levelset, False)
def render_sand_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_sand_scene(frame, d, t), sampler='prand') renderer.set_post_processor( LDRDisplay(exposure=0.6, bloom_radius=0.0, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -10, 0), base_delta_t=0.0005, num_threads=8) # tex = Texture('ring', outer=0.15) * 4 # tex = Texture('bound', tex=tex, axis=2, bounds=(0.0, 0.4), outside_val=(0, 0, 0)) # tex = Texture('rotate', tex=tex, rotate_axis=0, rotate_times=1) tex = Texture('mesh', resolution=resolution, filename=tc.get_asset_path('meshes/suzanne.obj')) * 8 tex = tex.zoom((0.5, 0.5, 0.5), (0.5, 0.5, 0.5), False) # tex = Texture('rotate', tex=tex, rotate_axis=1, rotate_times=1) mpm.add_particles(density_tex=tex.id, initial_velocity=(0, 0, 0)) # Dynamic Levelset def levelset_generator(t): levelset = mpm.create_levelset()
def render_sand_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_sand_scene(frame, d, t), sampler='prand') renderer.set_post_processor( LDRDisplay(exposure=0.6, bloom_radius=0.0, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -10, 0), base_delta_t=0.000001, async=True, num_threads=8) tex = Texture('ring', outer=0.15) * 8 tex = Texture('bound', tex=tex, axis=2, bounds=(0.0, 0.4), outside_val=(0, 0, 0)) tex = Texture('rotate', tex=tex, rotate_axis=0, rotate_times=1) mpm.add_particles(density_tex=tex.id, initial_velocity=(0, 0, 0)) # Dynamic Levelset def levelset_generator(t):
return scene def render_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_scene(frame, d, t), sampler='prand', max_path_length=3) renderer.set_post_processor(LDRDisplay(exposure=1, bloom_radius=0.00, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -10, 0), async=True, num_threads=8, strength_dt_mul=4, affine_damping=1000) # real theta_c = 2.5e-2f, theta_s = 7.5e-3f; tex_ball1 = Texture('sphere', center=(0.41, 0.23, 0.5), radius=0.08) * 1 tex_ball1 = tex_ball1 * (Texture('perlin') * 6 + 2) mpm.add_particles(density_tex=tex_ball1.id, initial_velocity=(200, 5, 0), compression=1.0, mu_0=3e5, lambda_0=3e5) tex_ball2 = Texture('sphere', center=(0.59, 0.2, 0.5), radius=0.08) * 1 tex_ball2 = tex_ball2 * (Texture('perlin') * 6 + 2) mpm.add_particles(density_tex=tex_ball2.id, initial_velocity=(-200, 5, 0), compression=1.0, mu_0=3e5, lambda_0=3e5) levelset = mpm.create_levelset()
return scene def render_frame(frame, d, t): renderer = Renderer(output_dir='volumetric', overwrite=True, frame=frame) renderer.initialize(preset='pt', scene=create_scene(frame, d, t), sampler='prand', max_path_length=3) renderer.set_post_processor(LDRDisplay(exposure=1, bloom_radius=0.00, bloom_threshold=1.0)) renderer.render(render_epoch) if __name__ == '__main__': downsample = grid_downsample resolution = (255 / downsample, 255 / downsample, 255 / downsample) mpm = MPM3(resolution=resolution, gravity=(0, -50, 0), async=False, base_delta_t=0.0002, num_threads=8, strength_dt_mul=4) tex = Texture('mesh', resolution=resolution, filename=tc.get_asset_path('meshes/bunny.obj')) tex = tex.zoom((0.4, 0.4, 0.4), (0.5, 0.5, 0.5), False) tex = Texture('rotate', tex=tex, rotate_axis=0, rotate_times=1) tex = tex * (Texture('perlin').zoom((10, 10, 10)) * 6 + 2) mpm.add_particles(density_tex=tex.id, initial_velocity=(0, 0, -50)) levelset = mpm.create_levelset() levelset.add_cuboid((0.01, 0.01, 0.01), (0.99, 0.99, 0.99), True) mpm.set_levelset(levelset) t = 0 for i in range(step_number): print 'process(%d/%d)' % (i, step_number)