Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'pinhole',
res=(1500 // downsample, 600 // downsample),
fov=30,
origin=(0, 1, 20),
look_at=(0, 2, 0),
up=(0, 1, 0))
scene = tc.Scene()
with scene:
scene.set_camera(camera)
ground_tex = tc.Texture(
'image', filename=tc.get_asset_path('textures/paper.jpg'))
mesh = tc.Mesh(
'plane',
tc.SurfaceMaterial('pbr', diffuse_map=ground_tex),
translate=(0, 0, -5),
scale=10,
rotation=(90, 0, 0))
scene.add_mesh(mesh)
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(
def create_scene(frame, d, t):
downsample = output_downsample
width, height = 1280 / downsample, 720 / downsample
camera = Camera('pinhole', width=width, height=height, fov=30,
origin=(0, 0, 8), look_at=(0, 0, 0), up=(0, 1, 0))
scene = Scene()
with scene:
scene.set_camera(camera)
mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(30000, 40000, 60000)),
translate=(-20, 20, -15), scale=3, rotation=(0, 0, 180))
scene.add_mesh(mesh)
with tc.transform_scope(rotation=(10, 0, 0), translate=(0, 0, 0), scale=1):
with tc.transform_scope(rotation=(0, -40, 0), translate=(0, 0.5, 0), scale=1):
fn = d + r'/particles%05d.bin' % frame
mesh = create_mpm_sand_block(fn)
scene.add_mesh(mesh)
envmap_texture = Texture('spherical_gradient', inside_val=(10, 10, 10, 10), outside_val=(1, 1, 1, 0),
angle=10, sharpness=20)
envmap = EnvironmentMap('base', texture=envmap_texture.id, res=(1024, 1024))
scene.set_environment_map(envmap)
return scene
up=(0, 1, 0),
focus=(0, 0, 0),
aperture=0.08)
scene = tc.Scene()
dist = 100
with scene:
scene.set_camera(camera)
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,
def create_taichi_text():
text = 1 - tc.Texture(
'text',
content='Taichi',
width=200,
height=200,
font_file=tc.get_asset_path('fonts/go/Go-Bold.ttf'),
size=50,
dx=0,
dy=0)
mesh = tc.Mesh(
'plane',
tc.SurfaceMaterial(
'transparent',
nested=tc.SurfaceMaterial('diffuse', color=(1, 1, 1)),
mask=text),
translate=(5.0, 2, 0.05),
scale=2,
rotation=(90, 0, 0))
return mesh
width, height = 1280 / downsample, 720 / downsample
camera = Camera('pinhole', width=width, height=height, fov=25,
origin=(0, 0, 6), look_at=(0, 0, 0), up=(0, 1, 0))
# camera = Camera('pinhole', width=width, height=height, fov=30,
# origin=(2, 4, 4), look_at=(0, 0, 0), up=(0, 1, 0))
scene = Scene()
with scene:
scene.set_camera(camera)
with tc.transform_scope(rotation=(20, 0, 0), translate=(0, 0.75, 0), scale=1):
mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(30000, 40000, 60000)),
translate=(-20, 30, 0), scale=3, rotation=(0, 0, 180))
scene.add_mesh(mesh)
mesh = tc.Mesh('plane', tc.SurfaceMaterial('emissive', color=(6000, 8000, 12000)),
translate=(20, 30, 40), scale=3, rotation=(0, 0, -180))
scene.add_mesh(mesh)
material = SurfaceMaterial('diffuse', color=(0.24, 0.18, 0.12), f0=1)
scene.add_mesh(Mesh('cube', material=material, translate=(0, -1.01, 0), scale=(1, 0.02, 0.6)))
fn = d + r'/particles%05d.bin' % frame
mesh = create_mpm_snow_block(fn)
scene.add_mesh(mesh)
envmap_texture = Texture('spherical_gradient', inside_val=(10, 10, 10, 10), outside_val=(1, 1, 1, 0),
angle=10, sharpness=20)
envmap = EnvironmentMap('base', texture=envmap_texture.id, res=(1024, 1024))
scene.set_environment_map(envmap)
return scene
res = 960, 540
camera = tc.Camera(
'pinhole',
res=res,
fov=70,
origin=(0, eye_position.y, eye_position.x),
look_at=(0, -0.3, 0),
up=(0, 1, 0))
scene = tc.Scene()
with scene:
scene.set_camera(camera)
rep = tc.Texture.create_taichi_wallpaper(20, rotation=0, scale=0.95)
material = tc.SurfaceMaterial('pbr', diffuse_map=rep.id)
scene.add_mesh(
tc.Mesh('holder', material=material, translate=(0, -1, -7), scale=2))
for i in range(num_light_sources):
radius = 0.002 * 3**i
e = 0.01 / radius**2
material = tc.SurfaceMaterial('emissive', color=(e, e, e))
mesh = tc.Mesh(
'sphere',
material,
translate=(0.2 * (i - (num_light_sources - 1) * 0.5),
light_position.y, light_position.x),
scale=radius)
scene.add_mesh(mesh)
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
# Spheres
scene.add_mesh(
tc.Mesh(
tc.geometry.create_sphere((30, 30)),
material=tc.SurfaceMaterial(
'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(
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)))
translate=(0.20, 3.3, 0),
scale=0.4,
rotation=(90, 0, 0))
scene.add_mesh(mesh)
with tc.transform_scope(translate=(0, 1, 0), rotation=(0, -20, 0)):
grid_tex = (1 - tc.Texture('rect', bounds=(0.8, 0.8, 1.0))).repeat(
5, 5, 1)
tex = tc.Texture(
'image', filename=tc.get_asset_path('textures/paper.jpg'))
material = tc.SurfaceMaterial(
'transparent',
nested=tc.SurfaceMaterial('reflective', color_map=tex),
mask=grid_tex)
for i in range(1):
mesh = tc.Mesh(
'plane',
material,
translate=(0, 0.4, -i * 0.3),
scale=(1, 1, 1.4),
rotation=(90, 0, 0))
scene.add_mesh(mesh)
mesh = tc.Mesh(
'plane',
tc.SurfaceMaterial('emissive', color=(9, 9, 9)),
translate=(1, 3, -4),
scale=0.1,
rotation=(150, 0, 0))
scene.add_mesh(mesh)
emission = 0.001
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)
fp = tc.settings.get_asset_path('envmaps/schoenbrunn-front_hd.hdr')
envmap = tc.EnvironmentMap('base', filepath=fp)
envmap.set_transform(
tc.core.Matrix4(1.0).rotate_euler(tc.Vector(0, -30, 0)))
scene.set_environment_map(envmap)
return scene