コード例 #1
0
ファイル: test_texture.py プロジェクト: acosta/miru
# s2.material = lambertianTintMaterial.clone()
# s2.material.set_texture(Texture("images/moon.jpg"))
# scene_test.add_objects(s2)

zelda_texture = Texture("images/zelda.jpg")

position = Vector3(-2.0, 0.0, 3.0)
v1 = Vector3(2.0, 0.0, 0.0).multiply(zelda_texture.aspect_ratio)
v2 = Vector3(0.0, 2.0, 0.0)

mesh = Mesh()
quadmesh.create(mesh, v1, v2, position)
mesh.material = lambertianTintMaterial.clone()
mesh.material.albedo = Color(1.0, 0.5, 0.5, 1.0)
mesh.material.texture = zelda_texture
scene_test.add_objects(mesh)

c = Camera()
c.fov = 90

scene_test.set_ssaa(1)
scene_test.set_camera(c)

# blur_kernel = np.matrix([[0.0625, 0.125, 0.0625],
#                          [0.125,  0.25,   0.125],
#                          [0.0625, 0.125, 0.0625]])
# sharpen_kernel = np.matrix([[ 0, -1,  0],
#                             [-1,  5, -1],
#                             [ 0, -1,  0]])
# unsharp_kernel = (-1.0/256)* np.matrix([[ 1,  4,    6,  4, 1],
#                                         [ 4, 16,   24, 16, 4],
コード例 #2
0
ファイル: test_gif.py プロジェクト: acosta/miru
light = Light(Color(1.0, 1.0, 1.0, 1.0), 1.0)
light.transform.position = Vector3(0.0, 2.0, -2.0)
scene_test.set_light(light)

for i in range(0, total_sphere):
    s = Sphere(random.randint(10, 200) / 100.0)
    s.transform.position = Vector3(random.randint(-3,
                                                  3), random.randint(-3, 3),
                                   random.randint(2, 10))
    s.albedo = Color(
        float(random.randint(20, 255)) * 1.0 / 255.0,
        float(random.randint(20, 255)) * 1.0 / 255.0,
        float(random.randint(20, 255)) * 1.0 / 255.0, 1.0)
    print("Sphere got color " + str(s.albedo))
    scene_test.add_objects(s)

c = Camera()
c.fov = 90
scene_test.set_ssaa(1)
scene_test.set_camera(c)

if os.path.exists("/sdcard/Raytracing/"):
    render_image = "/sdcard/Raytracing/test"
else:
    render_image = 'test'

render_extension = '.gif'

render_sizex = 100
render_sizey = 120