yield sphere(center, 0.2, material) yield from [ sphere((0, 1, 0), 1, dielectric(1.5)), sphere((-4, 1, 0), 1, matte((.4, .2, .1))), sphere((4, 1, 0), 1, metallic((.7, .6, .5))), ] def scene(): seed(0xDEADBEEF) ground = sphere((0, -1000, 0), 1000, metallic((0.5, 0.5, 0.5))) return [bvh_node(spheres()), ground] def config(spx): return { 'width': 600, 'height': 450, 'samples_per_px': spx, 'rays_per_sample': 50, 'ambiant_color': (0.5, 0.7, 0.9), 'camera': { 'look_at': (0, 0, 0), 'look_from': (10, 2, 4), }, } render(scene(), **config(25))
spheres = [ sphere( center=(-50 + i * 50, 20, 0), radius=20, material=matte(color), ) for i, color in enumerate((red, green, blue)) ] ground = sphere( center=(0, -1000, 0), radius=1000, material=metallic(white), ) return spheres + [ground] def config(spx): return { 'samples_per_px': spx, 'ambiant_color': (0.5, 0.7, 0.9), 'camera': { 'look_at': (0, 0, 0), 'look_from': (150, 100, 200), } } render(scene(), **config(100))
rect(y=(0, 600), z=(-1000, 600), x=600, material=matte(red)).flip_normals(), rect(y=(0, 600), z=(-1000, 600), x=0, material=dielectric(1.5)), # ceiling + light rect(x=(0, 600), z=(-1000, 600), y=600, material=matte(white)).flip_normals(), rect(x=(100, 500), z=(100, 900), y=599, material=diffuse_color((7, 7, 7))), # floor rect(x=(0, 600), z=(-1000, 600), y=0, material=matte(green)), # front rect(x=(0, 600), y=(0, 600), z=600, material=matte(white)).flip_normals(), # back rect(x=(0, 600), y=(0, 600), z=-1000, material=matte(white)), ] config = { "width": 400, "height": 400, "samples_per_px": 30, "rays_per_sample": 10, "ambiant_color": (0, 0, 0), "camera": { 'look_at': (300, 300, 0), 'look_from': (300, 300, -800) } } render(cornell_box + spheres, **config)