def create_scene():
  camera = tc.Camera(
      'pinhole',
      res=(512, 512),
      fov=120,
      origin=(0, -5, 10),
      look_at=(0, 0, 0),
      up=(0, 1, 0))

  scene = tc.Scene()
  with scene:
    scene.set_camera(camera)
    tex = tc.Texture.create_taichi_wallpaper(20, rotation=0, scale=0.95) * 0.9
    material = tc.SurfaceMaterial(
        'microfacet', color=(1.0, 1, 0.8), roughness_map=tex.id, f0=1)
    for i in range(-7, 5):
      scene.add_mesh(
          tc.Mesh(
              'sphere',
              material=material,
              translate=(i, -i * 1.6, -math.sin(i * 0.1)),
              scale=0.7))

    envmap_texture = tc.Texture('sky', height=0.5, direction=0.3)
    envmap_texture.show(res=(500, 500), post_processor=tc.post_process.LDRDisplay())
    envmap = tc.EnvironmentMap('base', texture=envmap_texture.id, res=(1024, 1024))
    scene.set_environment_map(envmap)
  return scene
Esempio n. 2
0
def create_scene():
    downsample = 1
    width, height = 960 / downsample, 540 / downsample
    camera = tc.Camera('pinhole', width=width, height=height, fov=50,
                       origin=(0, 2, 5), look_at=(0, 0, 0), up=(0, 1, 0))

    scene = tc.Scene()

    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
Esempio n. 3
0
def create_scene(t):
    res = 960 // downsample, 540 // downsample
    camera = tc.Camera('thinlens',
                       res=res,
                       fov=50,
                       aperture=1,
                       focus=(0, 0, 0),
                       origin=(0, 0, 100),
                       look_at=(0, -0.5, 0),
                       up=(0, 1, 0))

    scene = tc.Scene()

    with scene:
        scene.set_camera(camera)

        for p in particles:
            scene.add_mesh(p.create_mesh(t))

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

  scene = tc.Scene()
  with scene:
    scene.set_camera(camera)
    tex = tc.Texture.create_taichi_wallpaper(20, rotation=0, scale=0.95) * 0.9

    mesh = tc.Mesh(
        'plane',
        tc.SurfaceMaterial('emissive', color=(6000, 6000, 10000)),
        translate=(30, 20, 30),
        scale=3,
        rotation=(0, 0, 180))
    scene.add_mesh(mesh)

    with tc.transform_scope(rotation=(0, 0, 0), scale=1):
      material = tc.SurfaceMaterial(
          'diffuse', color=(0.3, 0.2, 0.3), roughness_map=tex.id, f0=1)
      scene.add_mesh(
          tc.Mesh(
              'cube',
              material=material,
              translate=(0, -1, 0),
              scale=(2, 0.02, 1)))
      for i in range(7):
        material = tc.SurfaceMaterial(
            'diffuse',
            color=colorsys.hsv_to_rgb(i * 0.2, 0.5, 1.0),
            roughness_map=tex.id,
            f0=1)
        scene.add_mesh(
            tc.Mesh(
                'cube',
                material=material,
                translate=(2, 0.3 * (i - 3), 0.2),
                scale=(0.01, 0.10, 0.5)))
      material = tc.SurfaceMaterial(
          'diffuse', color=(0.3, 0.3, 0.3), roughness_map=tex.id, f0=1)
      scene.add_mesh(
          tc.Mesh(
              'cube',
              material=material,
              translate=(0, 0, -1),
              scale=(1.9, 0.9, 0.03)))

      with tc.transform_scope(rotation=(0, 30, 0), translate=(0, 0, 0)):
        scene.add_mesh(create_volumetric_block())

    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)
  return scene
Esempio n. 6
0
def create_scene():
    downsample = 1
    width, height = 960 / downsample, 540 / downsample
    camera = tc.Camera('thinlens',
                       width=width,
                       height=height,
                       fov=40,
                       origin=(0, 20, 40),
                       look_at=(0, 1, 0),
                       up=(0, 1, 0),
                       aperture=0.3)

    scene = tc.Scene()

    base_mesh = tc.geometry.create_sphere((50, 50), smooth=True)

    materials = [
        tc.SurfaceMaterial('diffuse', color=(1, 0, 0)),
        tc.SurfaceMaterial('diffuse', color=(0, 1, 0)),
        tc.SurfaceMaterial('diffuse', color=(0, 0, 1)),
        tc.SurfaceMaterial('reflective', color=(1, 1, 1)),
        tc.SurfaceMaterial('glossy', color=(1, 1, 1), glossiness=(10, 10, 10)),
        tc.SurfaceMaterial('refractive', color=(1, 1, 1), ior=2.5),
        tc.SurfaceMaterial('pbr',
                           diffuse=(1, 0, 0),
                           specular=(0, 1, 0),
                           glossiness=(100, 0, 0)),
    ]

    with scene:
        scene.set_camera(camera)

        for i, mat in enumerate(materials):
            scene.add_mesh(
                tc.Mesh(base_mesh,
                        mat,
                        translate=((i - (len(materials) - 1) / 2) * 3, 1.3, 0),
                        scale=1))

        # Ground
        tex = (((tc.Texture('perlin') + 1) * 6).zoom(
            (0.6, 0.6, 0.6))).fract() * (1.0, 0.7, 0.4)
        scene.add_mesh(
            tc.Mesh('plane',
                    tc.SurfaceMaterial('pbr', diffuse_map=tex),
                    scale=200,
                    translate=(0, 0, 0),
                    rotation=(0, 0, 0)))

        # Board
        gradient = tc.Texture('uv', coeff_u=1, coeff_v=0)

        scene.add_mesh(
            tc.Mesh('plane',
                    tc.SurfaceMaterial('pbr',
                                       diffuse_map=gradient,
                                       specular_map=1 - gradient),
                    scale=(10, 1, 1),
                    translate=(0, 0.3, 2),
                    rotation=(0, 0, 0)))

        scene.add_mesh(
            tc.Mesh('plane',
                    tc.SurfaceMaterial('glossy',
                                       color=(1, 1, 1),
                                       glossiness_map=gradient * 100),
                    scale=(10, 1, 1),
                    translate=(0, 0.3, 4.5),
                    rotation=(0, 0, 0)))

        scene.add_mesh(
            tc.Mesh('plane',
                    tc.SurfaceMaterial('pbr',
                                       diffuse_map=gradient * (1, 0, 0) +
                                       (1 - gradient) * (0, 1, 1)),
                    scale=(10, 1, 1),
                    translate=(0, 0.3, 7),
                    rotation=(0, 0, 0)))

        scene.add_mesh(
            tc.Mesh('plane',
                    tc.SurfaceMaterial('transparent',
                                       mask=gradient,
                                       nested=tc.SurfaceMaterial('diffuse',
                                                                 color=(1, 1,
                                                                        1))),
                    scale=(10, 1, 1),
                    translate=(0, 0.3, 9.5),
                    rotation=(0, 0, 0)))

        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