Beispiel #1
0
def create_scene():
    downsample = 1
    width, height = 900 / downsample, 600 / downsample
    camera = tc.Camera('pinhole', width=width, height=height, fov=60,
                       origin=(0, 10, 0), look_at=(0, 0, 0), up=(0, 0, -1))

    scene = tc.Scene()

    with scene:
        scene.set_camera(camera)

        text_tex = tc.Texture('image', filename=tc.get_asset_path('textures/graphic_design.png'))

        for i in range(3):
            with tc.transform_scope(translate=(0, 0.101, 0), scale=(8, 4, 0.2), rotation=(-90, 0, 0)):
                with tc.transform_scope(scale=1 ** i):
                    mesh = tc.create_volumetric_block(text_tex * 8, res=(512, 256, 4))
                    scene.add_mesh(mesh)

        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
Beispiel #2
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))
def create_scene():
  res = 1280, 720
  camera = tc.Camera(
      'pinhole',
      res=res,
      fov=30,
      origin=(4, 0, 15),
      look_at=(0, 0, 0),
      up=(0, 1, 0))

  scene = tc.Scene()
  with scene:
    scene.set_camera(camera)

    emission = 100000
    mesh = tc.Mesh(
        'plane',
        tc.SurfaceMaterial('emissive', color=(emission, emission, emission)),
        translate=(300, 200, 300),
        scale=30,
        rotation=(-90, 0, 0))
    scene.add_mesh(mesh)

    material = tc.SurfaceMaterial(
        'diffuse', color=(0.5, 1, 1), roughness=1.0, f0=1)
    scene.add_mesh(
        tc.Mesh(
            'cube', material=material, translate=(0, 0, -2.0), scale=(1, 1, 1)))

    material = tc.SurfaceMaterial(
        'diffuse', color=(1, 0.5, 1), roughness=1.0, f0=1)
    scene.add_mesh(
        tc.Mesh(
            'cube', material=material, translate=(0, -2.0, 0), scale=(1, 1, 1)))

    material = tc.SurfaceMaterial(
        'diffuse', color=(1, 1, 0.5), roughness=1.0, f0=1)
    scene.add_mesh(
        tc.Mesh(
            'cube', material=material, translate=(-2.0, 0, 0), scale=(1, 1, 1)))

    envmap_texture = tc.Texture(
        'spherical_gradient',
        inside_val=(10, 10, 10, 10),
        outside_val=(1, 1, 1, 0),
        angle=10,
        sharpness=20)
    envmap = tc.EnvironmentMap('base', texture=envmap_texture.id, res=(1024, 1024))
    scene.set_environment_map(envmap)

    vol_tex = tc.Texture('sphere', center=(0.5, 0.5, 0.5), radius=0.5)
    for i in range(3):
      with tc.transform_scope(translate=(i, 0, 0)):
        with tc.transform_scope(scale=1**i):
          mesh = tc.create_volumetric_block(vol_tex, res=(32, 32, 32))
          scene.add_mesh(mesh)

  return scene
Beispiel #4
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))
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)