0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / tests / v3d / glsl / pbr_spheres
1 puts "========"
2 puts "0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model"
3 puts "Spheres grid with different roughness values"
4 puts "========"
5
6 pload XDE OCAF MODELING VISUALIZATION
7 psphere s 0.35
8
9 catch { Close D }
10 XNewDoc D
11
12 # grid of spheres
13 set THE_UPPER 6
14 foreach i [list 0 3] {
15   set aPrefix ""
16   set aColor "GRAY80"
17   if { $i != 0 } {
18     set aPrefix "g_";
19     set aColor "CCB11D"
20   }
21   for { set m 0 } { $m <= $THE_UPPER } { incr m } {
22     for { set r 0 } { $r <= $THE_UPPER } { incr r } {
23       set aName ${aPrefix}m${m}r${r}
24       copy s $aName
25       ttranslate $aName ${r} ${i} ${m}
26       set aLab [XAddShape D $aName]
27       SetName D $aLab $aName
28       XAddVisMaterial D $aName -baseColor $aColor -metallic ${m}/$THE_UPPER -roughness ${r}/$THE_UPPER
29       XSetVisMaterial D $aLab $aName
30     }
31   }
32 }
33 XGetAllVisMaterials D
34
35 # labels
36 text2brep tm  "Metal"     -plane 0 -1 0 0 0 -1 -height 0.5 -pos -0.5 0  6.5 -halign left  -valign top -font monospace
37 text2brep tnm "Non-metal" -plane 0 -1 0 0 0 -1 -height 0.5 -pos -0.5 0 -0.5 -halign right -valign top -font monospace
38 text2brep ts  "Smooth"    -plane 0 -1 0 1 0  0 -height 0.5 -pos -0.5 0 -0.5 -halign left  -valign top -font monospace
39 text2brep tr  "Rough"     -plane 0 -1 0 1 0  0 -height 0.5 -pos  6.5 0 -0.5 -halign right -valign top -font monospace
40 set aLab [XAddShape D tm]
41 SetName D $aLab "Metal"
42 set aLab [XAddShape D tnm]
43 SetName D $aLab "Non-metal"
44 set aLab [XAddShape D ts]
45 SetName D $aLab "Smooth"
46 set aLab [XAddShape D tr]
47 SetName D $aLab "Rough"
48
49 vclear
50 vinit View1 -width 768 -height 768
51 vfront
52 vrenderparams -shadingModel PBR
53 vlight -change 0 -intensity 2.5
54 XDisplay -dispMode 1 D
55 vcamera -ortho
56 vfit
57 vlight -change 1 -intensity 0.0001
58 vdump $::imagedir/${::casename}_ortho0.png
59 vlight -change 1 -intensity 0.3
60 vdump $::imagedir/${::casename}_ortho30.png
61 vcamera -persp
62 vfit
63 vlight -change 1 -intensity 0.0001
64 vdump $::imagedir/${::casename}_persp0.png
65 vlight -change 1 -intensity 0.3
66 vdump $::imagedir/${::casename}_persp30.png
67
68 set aCubeMap [locate_data_file Circus_CubeMap_V.png]
69 vlight -change 1 -intensity 1
70 vbackground -cubemap $aCubeMap
71 vcamera -ortho
72 vdump $::imagedir/${::casename}_orthoenv.png
73 vcamera -persp
74 vdump $::imagedir/${::casename}_perspenv.png