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