def add_solar_system(): sphere = ray_tracer.create_sphere() table = ray_tracer.create_square_with_picture('sky.jpg', Materials.cloth, (-20, -10, -20), 150, (0, 1, 0)) # table = ray_tracer.create_square_with_picture('table2.jpg', Materials.cloth, (-20, 200, -20), 150, (0, -1, 0)) global sun sun = ray_tracer.create_object(sphere, Materials.sun, (-200, 100, -80), 40) ray_tracer.rotate_view_port((0, 1, 0), 0.5) ray_tracer.rotate_view_port((1, 0, 0), 0.6) ray_tracer.move_view_port((-11, 0, 0)) ray_tracer.move_view_port((0, 4, 0)) ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 3.5 ray_tracer.c_focus = (0, -10, 0) ray_tracer.c_viewPortRatio = 7.5 ray_tracer.move_view_port((-3, 1, 100)) ray_tracer.move_view_port((-3.7, 14, 0)) ray_tracer.create_object(sphere, Materials.sun_weak, (0, 0, 0), 3) planets = [] planets.append(ray_tracer.create_object(sphere, Materials.silver, (8, 0, 0), 1.5)) planets.append(ray_tracer.create_object(sphere, Materials.gold, (11, 0, 0), 0.4)) planets.append(ray_tracer.create_object(sphere, Materials.ice, (14, 0, 0), 1.8)) planets.append(ray_tracer.create_object(sphere, Materials.green, (18, 0, 0), 0.9)) return planets
def init(): ray_tracer.c_screenWidth, ray_tracer.c_screenHeight = tracer.screen_width, tracer.screen_height ray_tracer.c_maxDepth = 8 ray_tracer.c_numThreads = 8 ray_tracer.c_ambient_strength = 0.0 ray_tracer.c_specular_index = 50 ray_tracer.c_super_sample_threshold = 0.0 ray_tracer.c_smooth_normal = 0 ray_tracer.c_fixed_sample = 0 ray_tracer.initialize() ray_tracer.c_viewPortRatio = 2.5 ray_tracer.move_view_port((0, 0, 40))
def test_bias(): sphere = ray_tracer.create_sphere() plane = ray_tracer.create_plane() ray_tracer.create_object(plane, Materials.wall, (6, 0, 0), 1, (-1, 0, 1)) ray_tracer.create_object(plane, Materials.wall, (0, 0, -10), 1, (0, 0, 1)) ray_tracer.create_object(sphere, Materials.strong_sun, (-8, 0, 4), 1) mesh = ray_tracer.create_mesh(filename='meshes/shape.obj', compress=1) tri = ray_tracer.create_object(mesh, Materials.brick, (-1, 0, 4), 3) ray_tracer.rotate(tri, (1, 0, 0), math.pi / 2) ray_tracer.rotate(tri, (0, 0, 1), 1.6) ray_tracer.c_global_decay = 0.0 ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 0.0 ray_tracer.c_viewPortRatio = 7.5 ray_tracer.move_view_port((5, 0, 0))
def add_table(): sphere = ray_tracer.create_sphere() global sun sun = ray_tracer.create_object(sphere, Materials.sun, (-300, 200, -100), 100) ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0)) table = ray_tracer.create_square_with_picture('table2.jpg', Materials.cloth, (-20, -10, -20), 150, (0, 1, 0)) ray_tracer.move(table, (40, 0, -5)) mesh = ray_tracer.create_mesh(filename='meshes/Espresso_Cup.obj', compress=1) ray_tracer.create_object(mesh, Materials.china, (0, -10, 0), 2.3) mesh = ray_tracer.create_mesh(filename='meshes/spoon/spoon.obj', compress=1) spoon = ray_tracer.create_object(mesh, Materials.ice, (10, -10.2, 20), .15) ray_tracer.rotate(spoon, (0, 0, 1), 0.04) ray_tracer.rotate(spoon, (0, 1, 0), 0.2) ray_tracer.move(spoon, (1, 0, 0)) ray_tracer.rotate_view_port((0, 1, 0), 0.5) ray_tracer.rotate_view_port((1, 0, 0), 0.3) ray_tracer.move_view_port((-11, 0, 0)) ray_tracer.move_view_port((0, 4, 0)) ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 2.5 ray_tracer.c_focus = (0, -10, 0) ray_tracer.c_viewPortRatio = 7.5 ray_tracer.move_view_port((-3, 1, 100))
def add_mesh_table(): sphere = ray_tracer.create_sphere() ray_tracer.create_object(sphere, Materials.sun, (-50, 100, -100), 55) plane = ray_tracer.create_plane() ray_tracer.create_object(plane, Materials.wall, (-1000, 0, 0), 1, (1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (1000, 0, 0), 1, (-1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (0, 0, -1000), 1, (0, 0, 1)) # ray_tracer.create_object(plane, Materials.wall, (0, 0, 4000000), 1, (0, 0, -1)) ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0)) table = ray_tracer.create_square_with_picture('sea.jpg', Materials.cloth, (20, -10, -20), 150, (0, 1, 0)) ray_tracer.set_velocity(table, (10, 0, 0)) ray_tracer.move(table, (-5, 0, -5)) mesh = ray_tracer.create_mesh(filename='meshes/fixed.perfect.dragon.100K.0.07.obj', compress=1) dragon = ray_tracer.create_object(mesh, Materials.red_ice, (6, 0, 6), 14) ray_tracer.c_global_decay = 0.0 # exit() ray_tracer.rotate_view_port((0, 1, 0), 0.5) ray_tracer.rotate_view_port((1, 0, 0), 0.4) ray_tracer.move_view_port((-11, 0, 0)) ray_tracer.move_view_port((0, 4, 0)) ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 0.5 ray_tracer.c_focus = (1, 7, 11) ray_tracer.c_viewPortRatio = 11.5 ray_tracer.move_view_port((0, 2, 100))
def add_mesh_table(): sphere = ray_tracer.create_sphere() ray_tracer.create_object(sphere, Materials.sun, (-50, 100, -100), 55) plane = ray_tracer.create_plane() ray_tracer.create_object(plane, Materials.wall, (-1000, 0, 0), 1, (1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (1000, 0, 0), 1, (-1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (0, 0, -1000), 1, (0, 0, 1)) # ray_tracer.create_object(plane, Materials.wall, (0, 0, 4000000), 1, (0, 0, -1)) ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0)) table = ray_tracer.create_square_with_picture('sea.jpg', Materials.cloth, (20, -10, -20), 150, (0, 1, 0)) ray_tracer.set_velocity(table, (10, 0, 0)) ray_tracer.move(table, (-5, 0, -5)) import random for i in range(0): # ball = ray_tracer.create_object(sphere, Materials.china, (6, 1 + 2 * random.random(), 6 + 2 * random.random()), # 1 * (1.0 + random.random())) ball = ray_tracer.create_object(sphere, Materials.silver, (6 + 30 * random.random(), 1 + 10 * random.random(), 4 + 30 * random.random()), 0.5 * (1.0 + random.random())) ray_tracer.set_velocity(ball, (5, 0, 0)) mesh = ray_tracer.create_mesh(filename='meshes/fixed.perfect.dragon.100K.0.07.obj', compress=1) dragon = ray_tracer.create_object(mesh, Materials.red_ice, (6, 0, 6), 14) # ray_tracer.move(mesh, (6, 0, 6)) # spoon = ray_tracer.create_object(mesh, Materials.red_ice, (1, 0.3, 12), 14.2) # spoon = ray_tracer.create_object(sphere, Materials.red_ice, (0, 0, 0), 4) # mesh = ray_tracer.create_mesh(nilename='meshes/fixed.perfect.dragon.100K.0.07.obj') # spoon = ray_tracer.create_object(sphere, Materials.blue_ice, (6, 0, 6), 6) # ray_tracer.rotate(spoon, (0, 0, 1), 0.04) # ray_tracer.rotate(spoon, (0, 1, 0), 0.2) ray_tracer.c_global_decay = 0.0 # exit() ray_tracer.rotate_view_port((0, 1, 0), 0.5) ray_tracer.rotate_view_port((1, 0, 0), 0.3) ray_tracer.move_view_port((-11, 0, 0)) ray_tracer.move_view_port((0, 4, 0)) ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 0.5 ray_tracer.c_focus = (1, 7, 11) ray_tracer.c_viewPortRatio = 7.5 ray_tracer.move_view_port((0, 2, 100))
def add_mesh_table(): sphere = ray_tracer.create_sphere() ray_tracer.create_object(sphere, Materials.sun, (-50, 100, -100), 55) plane = ray_tracer.create_plane() ray_tracer.create_object(plane, Materials.wall, (-1000, 0, 0), 1, (1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (1000, 0, 0), 1, (-1, 0, 0)) ray_tracer.create_object(plane, Materials.wall, (0, 0, -1000), 1, (0, 0, 1)) # ray_tracer.create_object(plane, Materials.wall, (0, 0, 4000000), 1, (0, 0, -1)) ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0)) table = ray_tracer.create_square_with_picture('sea.jpg', Materials.cloth, (20, -10, -20), 150, (0, 1, 0)) ray_tracer.set_velocity(table, (10, 0, 0)) ray_tracer.move(table, (-5, 0, -5)) mesh = ray_tracer.create_mesh( filename='meshes/fixed.perfect.dragon.100K.0.07.obj', compress=1) dragon = ray_tracer.create_object(mesh, Materials.red_ice, (6, 0, 6), 14) ray_tracer.c_global_decay = 0.0 # exit() ray_tracer.rotate_view_port((0, 1, 0), 0.5) ray_tracer.rotate_view_port((1, 0, 0), 0.4) ray_tracer.move_view_port((-11, 0, 0)) ray_tracer.move_view_port((0, 4, 0)) ray_tracer.c_color_gamma = 1.0 / 2.2 ray_tracer.c_apertureRadius = 0.5 ray_tracer.c_focus = (1, 7, 11) ray_tracer.c_viewPortRatio = 11.5 ray_tracer.move_view_port((0, 2, 100))