0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / samples / tcl / pathtrace_cube.tcl
1 # Script demonstrating Global illumination effects using non-interactive 
2 # path tracing rendering engine in 3d view
3
4 #Category: Visualization
5 #Title: Path tracing - Cube
6
7 pload MODELING VISUALIZATION
8 # Ray-Tracing doesn't work with Compatible Profile on macOS
9 if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
10
11 # setup 3D viewer content
12 vclear
13 vinit name=View1 w=512 h=512
14 vglinfo
15
16 # setup light sources
17 vlight -clear
18 vlight -add POSITIONAL -headLight 0 -pos 0.5 0.5 0.85 -smoothRadius 0.06 -intensity 30.0 -name pntlight
19
20 vvbo 0
21 vsetdispmode 1
22 vcamera -persp
23
24 # setup outer box
25 box b 1 1 1 
26 explode b FACE 
27 vdisplay -noupdate b_1 b_2 b_3 b_5 b_6
28 vlocation -noupdate b_1 -setLocation  1  0  0
29 vlocation -noupdate b_2 -setLocation -1  0  0
30 vlocation -noupdate b_3 -setLocation  0  1  0
31 vlocation -noupdate b_5 -setLocation  0  0  1
32 vlocation -noupdate b_6 -setLocation  0  0 -1
33
34 vsetmaterial -noupdate b_1 plastic
35 vsetmaterial -noupdate b_2 plastic
36 vsetmaterial -noupdate b_3 plastic
37 vsetmaterial -noupdate b_5 plastic
38 vsetmaterial -noupdate b_6 plastic
39 vbsdf b_1 -kd 1 0.3 0.3 -ks 0
40 vbsdf b_2 -kd 0.3 0.5 1 -ks 0
41 vbsdf b_3 -kd 1 -ks 0
42 vbsdf b_5 -kd 1 -ks 0
43 vbsdf b_6 -kd 1 -ks 0
44
45 vfront
46 vfit
47
48 # setup first inner sphere
49 psphere s 0.2
50 vdisplay     -noupdate s
51 vlocation    -noupdate s -setLocation 0.21 0.3 0.2
52 vsetmaterial -noupdate s glass
53 vbsdf s -absorpColor 0.8 0.8 1.0
54 vbsdf s -absorpCoeff 6
55
56 # setup first inner box
57 box c 0.3 0.3 0.2
58 vdisplay     -noupdate c
59 vlocation    -noupdate c -reset -rotate 0 0 0 0 0 1 -30 -translate 0.55 0.3 0.0
60 vsetmaterial -noupdate c plastic
61 vbsdf c -kd 1.0 0.8 0.2 -ks 0.3 -n
62
63 # setup second inner box
64 box g 0.15 0.15 0.3
65 vdisplay     -noupdate g
66 vlocation    -noupdate g -reset -rotate 0 0 0 0 0 1 10 -translate 0.7 0.25 0.2
67 vsetmaterial -noupdate g glass
68 vbsdf g -absorpColor 0.8 1.0 0.8
69 vbsdf g -absorpCoeff 6
70
71 # setup second inner sphere
72 psphere r 0.1
73 vdisplay -noupdate r
74 vsetmaterial -noupdate r plastic
75 vbsdf r -kd 0.5 0.9 0.3 -ks 0.3 -baseRoughness 0.0 -n
76 vbsdf r -baseFresnel Constant 1.0
77 vlocation r -setLocation 0.5 0.65 0.1
78
79 puts "Trying path tracing mode..."
80 vrenderparams -ray -gi -rayDepth 8
81
82 puts "Make several path tracing iterations to refine the picture, please wait..."
83 vfps 100
84 puts "Done. To improve the image further, or after view manipulations, give command:"
85 puts "vfps \[nb_iteratons\] or vrepaint -continuous"