2 puts "0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model"
3 puts "Spheres grid with different roughness values"
6 pload XDE OCAF MODELING VISUALIZATION
14 foreach i [list 0 3] {
22 for { set m 0 } { $m <= $THE_UPPER } { incr m } {
24 for { set r 0 } { $r <= $THE_UPPER } { incr r } {
25 set aName ${aPrefix}m${m}r${r}
27 lappend aRowShapes $aName
28 ttranslate $aName ${r} ${i} ${m}
30 set aName ${aPrefix}m${m}
31 compound {*}$aRowShapes $aName
32 lappend aColShapes $aName
34 set aName ${aPrefix}spheres
35 compound {*}$aColShapes $aName
36 set aLabName "Gray Spheres"
37 if { $i != 0 } { set aLabName "Golden Spheres" }
38 set aLabComp [XAddShape D $aName 0]
39 SetName D $aLabComp $aLabName
41 for { set m 0 } { $m <= $THE_UPPER } { incr m } {
42 set aMet [expr 100 * ${m}/$THE_UPPER]
43 set aName ${aPrefix}m${m}
44 XAddComponent D $aLabComp $aName
45 set aLabCompCol [XFindShape D $aName]
46 SetName D $aLabCompCol "${aPrefix}m${aMet}%"
47 SetName D {*}[XFindComponent D $aName] "${aPrefix}m${aMet}%"
48 for { set r 0 } { $r <= $THE_UPPER } { incr r } {
49 set aRoug [expr 100 * ${r}/$THE_UPPER]
50 set aName ${aPrefix}m${m}r${r}
51 XAddComponent D $aLabCompCol $aName
52 set aLab [XFindComponent D $aName]
53 SetName D {*}$aLab "${aPrefix}m${aMet}%_r${aRoug}%"
54 XAddVisMaterial D $aName -baseColor $aColor -metallic ${m}/$THE_UPPER -roughness ${r}/$THE_UPPER
55 XSetVisMaterial D {*}$aLab $aName
59 set aLab [XFindShape D s]
60 SetName D {*}$aLab "Sphere"
65 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
66 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
67 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
68 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
69 compound tm tnm ts tr labs
70 set aLab [XAddShape D labs 0]
71 SetName D $aLab "Labels"
72 XAddComponent D $aLab tm
73 XAddComponent D $aLab tnm
74 XAddComponent D $aLab ts
75 XAddComponent D $aLab tr
76 SetName D {*}[XFindComponent D tm] "Metal"
77 SetName D [XFindShape D tm] "Metal"
78 SetName D {*}[XFindComponent D tnm] "Non-metal"
79 SetName D [XFindShape D tnm] "Non-metal"
80 SetName D {*}[XFindComponent D ts] "Smooth"
81 SetName D [XFindShape D ts] "Smooth"
82 SetName D {*}[XFindComponent D tr] "Rough"
83 SetName D [XFindShape D tr] "Rough"
86 vinit View1 -width 768 -height 768
88 vrenderparams -shadingModel PBR
89 vlight -change 0 -intensity 2.5
90 XDisplay -dispMode 1 D
93 vlight -change 1 -intensity 0.0001
94 vdump $::imagedir/${::casename}_ortho0.png
95 vlight -change 1 -intensity 0.3
96 vdump $::imagedir/${::casename}_ortho30.png
99 vlight -change 1 -intensity 0.0001
100 vdump $::imagedir/${::casename}_persp0.png
101 vlight -change 1 -intensity 0.3
102 vdump $::imagedir/${::casename}_persp30.png
104 set aCubeMap [locate_data_file Circus_CubeMap_V.png]
105 vlight -change 1 -intensity 1
106 vbackground -cubemap $aCubeMap
108 vdump $::imagedir/${::casename}_orthoenv.png
110 vdump $::imagedir/${::casename}_perspenv.png