1 # Script demonstrating Global illumination materials
2 # using path tracing rendering engine in 3D view
4 #Category: Visualization
5 #Title: Path tracing - Ball
7 set aBallPath [locate_data_file occ/Ball.brep]
9 pload MODELING VISUALIZATION
13 vinit name=View1 w=512 h=512
18 # Setup view parameters
20 vviewparams -scale 18 -eye 44.49 -0.15 33.93 -at -14.20 -0.15 1.87 -up -0.48 0.00 0.88
22 # Load the model from disk
23 puts "Importing shape..."
24 restore $aBallPath ball
26 # Tessellate the model
29 # Display the model and assign material
30 vdisplay -noupdate ball
31 vsetmaterial -noupdate ball glass
33 # Create a sphere inside the model
37 vsetlocation -noupdate s 0 0 13
38 vsetmaterial -noupdate s plaster
40 # Create chessboard-style floor
42 eval compound [lrepeat 144 tile] tiles
44 for {set i 0} {$i < 12} {incr i} {
45 for {set j 1} {$j <= 12} {incr j} {
46 ttranslate tiles_[expr 12 * $i + $j] [expr $i * 10 - 90] [expr $j * 10 - 70] -0.15
47 vdisplay -noupdate tiles_[expr 12 * $i + $j]
49 vsetmaterial -noupdate tiles_[expr 12 * $i + $j] plaster
51 if {($i + $j) % 2 == 0} {
52 vbsdf tiles_[expr 12 * $i + $j] -kd 0.85
54 vbsdf tiles_[expr 12 * $i + $j] -kd 0.45
59 # Configure light sources
61 vlight change 0 head 0
62 vlight change 0 direction -0.25 -1 -1
63 vlight change 0 sm 0.3
64 vlight change 0 int 10
66 # Load environment map
69 puts "Trying path tracing mode..."
70 vrenderparams -ray -gi -rayDepth 10
72 # Start progressive refinement mode
75 puts "Make several path tracing iterations to refine the picture, please wait..."
77 puts "Done. To improve the image further, or after view manipulations, give command:"
78 puts "vfps \[nb_iteratons\] or vrepaint -continuous"