1 # Script demonstrating ray tracing in 3d view
3 #Category: Visualization
6 # Ray-Tracing doesn't work with Compatible Profile on macOS
8 if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
10 # make bottle by calling another script
11 source [file join [file dirname [info script]] bottle.tcl]
13 # make table and a glass
14 box table -50 -50 -10 100 100 10
15 pcone glass_out 7 9 25
17 ttranslate glass_in 0 0 0.2
18 bcut glass glass_out glass_in
19 ttranslate glass -30 -30 0
21 # show table and glass
23 vsetmaterial bottle aluminium
25 vsetmaterial table bronze
26 vsetmaterial table plastic
27 vsetcolor table coral2
29 vsetmaterial glass plastic
31 vsettransparency glass 0.6
33 # add light source for shadows
34 vlight spot -type SPOT -pos -100 -100 300
36 # set white background and fit view
37 vbackground -color WHITE
41 puts "Trying raytrace mode..."
42 if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } {