diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/TRAK.iml b/.idea/TRAK.iml new file mode 100644 index 00000000..8dedcfa7 --- /dev/null +++ b/.idea/TRAK.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..8f7d572f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..2c5ef4e6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 139b2e3a..a011c8c8 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,16 @@ W programie powinny znaleźć się m.in.: | ~~Prezentacja projektów związanych z artykułami~~ | 3.12.2024 | | (!) Oddanie pierwszego etapu projektu (!) | 13.12.2024 | | **Oddanie ostatecznej wersji programu** | **24.01.2025** | -| **Prezentacja projektów nie związanych z artykułami** | **28.01.2025** | \ No newline at end of file +| **Prezentacja projektów nie związanych z artykułami** | **28.01.2025** | + +## Wywoływanie z terminala + +```bash +# Wywołanie algorytmu ray tracing z domyślnymi parametrami i sceną +python main.py --algorithm ray_tracing +``` + +```bash +# Wywołanie algorytmu ray tracing ze specyfikacją sceny z folderu scenes, liczbą sampli na pixek, rozdzielczością, środowiskiem i rozmyciem środowiska +python main.py --scene three_spheres --samples_per_pixel 100 --resolution 100x100 --environment lake.png --env_blur 10 +``` diff --git a/code/main.py b/code/main.py deleted file mode 100644 index 34ea7d69..00000000 --- a/code/main.py +++ /dev/null @@ -1,35 +0,0 @@ -import argparse -from configparser import ConfigParser -from rendering import ray_trace -from utils import load_config, parse_resolution - -def main(): - # default config - config = load_config('config.ini') - - # Parse - parser = argparse.ArgumentParser(description="Rendering Program") - parser.add_argument('--algorithm', type=str, help='Algorithm to use', default=config.get('DEFAULT', 'algorithm')) - parser.add_argument('--scene', type=str, help='Path to scene file', default=config.get('DEFAULT', 'scene')) - parser.add_argument('--environment_map', type=str, help='Environment map file', default=config.get('DEFAULT', 'environment_map')) - parser.add_argument('--resolution', type=str, help='Image resolution (WIDTHxHEIGHT)', - default=config.get('DEFAULT', 'resolution')) - - parser.add_argument('--num_spheres', type=int, default=3, help='Number of spheres in the scene') - - args = parser.parse_args() - - width, height = parse_resolution(args.resolution) - - # Run the selected algorithm - if args.algorithm == "ray_tracing": - print("Starting ray tracing...") - # ray_trace(args.scene, args.environment_map, image_width=width, image_height=height, output_file="output_ray_traced.png") - ray_trace(args.num_spheres, args.environment_map, image_width=width, image_height=height, # na razie generujemy w kodzie, ale potem trzeba będzie obj wczytywać - output_file="output_ray_traced.png") - else: - print(f"Unknown algorithm: {args.algorithm}") - return - -if __name__ == '__main__': - main() diff --git a/code/scenes/EXAMPLE1.png b/code/scenes/EXAMPLE1.png deleted file mode 100644 index c4215e8d..00000000 Binary files a/code/scenes/EXAMPLE1.png and /dev/null differ diff --git a/code/scenes/README.md b/code/scenes/README.md deleted file mode 100644 index 6def2878..00000000 --- a/code/scenes/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Scene directory - -This is scene directory. Put .obj files here. \ No newline at end of file diff --git a/code/sightpy_test.py b/code/sightpy_test.py deleted file mode 100644 index 0e9c15e1..00000000 --- a/code/sightpy_test.py +++ /dev/null @@ -1,130 +0,0 @@ -from sightpy import * - - -# Set Scene - -Sc = Scene(ambient_color=rgb(0.00, 0.00, 0.00)) - - -angle = -0 - -Sc.add_Camera( - screen_width=100, - screen_height=100, - look_from=vec3(278, 278, 800), - look_at=vec3(278, 278, 0), - focal_distance=1.0, - field_of_view=40, -) - - -# define materials to use - -green_diffuse = Diffuse(diff_color=rgb(0.12, 0.45, 0.15)) -red_diffuse = Diffuse(diff_color=rgb(0.65, 0.05, 0.05)) -white_diffuse = Diffuse(diff_color=rgb(0.73, 0.73, 0.73)) -emissive_white = Emissive(color=rgb(15.0, 15.0, 15.0)) -emissive_blue = Emissive(color=rgb(2.0, 2.0, 3.5)) -blue_glass = Refractive(n=vec3(1.5 + 0.05e-8j, 1.5 + 0.02e-8j, 1.5 + 0.0j)) - - -# this is the light -Sc.add( - Plane( - material=emissive_white, - center=vec3(213 + 130 / 2, 554, -227.0 - 105 / 2), - width=130.0, - height=105.0, - u_axis=vec3(1.0, 0.0, 0), - v_axis=vec3(0.0, 0, 1.0), - ), - importance_sampled=True, -) - - -Sc.add( - Plane( - material=white_diffuse, - center=vec3(555 / 2, 555 / 2, -555.0), - width=555.0, - height=555.0, - u_axis=vec3(0.0, 1.0, 0), - v_axis=vec3(1.0, 0, 0.0), - ) -) - -Sc.add( - Plane( - material=green_diffuse, - center=vec3(-0.0, 555 / 2, -555 / 2), - width=555.0, - height=555.0, - u_axis=vec3(0.0, 1.0, 0), - v_axis=vec3(0.0, 0, -1.0), - ) -) - -Sc.add( - Plane( - material=red_diffuse, - center=vec3(555.0, 555 / 2, -555 / 2), - width=555.0, - height=555.0, - u_axis=vec3(0.0, 1.0, 0), - v_axis=vec3(0.0, 0, -1.0), - ) -) - -Sc.add( - Plane( - material=white_diffuse, - center=vec3(555 / 2, 555, -555 / 2), - width=555.0, - height=555.0, - u_axis=vec3(1.0, 0.0, 0), - v_axis=vec3(0.0, 0, -1.0), - ) -) - -Sc.add( - Plane( - material=white_diffuse, - center=vec3(555 / 2, 0.0, -555 / 2), - width=555.0, - height=555.0, - u_axis=vec3(1.0, 0.0, 0), - v_axis=vec3(0.0, 0, -1.0), - ) -) - - -cb = Cuboid( - material=white_diffuse, - center=vec3(182.5, 165, -285 - 160 / 2), - width=165, - height=165 * 2, - length=165, - shadow=False, -) -cb.rotate(θ=15, u=vec3(0, 1, 0)) -Sc.add(cb) - - -Sc.add( - Sphere( - material=blue_glass, - center=vec3(370.5, 165 / 2, -65 - 185 / 2), - radius=165 / 2, - shadow=False, - max_ray_depth=3, - ), - importance_sampled=True, -) -# Render - -img = Sc.render(samples_per_pixel=100, progress_bar=True) -# you are going to need more than 10 samples to remove the noise. At least 1000 for a nice image. - -img.save("cornell_box.png") - -img.show() diff --git a/code/config.ini b/config.ini similarity index 64% rename from code/config.ini rename to config.ini index 1747370c..a688a058 100644 --- a/code/config.ini +++ b/config.ini @@ -1,11 +1,14 @@ [DEFAULT] algorithm = ray_tracing -scene = scenes/scene.obj -environment_map = environments/map.hdr +scene = cornell_box +environment = lake.png +env_blur = 0 resolution = 400x300 +output = output.png [ray_tracing] max_depth = 5 ; Params for ray tracing +samples_per_pixel = 6 [photon_mapping] photon_count = 100000 ; Params for photon mapping \ No newline at end of file diff --git a/code/environments/README.md b/environments/README.md similarity index 100% rename from code/environments/README.md rename to environments/README.md diff --git a/code/sightpy/backgrounds/lake.png b/environments/lake.png similarity index 100% rename from code/sightpy/backgrounds/lake.png rename to environments/lake.png diff --git a/code/sightpy/backgrounds/miramar.jpeg b/environments/miramar.jpeg similarity index 100% rename from code/sightpy/backgrounds/miramar.jpeg rename to environments/miramar.jpeg diff --git a/code/sightpy/backgrounds/stormydays.png b/environments/stormydays.png similarity index 100% rename from code/sightpy/backgrounds/stormydays.png rename to environments/stormydays.png diff --git a/main.py b/main.py new file mode 100644 index 00000000..9e68b148 --- /dev/null +++ b/main.py @@ -0,0 +1,61 @@ +import argparse +from configparser import ConfigParser +from rendering import ray_trace +from utils import load_config, parse_resolution +import importlib +import os +# from scenes.cornell_box import * + +def main(): + # default config + config = load_config('config.ini') + + # Parse + parser = argparse.ArgumentParser(description="Rendering Program") + parser.add_argument('--algorithm', type=str, help='Algorithm to use', default=config.get('DEFAULT', 'algorithm')) + parser.add_argument('--scene', type=str, help='Name of the scene to render (without .py).', default=config.get('DEFAULT', 'scene')) + parser.add_argument('--environment', type=str, help='Environment file', default=config.get('DEFAULT', 'environment')) + parser.add_argument('--env_blur', type=str, help='Environment blur', default=config.get('DEFAULT', 'env_blur')) + parser.add_argument('--resolution', type=str, help='Image resolution (WIDTHxHEIGHT)', + default=config.get('DEFAULT', 'resolution')) + parser.add_argument("--samples_per_pixel", type=int, default=config.get('ray_tracing', 'samples_per_pixel'), help="Samples per pixel for rendering.") + parser.add_argument("--output", type=str, default=config.get('DEFAULT', 'output'), help="Output file name.") + + parser.add_argument('--num_spheres', type=int, default=3, help='Number of spheres in the scene for Ray Tracing 0') + + args = parser.parse_args() + + width, height = parse_resolution(args.resolution) + + # Run the selected algorithm + if args.algorithm == "ray_tracing0": + print("Starting ray tracing zero...") + # ray_trace(args.scene, args.environment_map, image_width=width, image_height=height, output_file="output_ray_traced.png") + ray_trace(args.num_spheres, args.environment_map, image_width=width, image_height=height, # na razie generujemy w kodzie, ale potem trzeba będzie obj wczytywać + output_file="output_ray_traced.png") + elif args.algorithm == "ray_tracing": + print("Starting ray tracing...") + try: + print(args.scene) + scene_module = importlib.import_module(f"scenes.{args.scene}") + except ModuleNotFoundError: + print(f"Error: Scene '{args.scene}' not found in the 'scenes' directory.") + return + try: + scene = scene_module.setup_scene(width=width, height=height, environment=f"{args.environment}") + except AttributeError: + print(f"Error: Scene '{args.scene}' does not define a `setup_scene` function.") + return + # Renderowanie + print(f"Rendering scene '{args.scene}' with {args.samples_per_pixel} samples per pixel...") + img = scene.render(samples_per_pixel=args.samples_per_pixel) + output_path = os.path.join("outputs", args.output) + img.save(output_path) + print(f"Image saved to {output_path}") + img.show() + else: + print(f"Unknown algorithm: {args.algorithm}") + return + +if __name__ == '__main__': + main() diff --git a/code/output_ray_traced.png b/output_ray_traced.png similarity index 100% rename from code/output_ray_traced.png rename to output_ray_traced.png diff --git a/outputs/output.png b/outputs/output.png new file mode 100644 index 00000000..a23f6b31 Binary files /dev/null and b/outputs/output.png differ diff --git a/code/rendering.py b/rendering.py similarity index 100% rename from code/rendering.py rename to rendering.py diff --git a/code/requirements.txt b/requirements.txt similarity index 100% rename from code/requirements.txt rename to requirements.txt diff --git a/scenes/README.md b/scenes/README.md new file mode 100644 index 00000000..96272e79 --- /dev/null +++ b/scenes/README.md @@ -0,0 +1,3 @@ +# Scene directory + +This is scene directory. Put scene files here. \ No newline at end of file diff --git a/code/__init__.py b/scenes/__init__.py similarity index 100% rename from code/__init__.py rename to scenes/__init__.py diff --git a/scenes/cornell_box.py b/scenes/cornell_box.py new file mode 100644 index 00000000..404ac37e --- /dev/null +++ b/scenes/cornell_box.py @@ -0,0 +1,118 @@ +from sightpy import * + +# define materials to use +def setup_scene(width=400, height=300, environment=None): + + Sc = Scene(ambient_color=rgb(0.00, 0.00, 0.00)) + + angle = -0 + + Sc.add_Camera( + screen_width=width, + screen_height=height, + look_from=vec3(278, 278, 800), + look_at=vec3(278, 278, 0), + focal_distance=1.0, + field_of_view=40, + ) + + # define materials to use + + green_diffuse = Diffuse(diff_color=rgb(0.12, 0.45, 0.15)) + red_diffuse = Diffuse(diff_color=rgb(0.65, 0.05, 0.05)) + white_diffuse = Diffuse(diff_color=rgb(0.73, 0.73, 0.73)) + emissive_white = Emissive(color=rgb(15.0, 15.0, 15.0)) + emissive_blue = Emissive(color=rgb(2.0, 2.0, 3.5)) + blue_glass = Refractive(n=vec3(1.5 + 0.05e-8j, 1.5 + 0.02e-8j, 1.5 + 0.0j)) + + # this is the light + Sc.add( + Plane( + material=emissive_white, + center=vec3(213 + 130 / 2, 554, -227.0 - 105 / 2), + width=130.0, + height=105.0, + u_axis=vec3(1.0, 0.0, 0), + v_axis=vec3(0.0, 0, 1.0), + ), + importance_sampled=True, + ) + + Sc.add( + Plane( + material=white_diffuse, + center=vec3(555 / 2, 555 / 2, -555.0), + width=555.0, + height=555.0, + u_axis=vec3(0.0, 1.0, 0), + v_axis=vec3(1.0, 0, 0.0), + ) + ) + + Sc.add( + Plane( + material=green_diffuse, + center=vec3(-0.0, 555 / 2, -555 / 2), + width=555.0, + height=555.0, + u_axis=vec3(0.0, 1.0, 0), + v_axis=vec3(0.0, 0, -1.0), + ) + ) + + Sc.add( + Plane( + material=red_diffuse, + center=vec3(555.0, 555 / 2, -555 / 2), + width=555.0, + height=555.0, + u_axis=vec3(0.0, 1.0, 0), + v_axis=vec3(0.0, 0, -1.0), + ) + ) + + Sc.add( + Plane( + material=white_diffuse, + center=vec3(555 / 2, 555, -555 / 2), + width=555.0, + height=555.0, + u_axis=vec3(1.0, 0.0, 0), + v_axis=vec3(0.0, 0, -1.0), + ) + ) + + Sc.add( + Plane( + material=white_diffuse, + center=vec3(555 / 2, 0.0, -555 / 2), + width=555.0, + height=555.0, + u_axis=vec3(1.0, 0.0, 0), + v_axis=vec3(0.0, 0, -1.0), + ) + ) + + cb = Cuboid( + material=white_diffuse, + center=vec3(182.5, 165, -285 - 160 / 2), + width=165, + height=165 * 2, + length=165, + shadow=False, + ) + cb.rotate(θ=15, u=vec3(0, 1, 0)) + Sc.add(cb) + + Sc.add( + Sphere( + material=blue_glass, + center=vec3(370.5, 165 / 2, -65 - 185 / 2), + radius=165 / 2, + shadow=False, + max_ray_depth=3, + ), + importance_sampled=True, + ) + + return Sc diff --git a/scenes/soap_bubble.py b/scenes/soap_bubble.py new file mode 100644 index 00000000..7f022618 --- /dev/null +++ b/scenes/soap_bubble.py @@ -0,0 +1,19 @@ +from sightpy import * + +# define materials to use +def setup_scene(width=400, height=300, environment="lake.png"): + # Set Scene + + Sc = Scene(ambient_color=rgb(0.01, 0.01, 0.01)) + + angle = -np.pi * 0.5 + Sc.add_Camera(screen_height=height, screen_width=width, + look_from=vec3(4.0 * np.sin(angle), 0.00, 4.0 * np.cos(angle)), + look_at=vec3(0., 0.05, 0.0)) + + soap_bubble = ThinFilmInterference(thickness=330, noise=60.) + Sc.add(Sphere(material=soap_bubble, center=vec3(1., 0.0, 1.5), radius=1.7, shadow=False, max_ray_depth=5)) + + Sc.add_Background(environment, blur=10.) + + return Sc diff --git a/scenes/three_spheres.py b/scenes/three_spheres.py new file mode 100644 index 00000000..830113a7 --- /dev/null +++ b/scenes/three_spheres.py @@ -0,0 +1,35 @@ +from sightpy import * + +# define materials to use +def setup_scene(width=400, height=300, environment="miramar.jpeg"): + + blue_glass = Refractive(n=vec3(1.5 + 4e-8j, 1.5 + 4e-8j, 1.5 + 0.j)) # n = index of refraction + green_glass = Refractive(n=vec3(1.5 + 4e-8j, 1.5 + 0.j, 1.5 + 4e-8j)) + red_glass = Refractive(n=vec3(1.5 + 0.j, 1.5 + 5e-8j, 1.5 + 5e-8j)) + + floor = Glossy(diff_color=image("checkered_floor.png", repeat=80.), n=vec3(1.2 + 0.3j, 1.2 + 0.3j, 1.1 + 0.3j), + roughness=0.2, spec_coeff=0.3, diff_coeff=0.9) + + # Set Scene + + Sc = Scene(ambient_color=rgb(0.05, 0.05, 0.05)) + + angle = np.pi / 2 * 0.3 + Sc.add_Camera(look_from=vec3(2.5 * np.sin(angle), 0.25, 2.5 * np.cos(angle) - 1.5), + look_at=vec3(0., 0.25, -1.5), + screen_width=width, + screen_height=height) + + Sc.add_DirectionalLight(Ldir=vec3(0.52, 0.45, -0.5), color=rgb(0.15, 0.15, 0.15)) + + Sc.add(Sphere(material=blue_glass, center=vec3(-1.2, 0.0, -1.5), radius=.5, shadow=False, max_ray_depth=3)) + Sc.add(Sphere(material=green_glass, center=vec3(0., 0.0, -1.5), radius=.5, shadow=False, max_ray_depth=3)) + Sc.add(Sphere(material=red_glass, center=vec3(1.2, 0.0, -1.5), radius=.5, shadow=False, max_ray_depth=3)) + + Sc.add(Plane(material=floor, center=vec3(0, -0.5, -3.0), width=120.0, height=120.0, u_axis=vec3(1.0, 0, 0), + v_axis=vec3(0, 0, -1.0), max_ray_depth=3)) + + # see sightpy/backgrounds + Sc.add_Background(environment) + + return Sc diff --git a/scenes/transparent_cuboid.py b/scenes/transparent_cuboid.py new file mode 100644 index 00000000..475cb523 --- /dev/null +++ b/scenes/transparent_cuboid.py @@ -0,0 +1,27 @@ +from sightpy import * + +# define materials to use +def setup_scene(width=400, height=300, environment="stormydays.png"): + floor = Glossy(diff_color=image("checkered_floor.png", repeat=2.), roughness=0.2, spec_coeff=0.3, diff_coeff=0.7, + n=vec3(2.2, 2.2, 2.2)) # n = index of refraction + green_glass = Refractive(n=vec3(1.5 + 4e-8j, 1.5 + 0.j, 1.5 + 4e-8j)) + + Sc = Scene() + Sc.add_Camera(look_from=vec3(0., 0.25, 1.), look_at=vec3(0., 0.25, -3.), + screen_width=width, + screen_height=height) + + Sc.add_DirectionalLight(Ldir=vec3(0.0, 0.5, 0.5), color=rgb(0.5, 0.5, 0.5)) + + Sc.add(Plane(material=floor, center=vec3(0, -0.5, -3.0), width=6.0, height=6.0, u_axis=vec3(1.0, 0, 0), + v_axis=vec3(0, 0, -1.0), max_ray_depth=5)) + + cb = Cuboid(material=green_glass, center=vec3(0.00, 0.0001, -0.8), width=0.9, height=1.0, length=0.4, shadow=False, + max_ray_depth=5) + cb.rotate(θ=30, u=vec3(0, 1, 0)) + Sc.add(cb) + + # see sightpy/backgrounds + Sc.add_Background(environment) + + return Sc \ No newline at end of file diff --git a/scenes/two_spheres.py b/scenes/two_spheres.py new file mode 100644 index 00000000..846bea3c --- /dev/null +++ b/scenes/two_spheres.py @@ -0,0 +1,38 @@ +from sightpy import * + +# define materials to use +def setup_scene(width=400, height=300, environment="stormydays.png"): + gold_metal = Glossy(diff_color = rgb(1., .572, .184), n = vec3(0.15+3.58j, 0.4+2.37j, 1.54+1.91j), roughness = 0.0, spec_coeff = 0.2, diff_coeff= 0.8) # n = index of refraction + bluish_metal = Glossy(diff_color = rgb(0.0, 0, 0.1), n = vec3(1.3+1.91j, 1.3+1.91j, 1.4+2.91j), roughness = 0.2,spec_coeff = 0.5, diff_coeff= 0.3) + + floor = Glossy(diff_color = image("checkered_floor.png", repeat = 80.), + n = vec3(1.2+ 0.3j, 1.2+ 0.3j, 1.1+ 0.3j), roughness = 0.2, spec_coeff = 0.3, diff_coeff= 0.9 ) + + + + + + # Set Scene + Sc = Scene(ambient_color = rgb(0.05, 0.05, 0.05)) + + + angle = -np.pi/2 * 0.3 + Sc.add_Camera(look_from = vec3(2.5*np.sin(angle), 0.25, 2.5*np.cos(angle) -1.5 ), + look_at = vec3(0., 0.25, -3.), + screen_width = width , + screen_height = height) + + + + Sc.add_DirectionalLight(Ldir = vec3(0.52,0.45, -0.5), color = rgb(0.15, 0.15, 0.15)) + + + Sc.add(Sphere(material = gold_metal, center = vec3(-.75, .1, -3.),radius = .6, max_ray_depth = 3)) + Sc.add(Sphere(material = bluish_metal, center = vec3(1.25, .1, -3.), radius = .6, max_ray_depth = 3)) + + Sc.add(Plane(material = floor, center = vec3(0, -0.5, -3.0), width = 120.0,height = 120.0, u_axis = vec3(1.0, 0, 0), v_axis = vec3(0, 0, -1.0), max_ray_depth = 3)) + + #see sightpy/backgrounds + Sc.add_Background(environment) + + return Sc \ No newline at end of file diff --git a/code/sightpy/__init__.py b/sightpy/__init__.py similarity index 100% rename from code/sightpy/__init__.py rename to sightpy/__init__.py diff --git a/code/sightpy/animation.py b/sightpy/animation.py similarity index 100% rename from code/sightpy/animation.py rename to sightpy/animation.py diff --git a/code/sightpy/backgrounds/__init__.py b/sightpy/backgrounds/__init__.py similarity index 100% rename from code/sightpy/backgrounds/__init__.py rename to sightpy/backgrounds/__init__.py diff --git a/sightpy/backgrounds/lake.png b/sightpy/backgrounds/lake.png new file mode 100644 index 00000000..f7541a2c Binary files /dev/null and b/sightpy/backgrounds/lake.png differ diff --git a/code/sightpy/backgrounds/lightmaps/lake.png b/sightpy/backgrounds/lightmaps/lake.png similarity index 100% rename from code/sightpy/backgrounds/lightmaps/lake.png rename to sightpy/backgrounds/lightmaps/lake.png diff --git a/sightpy/backgrounds/miramar.jpeg b/sightpy/backgrounds/miramar.jpeg new file mode 100644 index 00000000..1a720c20 Binary files /dev/null and b/sightpy/backgrounds/miramar.jpeg differ diff --git a/code/sightpy/backgrounds/panorama.py b/sightpy/backgrounds/panorama.py similarity index 100% rename from code/sightpy/backgrounds/panorama.py rename to sightpy/backgrounds/panorama.py diff --git a/code/sightpy/backgrounds/skybox.py b/sightpy/backgrounds/skybox.py similarity index 100% rename from code/sightpy/backgrounds/skybox.py rename to sightpy/backgrounds/skybox.py diff --git a/sightpy/backgrounds/stormydays.png b/sightpy/backgrounds/stormydays.png new file mode 100644 index 00000000..0e76d1a1 Binary files /dev/null and b/sightpy/backgrounds/stormydays.png differ diff --git a/code/sightpy/backgrounds/util/__init__.py b/sightpy/backgrounds/util/__init__.py similarity index 100% rename from code/sightpy/backgrounds/util/__init__.py rename to sightpy/backgrounds/util/__init__.py diff --git a/code/sightpy/backgrounds/util/blur_background.py b/sightpy/backgrounds/util/blur_background.py similarity index 100% rename from code/sightpy/backgrounds/util/blur_background.py rename to sightpy/backgrounds/util/blur_background.py diff --git a/code/sightpy/camera.py b/sightpy/camera.py similarity index 100% rename from code/sightpy/camera.py rename to sightpy/camera.py diff --git a/code/sightpy/geometry/__init__.py b/sightpy/geometry/__init__.py similarity index 100% rename from code/sightpy/geometry/__init__.py rename to sightpy/geometry/__init__.py diff --git a/code/sightpy/geometry/collider.py b/sightpy/geometry/collider.py similarity index 100% rename from code/sightpy/geometry/collider.py rename to sightpy/geometry/collider.py diff --git a/code/sightpy/geometry/cuboid.py b/sightpy/geometry/cuboid.py similarity index 100% rename from code/sightpy/geometry/cuboid.py rename to sightpy/geometry/cuboid.py diff --git a/code/sightpy/geometry/plane.py b/sightpy/geometry/plane.py similarity index 100% rename from code/sightpy/geometry/plane.py rename to sightpy/geometry/plane.py diff --git a/code/sightpy/geometry/primitive.py b/sightpy/geometry/primitive.py similarity index 100% rename from code/sightpy/geometry/primitive.py rename to sightpy/geometry/primitive.py diff --git a/code/sightpy/geometry/sphere.py b/sightpy/geometry/sphere.py similarity index 100% rename from code/sightpy/geometry/sphere.py rename to sightpy/geometry/sphere.py diff --git a/code/sightpy/geometry/surface.py b/sightpy/geometry/surface.py similarity index 100% rename from code/sightpy/geometry/surface.py rename to sightpy/geometry/surface.py diff --git a/code/sightpy/geometry/triangle.py b/sightpy/geometry/triangle.py similarity index 100% rename from code/sightpy/geometry/triangle.py rename to sightpy/geometry/triangle.py diff --git a/code/sightpy/geometry/triangle_mesh.py b/sightpy/geometry/triangle_mesh.py similarity index 100% rename from code/sightpy/geometry/triangle_mesh.py rename to sightpy/geometry/triangle_mesh.py diff --git a/code/sightpy/lights.py b/sightpy/lights.py similarity index 100% rename from code/sightpy/lights.py rename to sightpy/lights.py diff --git a/code/sightpy/materials/__init__.py b/sightpy/materials/__init__.py similarity index 100% rename from code/sightpy/materials/__init__.py rename to sightpy/materials/__init__.py diff --git a/code/sightpy/materials/diffuse.py b/sightpy/materials/diffuse.py similarity index 100% rename from code/sightpy/materials/diffuse.py rename to sightpy/materials/diffuse.py diff --git a/code/sightpy/materials/emissive.py b/sightpy/materials/emissive.py similarity index 100% rename from code/sightpy/materials/emissive.py rename to sightpy/materials/emissive.py diff --git a/code/sightpy/materials/glossy.py b/sightpy/materials/glossy.py similarity index 100% rename from code/sightpy/materials/glossy.py rename to sightpy/materials/glossy.py diff --git a/code/sightpy/materials/material.py b/sightpy/materials/material.py similarity index 100% rename from code/sightpy/materials/material.py rename to sightpy/materials/material.py diff --git a/code/sightpy/materials/refractive.py b/sightpy/materials/refractive.py similarity index 100% rename from code/sightpy/materials/refractive.py rename to sightpy/materials/refractive.py diff --git a/code/sightpy/materials/thin_film_interference.py b/sightpy/materials/thin_film_interference.py similarity index 100% rename from code/sightpy/materials/thin_film_interference.py rename to sightpy/materials/thin_film_interference.py diff --git a/code/sightpy/normalmaps/floor.jpg b/sightpy/normalmaps/floor.jpg similarity index 100% rename from code/sightpy/normalmaps/floor.jpg rename to sightpy/normalmaps/floor.jpg diff --git a/code/sightpy/ray.py b/sightpy/ray.py similarity index 100% rename from code/sightpy/ray.py rename to sightpy/ray.py diff --git a/code/sightpy/scene.py b/sightpy/scene.py similarity index 97% rename from code/sightpy/scene.py rename to sightpy/scene.py index 81b5959b..d4c20a6b 100644 --- a/code/sightpy/scene.py +++ b/sightpy/scene.py @@ -3,9 +3,8 @@ import numpy as np import time from .utils import colour_functions as cf from .camera import Camera -from .utils.constants import * from .utils.vector3 import vec3, rgb -from .ray import Ray, get_raycolor, get_distances +from .ray import get_raycolor, get_distances from . import lights from .backgrounds.skybox import SkyBox from .backgrounds.panorama import Panorama @@ -31,7 +30,7 @@ class Scene(): self.Light_list += [lights.PointLight(pos, color)] def add_DirectionalLight(self, Ldir, color): - self.Light_list += [lights.DirectionalLight(Ldir.normalize() , color)] + self.Light_list += [lights.DirectionalLight(Ldir.normalize(), color)] def add(self,primitive, importance_sampled = False): self.scene_primitives += [primitive] diff --git a/code/sightpy/textures/__init__.py b/sightpy/textures/__init__.py similarity index 100% rename from code/sightpy/textures/__init__.py rename to sightpy/textures/__init__.py diff --git a/code/sightpy/textures/checkered_floor.png b/sightpy/textures/checkered_floor.png similarity index 100% rename from code/sightpy/textures/checkered_floor.png rename to sightpy/textures/checkered_floor.png diff --git a/code/sightpy/textures/noise.png b/sightpy/textures/noise.png similarity index 100% rename from code/sightpy/textures/noise.png rename to sightpy/textures/noise.png diff --git a/code/sightpy/textures/texture.py b/sightpy/textures/texture.py similarity index 100% rename from code/sightpy/textures/texture.py rename to sightpy/textures/texture.py diff --git a/code/sightpy/textures/thin_film_interference_n=1.3.png b/sightpy/textures/thin_film_interference_n=1.3.png similarity index 100% rename from code/sightpy/textures/thin_film_interference_n=1.3.png rename to sightpy/textures/thin_film_interference_n=1.3.png diff --git a/code/sightpy/textures/thin_film_interference_n=1.4.png b/sightpy/textures/thin_film_interference_n=1.4.png similarity index 100% rename from code/sightpy/textures/thin_film_interference_n=1.4.png rename to sightpy/textures/thin_film_interference_n=1.4.png diff --git a/code/sightpy/textures/thin_film_interference_n=1.5.png b/sightpy/textures/thin_film_interference_n=1.5.png similarity index 100% rename from code/sightpy/textures/thin_film_interference_n=1.5.png rename to sightpy/textures/thin_film_interference_n=1.5.png diff --git a/code/sightpy/textures/wood.jpg b/sightpy/textures/wood.jpg similarity index 100% rename from code/sightpy/textures/wood.jpg rename to sightpy/textures/wood.jpg diff --git a/code/sightpy/utils/__init__.py b/sightpy/utils/__init__.py similarity index 100% rename from code/sightpy/utils/__init__.py rename to sightpy/utils/__init__.py diff --git a/code/sightpy/utils/colour_functions.py b/sightpy/utils/colour_functions.py similarity index 100% rename from code/sightpy/utils/colour_functions.py rename to sightpy/utils/colour_functions.py diff --git a/code/sightpy/utils/constants.py b/sightpy/utils/constants.py similarity index 100% rename from code/sightpy/utils/constants.py rename to sightpy/utils/constants.py diff --git a/code/sightpy/utils/image_functions.py b/sightpy/utils/image_functions.py similarity index 100% rename from code/sightpy/utils/image_functions.py rename to sightpy/utils/image_functions.py diff --git a/code/sightpy/utils/random.py b/sightpy/utils/random.py similarity index 100% rename from code/sightpy/utils/random.py rename to sightpy/utils/random.py diff --git a/code/sightpy/utils/vector3.py b/sightpy/utils/vector3.py similarity index 100% rename from code/sightpy/utils/vector3.py rename to sightpy/utils/vector3.py diff --git a/code/utils.py b/utils.py similarity index 100% rename from code/utils.py rename to utils.py