mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
Ray-Tracing now handles IBL and background cubemaps in similar way as PBR. Ambient light source is handled by Ray-Tracing in similar way as PBR, e.g. as coefficient for environment map (IBL) or as constant light source. Test script generating PBR spheres has been moved to Samples and now shared by PBR and Path-Tracing tests.
92 lines
2.9 KiB
Tcl
92 lines
2.9 KiB
Tcl
# Script demonstrating PBR metallic-roughness material properties
|
|
#Category: Visualization
|
|
#Title: PBR metallic-rougness spheres
|
|
|
|
pload XDE OCAF MODELING VISUALIZATION
|
|
psphere s 0.35
|
|
|
|
catch { Close D }
|
|
XNewDoc D
|
|
|
|
# grid of spheres
|
|
set THE_UPPER 6
|
|
foreach i [list 0 3] {
|
|
set aPrefix ""
|
|
set aColor "GRAY80"
|
|
if { $i != 0 } {
|
|
set aPrefix "g_";
|
|
set aColor "CCB11D"
|
|
}
|
|
set aColShapes {}
|
|
for { set m 0 } { $m <= $THE_UPPER } { incr m } {
|
|
set aRowShapes {}
|
|
for { set r 0 } { $r <= $THE_UPPER } { incr r } {
|
|
set aName ${aPrefix}m${m}r${r}
|
|
copy s $aName
|
|
lappend aRowShapes $aName
|
|
ttranslate $aName ${r} ${i} ${m}
|
|
}
|
|
set aName ${aPrefix}m${m}
|
|
compound {*}$aRowShapes $aName
|
|
lappend aColShapes $aName
|
|
}
|
|
set aName ${aPrefix}spheres
|
|
compound {*}$aColShapes $aName
|
|
set aLabName "Gray Spheres"
|
|
if { $i != 0 } { set aLabName "Golden Spheres" }
|
|
set aLabComp [XAddShape D $aName 0]
|
|
SetName D $aLabComp $aLabName
|
|
|
|
for { set m 0 } { $m <= $THE_UPPER } { incr m } {
|
|
set aMet [expr 100 * ${m}/$THE_UPPER]
|
|
set aName ${aPrefix}m${m}
|
|
XAddComponent D $aLabComp $aName
|
|
set aLabCompCol [XFindShape D $aName]
|
|
SetName D $aLabCompCol "${aPrefix}m${aMet}%"
|
|
SetName D {*}[XFindComponent D $aName] "${aPrefix}m${aMet}%"
|
|
for { set r 0 } { $r <= $THE_UPPER } { incr r } {
|
|
set aRoug [expr 100 * ${r}/$THE_UPPER]
|
|
set aName ${aPrefix}m${m}r${r}
|
|
XAddComponent D $aLabCompCol $aName
|
|
set aLab [XFindComponent D $aName]
|
|
SetName D {*}$aLab "${aPrefix}m${aMet}%_r${aRoug}%"
|
|
XAddVisMaterial D $aName -baseColor $aColor -metallic ${m}/$THE_UPPER -roughness ${r}/$THE_UPPER
|
|
XSetVisMaterial D {*}$aLab $aName
|
|
}
|
|
}
|
|
}
|
|
set aLab [XFindShape D s]
|
|
SetName D {*}$aLab "Sphere"
|
|
|
|
XGetAllVisMaterials D
|
|
|
|
# labels
|
|
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
|
|
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
|
|
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
|
|
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
|
|
compound tm tnm ts tr labs
|
|
set aLab [XAddShape D labs 0]
|
|
SetName D $aLab "Labels"
|
|
XAddComponent D $aLab tm
|
|
XAddComponent D $aLab tnm
|
|
XAddComponent D $aLab ts
|
|
XAddComponent D $aLab tr
|
|
SetName D {*}[XFindComponent D tm] "Metal"
|
|
SetName D [XFindShape D tm] "Metal"
|
|
SetName D {*}[XFindComponent D tnm] "Non-metal"
|
|
SetName D [XFindShape D tnm] "Non-metal"
|
|
SetName D {*}[XFindComponent D ts] "Smooth"
|
|
SetName D [XFindShape D ts] "Smooth"
|
|
SetName D {*}[XFindComponent D tr] "Rough"
|
|
SetName D [XFindShape D tr] "Rough"
|
|
|
|
vclear
|
|
vinit View1 -width 768 -height 768
|
|
vfront
|
|
vrenderparams -shadingModel PBR
|
|
vlight -change 0 -intensity 2.5
|
|
XDisplay -dispMode 1 D
|
|
vcamera -ortho
|
|
vfit
|