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

v4

parent 1b07758e
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -13,7 +13,7 @@ def phong_illuminate(light, position, normal, object, viewer):
R = 2*(L*N)*N - L
V = (viewer - position).normalized()
i = kd*(L*N) + ks*(R*V)**alpha
i = ((kd*(L*N) + ks*(R*V)**alpha))*(N*L > 0)
return i*(light.color ** object.material.color)
......
one_sphere.png

6.21 KiB | W: | H:

one_sphere.png

6.02 KiB | W: | H:

one_sphere.png
one_sphere.png
one_sphere.png
one_sphere.png
  • 2-up
  • Swipe
  • Onion skin
from scene import *
from light import Spotlight
from camera import Camera
from raytracer import raytracer_render
from matplotlib.image import imsave
camera = Camera(200,200,2)
materiau_sphere = Material(Vector((0,0,1)), .1, .3, .8, 20)
sphere = Sphere(Vector([0,0,3]), 1, materiau_sphere)
lumiere = Spotlight(Vector((1, 1, 0)), Vector((1,1,1)))
scene = Scene()
scene.add_object(sphere)
scene.add_light(lumiere)
affiche = raytracer_render(camera, scene)
imsave('one_sphere.png',affiche)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment