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