Skip to content
Snippets Groups Projects
Commit 66bc98e7 authored by Benjamin Koltes's avatar Benjamin Koltes
Browse files

yolo

parent b71d6061
No related branches found
No related tags found
No related merge requests found
# Show to python where to find the modules
from scene import *
from light import Spotlight
from camera import Camera
from raytracer import raytracer_render
from matplotlib.image import imsave
camera = Camera(600,600,1)
materiau_sphere_bleue = Material(Vector((0,0,1)), .5, .3, .3, 100, .5)
materiau_sphere_rouge = Material(Vector((1,0,0)), .5, .3, .3, 100, .3)
materiau_sphere_blanche = Material(Vector((1,1,1)), .5, .3, .3, 100, .7)
materiau_sphere_verte= Material(Vector((0,1,0)), .5, .3, .3, 100, .3)
sphere_bleue = Sphere(Vector([0,0,3]), .8, materiau_sphere_bleue)
sphere_rouge = Sphere(Vector([0.5,0.5,2]), .5, materiau_sphere_rouge)
sphere_blanche = Sphere(Vector([0,0,0]), 50, materiau_sphere_blanche)
sphere_verte = Sphere(Vector([2,-2,3]), .5, materiau_sphere_verte)
lumiere = Spotlight(Vector((1,1,0)), Vector((1,1,1)))
scene = Scene()
scene.add_object(sphere_bleue)
scene.add_object(sphere_rouge)
scene.add_object(sphere_blanche)
scene.add_object(sphere_verte)
scene.add_light(lumiere)
affiche = raytracer_render(camera, scene)
imsave('two_spheres_reflection.png',affiche)
print('Done')
......@@ -10,8 +10,8 @@ from matplotlib.image import imsave
import sys
camera = Camera(200,200,1)
materiau_sphere_bleue = Material(Vector((0,0,1)), .7, .7, .7, 100, .7)
materiau_sphere_rouge = Material(Vector((1,0,0)), .7, .7, .7, 100, .7)
materiau_sphere_bleue = Material(Vector((0,0,1)), .5, .3, .3, 100, .5)
materiau_sphere_rouge = Material(Vector((1,0,0)), .5, .3, .3, 100, .3)
sphere_bleue = Sphere(Vector([0,0,3]), .8, materiau_sphere_bleue)
sphere_rouge = Sphere(Vector([0.5,0.5,2]), .5, materiau_sphere_rouge)
lumiere = Spotlight(Vector((1,1,0)), Vector((1,1,1)))
......@@ -21,3 +21,4 @@ scene.add_object(sphere_rouge)
scene.add_light(lumiere)
affiche = raytracer_render(camera, scene)
imsave('two_spheres_reflection.png',affiche)
print('Done')
scenes/two_spheres_reflection.png

2.12 KiB | W: | H:

scenes/two_spheres_reflection.png

2.52 KiB | W: | H:

scenes/two_spheres_reflection.png
scenes/two_spheres_reflection.png
scenes/two_spheres_reflection.png
scenes/two_spheres_reflection.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -25,7 +25,6 @@ r_one = c.ray_at(c.image_nrows, c.image_ncols);
r_one_ref_dir = Vector([-1,-1,c.focal_length])
r_one_ref_dir = r_one_ref_dir / r_one_ref_dir.norm()
assert abs(r_one.direction*(r_one_ref_dir) -
r_one.direction.norm() < 0.01), "c.ray_at(c.nrows,c.ncols) should have the direction [-1,-1,c.focal_length.";
assert abs(r_one.direction*(r_one_ref_dir) - r_one.direction.norm()) < 0.01, "c.ray_at(c.nrows,c.ncols) should have the direction [-1,-1,c.focal_length.";
two_spheres_reflection.png

9.12 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment