예제 #1
0
def create_mpm_sand_block(fn):
    particles = tc_core.RenderParticles()
    assert particles.read(fn)
    downsample = grid_downsample
    tex = Texture.from_render_particles((255 / downsample, 255 / downsample, 255 / downsample), particles) * 5
    # tex = Texture('sphere', center=(0.5, 0.5, 0.5), radius=0.5)
    with tc.transform_scope(scale=2):
        return tc.create_volumetric_block(tex, res=(128, 128, 128))
예제 #2
0
def create_mpm_snow_block(fn):
    particles = tc_core.RenderParticles()
    assert particles.read(fn)
    downsample = grid_downsample
    tex = Texture.from_render_particles(
        (511 / downsample, 127 / downsample, 255 / downsample), particles) * 5
    # tex = Texture('sphere', center=(0.5, 0.5, 0.5), radius=0.5)
    with tc.transform_scope(translate=(0, -0.75, 0), scale=(2, 0.5, 1)):
        return tc.create_volumetric_block(tex, res=(256, 256, 256))
예제 #3
0
def create_mpm_snow_block(fn):
    particles = tc_core.RenderParticles()
    assert particles.read(fn)
    tex = Texture.from_render_particles((grid_x, grid_y, grid_z), particles) * 5
    mesh_transform = tc_core.Matrix4(1.0).scale_s(0.3).translate(Vector(0.5, 0.5, 0.5))
    transform = tc_core.Matrix4(1.0).scale_s(2).scale(Vector(2.0, 0.5, 1.0)).translate(Vector(-2, -0.99, -1))
    vol = VolumeMaterial('sdf_voxel', scattering=5, absorption=0, tex=tex, resolution=(grid_x, grid_y, grid_z),
                         transform_ptr=transform.get_ptr_string())
    material = SurfaceMaterial('plain_interface')
    material.set_internal_material(vol)
    return Mesh('cube', material=material, transform=transform * mesh_transform)
예제 #4
0
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 = Texture.from_render_particles(res, particles) * 15
    with tc.transform_scope(scale=2):
        return tc.create_volumetric_block(tex, res=res)