right.material.color = color(0.5, 1, 0.1) right.material.diffuse = 0.7 right.material.specular = 0.3 right.material.reflective = 0.15 right.material.pattern = ring_pattern(color(0.2, 0.5, 0.7), color(0.8, 0.8, 0.2)) w.objects.append(right) left = sphere() left.transform = translation(-1.5, 0.33, -0.75) * scaling(0.33, 0.33, 0.33) left.material = material() left.material.color = color(1, 0.8, 0.1) left.material.diffuse = 0.7 left.material.specular = 0.3 left.material.reflective = 0.1 left.material.pattern = gradient_pattern(color(0.7, 0.5, 0.7), color(0, 0.8, 0.2)) w.objects.append(left) cam = camera(1600, 800, pi / 2) cam.transform = view_transform(point(0, 1.5, -5), point(0, 1, 0), vector(0, 1, 0)) canvas = render(cam, w) end = time.time() print("Finished render.") print(str(round(end - start, 2)) + "s") start = time.time() print("Start writing file...") canvas_to_ppm(canvas).write_file("images/reflections.ppm")
def step_impl(context): context.pattern = gradient_pattern(context.white, context.black)