1+ from sightpy import *
2+
3+
4+ # Set Scene
5+
6+ Sc = Scene (ambient_color = rgb (0.00 , 0.00 , 0.00 ))
7+
8+
9+ angle = - 0
10+
11+ Sc .add_Camera (screen_width = 100 ,screen_height = 100 ,
12+ look_from = vec3 (278 , 278 , 800 ), look_at = vec3 (278 ,278 ,0 ),
13+ focal_distance = 1. , field_of_view = 40 )
14+
15+
16+ # define materials to use
17+
18+ green_diffuse = Diffuse (diff_color = rgb (.12 , .45 , .15 ))
19+ red_diffuse = Diffuse (diff_color = rgb (.65 , .05 , .05 ))
20+ white_diffuse = Diffuse (diff_color = rgb (.73 , .73 , .73 ))
21+ emissive_white = Emissive (color = rgb (15. , 15. , 15. ))
22+ emissive_blue = Emissive (color = rgb (2. , 2. , 3.5 ))
23+ blue_glass = Refractive (n = vec3 (1.5 + 0.05e-8j ,1.5 + 0.02e-8j ,1.5 + 0.j ))
24+
25+
26+
27+ # this is the light
28+ 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 )),
29+ importance_sampled = True )
30+
31+
32+
33+ 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 )))
34+
35+ 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 )))
36+
37+ 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 )))
38+
39+ 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 )))
40+
41+ Sc .add (Plane (material = white_diffuse , center = vec3 (555 / 2 , 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 )))
42+
43+
44+ cb = Cuboid ( material = white_diffuse , center = vec3 (182.5 , 165 , - 285 - 160 / 2 ), width = 165 ,height = 165 * 2 , length = 165 , shadow = False )
45+ cb .rotate (θ = 15 , u = vec3 (0 ,1 ,0 ))
46+ Sc .add (cb )
47+
48+
49+
50+
51+ Sc .add (Sphere ( material = blue_glass , center = vec3 (370.5 , 165 / 2 , - 65 - 185 / 2 ), radius = 165 / 2 , shadow = False , max_ray_depth = 3 ),
52+ importance_sampled = True )
53+ # Render
54+
55+ img = Sc .render (samples_per_pixel = 10 , progress_bar = True )
56+ # you are going to need more than 10 samples to remove the noise. At least 1000 for a nice image.
57+
58+ img .save ("cornell_box.png" )
59+
60+ img .show ()
0 commit comments