6e728f3b |
1 | # Script demonstrating Global illumination materials |
2 | # using path tracing rendering engine in 3D view |
3 | |
4 | #Category: Visualization |
5 | #Title: Path tracing - Ball |
6 | |
7 | set aBallPath [locate_data_file occ/Ball.brep] |
8 | |
9 | pload MODELING VISUALIZATION |
10 | |
11 | # Setup 3D viewer |
12 | vclear |
13 | vinit name=View1 w=512 h=512 |
14 | vglinfo |
15 | vvbo 0 |
16 | vsetdispmode 1 |
17 | |
18 | # Setup view parameters |
19 | vcamera -persp |
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 |
21 | |
22 | # Load the model from disk |
23 | puts "Importing shape..." |
24 | restore $aBallPath ball |
25 | |
26 | # Tessellate the model |
27 | incmesh ball 0.01 |
28 | |
29 | # Display the model and assign material |
30 | vdisplay -noupdate ball |
31 | vsetmaterial -noupdate ball glass |
32 | |
33 | # Create a sphere inside the model |
34 | psphere s 8 |
35 | incmesh s 0.01 |
36 | vdisplay -noupdate s |
37 | vsetlocation -noupdate s 0 0 13 |
38 | vsetmaterial -noupdate s plaster |
39 | |
40 | # Create chessboard-style floor |
41 | box tile 10 10 0.1 |
42 | eval compound [lrepeat 144 tile] tiles |
43 | explode 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] |
48 | |
49 | vsetmaterial -noupdate tiles_[expr 12 * $i + $j] plaster |
50 | |
51 | if {($i + $j) % 2 == 0} { |
52 | vbsdf tiles_[expr 12 * $i + $j] -kd 0.85 |
53 | } else { |
54 | vbsdf tiles_[expr 12 * $i + $j] -kd 0.45 |
55 | } |
56 | } |
57 | } |
58 | |
59 | # Configure light sources |
89d855ba |
60 | vlight -change 0 -head 0 |
61 | vlight -change 0 -direction -0.25 -1 -1 |
62 | vlight -change 0 -sm 0.3 |
63 | vlight -change 0 -int 10.0 |
6e728f3b |
64 | |
65 | # Load environment map |
66 | vtextureenv on 1 |
67 | |
68 | puts "Trying path tracing mode..." |
69 | vrenderparams -ray -gi -rayDepth 10 |
70 | |
71 | # Start progressive refinement mode |
72 | #vprogressive |
73 | |
74 | puts "Make several path tracing iterations to refine the picture, please wait..." |
75 | vfps 100 |
76 | puts "Done. To improve the image further, or after view manipulations, give command:" |
9196ea9d |
77 | puts "vfps \[nb_iteratons\] or vrepaint -continuous" |