author | Radek Brich <radek.brich@devl.cz> |
Fri, 14 Dec 2007 00:05:54 +0100 | |
branch | pyrit |
changeset 37 | 5f954c0d34fc |
parent 34 | 28f6e8b9d5d1 |
child 38 | 5d043eeb09d9 |
permissions | -rwxr-xr-x |
26 | 1 |
#!/usr/bin/python |
2 |
||
3 |
# this demo needs bunny model from |
|
4 |
# http://graphics.stanford.edu/data/3Dscanrep/ |
|
5 |
||
6 |
import sys |
|
7 |
sys.path.append(open('ModulePath').read().strip()) |
|
8 |
||
31 | 9 |
from raytracer import Raytracer, Light, Box, Triangle, NormalVertex, Material |
29
574c34441a1c
new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
28
diff
changeset
|
10 |
from plyreader import LoadStanfordPlyFile |
26 | 11 |
import Image |
12 |
||
13 |
rt = Raytracer() |
|
31 | 14 |
#rt.ambientocclusion(samples=100, distance=16.0, angle=0.5) |
15 |
||
26 | 16 |
mat = Material(colour=(0.9, 0.9, 0.9)) |
31 | 17 |
mat.setTransmissivity(0.8) |
29
574c34441a1c
new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
28
diff
changeset
|
18 |
LoadStanfordPlyFile(rt, "../models/bunny/bun_zipper.ply", |
31 | 19 |
mat, smooth=True, scale=(-29.0, 29.0, 29.0), trans=(-1,-2.5,-3)) |
20 |
||
34
28f6e8b9d5d1
quaternion moved to extra header file
Radek Brich <radek.brich@devl.cz>
parents:
31
diff
changeset
|
21 |
mat0 = Material(colour=(0.1, 0.2, 1.0)) |
31 | 22 |
box1 = Box(L=(-20.0, -1.7, -20.0), H=(20.0, -1.5, 20.0), material=mat0) |
23 |
rt.addshape(box1) |
|
26 | 24 |
|
34
28f6e8b9d5d1
quaternion moved to extra header file
Radek Brich <radek.brich@devl.cz>
parents:
31
diff
changeset
|
25 |
mat1 = Material(colour=(0.5, 0.2, 0.1)) |
31 | 26 |
mat1.setReflectivity(0.0) |
27 |
box2 = Box(L=(-20.0, -20.0, -10.0), H=(20.0, 20.0, -12.0), material=mat1) |
|
28 |
rt.addshape(box2) |
|
29 |
||
30 |
light = Light(position=(-5.0, 3.0, 10.0), colour=(0.9, 0.3, 0.6)) |
|
26 | 31 |
rt.addlight(light) |
32 |
||
31 | 33 |
light2 = Light(position=(4.0, 1.0, 10.0), colour=(0.2, 0.9, 0.5)) |
26 | 34 |
rt.addlight(light2) |
35 |
||
36 |
imagesize = (800, 600) |
|
37 |
data = rt.render(imagesize) |
|
38 |
img = Image.fromstring("RGB", imagesize, data) |
|
39 |
img.save('bunny.png') |