a347ef35 |
1 | # Script demonstrating ray tracing in 3d view |
12402146 |
2 | |
3 | # make bottle by calling another script |
4 | source [file join [file dirname [info script]] bottle.tcl] |
5 | |
6 | # make table and a glass |
7 | box table -50 -50 -10 100 100 10 |
8 | pcone glass_out 7 9 25 |
9 | pcone glass_in 7 9 25 |
10 | ttranslate glass_in 0 0 0.2 |
11 | bcut glass glass_out glass_in |
12 | ttranslate glass -30 -30 0 |
13 | |
14 | # show table and glass |
a347ef35 |
15 | vinit w=1024 h=1024 |
12402146 |
16 | vsetmaterial bottle aluminium |
17 | vdisplay table |
18 | vsetmaterial table bronze |
19 | vsetmaterial table plastic |
20 | vsetcolor table coral2 |
21 | vdisplay glass |
22 | vsetmaterial glass plastic |
23 | vsetcolor glass brown |
24 | vsettransparency glass 0.6 |
25 | |
26 | # add light source for shadows |
27 | vlight new spot pos -100 -100 300 |
28 | |
29 | # set white background and fit view |
30 | vsetcolorbg 255 255 255 |
31 | vfit |
32 | |
33 | # set ray tracing |
fc73a202 |
34 | puts "Trying raytrace mode..." |
bc8c79bb |
35 | if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } { |
fc73a202 |
36 | vtextureenv on 1 |
12402146 |
37 | } |