示例#1
0
                         reflective_index=0,
                         refractive_index=1.1,
                         refractive_attenuation=Color(0.03, 0.01, 0.01))
lens1 = Ellipsoid(CoordinateSystem(origin=Vector(1, 0, .5)),
                  lens_material,
                  width=0.2)
lens2 = Ellipsoid(CoordinateSystem(origin=Vector(0, 1, 1), angle=0.5),
                  lens_material,
                  height=2,
                  width=0.2)

objects = [floor, e1, e2, lens1, lens2]

l1 = LightSourceAtInfinity(intensity=Color('#ffffff'),
                           direction=Vector(2, -1, 3))
l2 = PointLightSource(intensity=Color('#ffff00'),
                      intensity_booster=1,
                      position=Vector(0, -1, 1.1))
illumination = Illumination(ambient_light=AmbientLight(intensity=WHITE * 0.2),
                            light_sources=[l1, l2])

camera_pos = Vector(5, 0, 1)

c = Camera(resolution=(HEIGHT, WIDTH),
           position=camera_pos,
           direction=-camera_pos + Vector(0, 0, 1),
           zoom=1,
           tilt_angle=0)

scene = Scene(c, objects, illumination)
示例#2
0
lens_pos = Vector(25, -21, 13)
lens_radius = .4
lens_pos = (ball_radius + lens_radius) * lens_pos.unit

s4 = SmoothSphere(
    lens_pos, lens_radius,
    Material(diffuse_light_reflectivity=WHITE * 0.01,
             specular_multiplier=.5,
             specular_coefficient=20,
             reflective_index=0,
             refractive_index=1.05,
             refractive_attenuation=Color(0.01, 0.01, 0.01)))
objects = [s1, s4]

l1 = LightSourceAtInfinity(intensity=Color('#ffffff'),
                           direction=Vector(2, 1, 3))
l2 = LightSourceAtInfinity(intensity=Color('#002255'),
                           direction=Vector(0, -1, 0))
# l3 = PointLightSource(intensity=Color('#ffff00'), intensity_booster=4, position=Vector(2, 2, -2))
illumination = Illumination(ambient_light=AmbientLight(intensity=WHITE * 0.3),
                            light_sources=[l1, l2])

c = Camera(resolution=(HEIGHT, WIDTH),
           position=Vector(8, 0, 0),
           direction=Vector(-1, 0, 0),
           zoom=1,
           tilt_angle=0)

scene = Scene(c, objects, illumination)