1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0032208: Tests - refactor visualization tests to cover several graphic drivers

Removed testgrids 'bugs/vis' and '3rdparty'; tests have been redistributed across other grids.
Moved testgrid 'v3d/ivtk' into dedicated 'vtk/ivtk'.

Added testgrid 'vselect' dedicated to 3D viewer picking/selection functionality
and filled with tests from 'v3d/vertex', 'v3d/face' and similar groups.

Added testgrid 'opengl' dedicated to OpenGL driver low-level functionality (GLSL programs and similar)
and filled with tests from 'v3d/glsl', 'v3d/raytrace', '3rdparty/fonts', 'bugs/vis' (portion) and similar.

Added testgrid 'opengles3' dedicated to OpenGL ES 3.0 driver low-level functionality
and reusing tests from 'opengl' testgrid.
Subgroup 'opengles3/raytrace' is disabled on Windows, as Ray-Tracing currently requires OpenGL ES 3.2.
while ANGLE library implements only OpenGL ES 3.0.

Added testgrid 'opengles2' dedicated to OpenGL ES 2.0 driver low-level functionality
and reusing a limited subset of passing tests from 'opengl' testgrid.
Currently testgrid is activated only on Windows platform when using ANGLE library
(properietary OpenGL ES drivers do not allow creation of restricted 2.0 context).

Test cases have been cleaned out to put bug description into log,
to properly load necessary plugins and to explicitly dump viewer.
This commit is contained in:
kgv
2021-03-22 12:29:04 +03:00
committed by bugmaster
parent a076535090
commit 0d828ac838
1891 changed files with 4279 additions and 6199 deletions

View File

@@ -0,0 +1,42 @@
puts "========"
puts "Transparency - check different blend operators"
puts "========"
# custom shapes
set aShape1 [locate_data_file occ/Top.brep]
set aShape2 [locate_data_file occ/Bottom.brep]
pload MODELING VISUALIZATION
vinit View1
vsetdispmode 1
vbackground -gradient B4B4B4 WHITE -gradientMode VERTICAL
restore $aShape1 s1
restore $aShape2 s2
vdisplay s1
vdisplay s2
vsettransparency s1 0.5
vsettransparency s2 0.5
# check blending artifacts
vviewparams -scale 4.519 -at 93.051 -88.513 17.789 -eye -156.923 -151.929 6.147 -up -0.246 0.969 0.002
vrenderparams -oit off
vdump $imagedir/${casename}_blend_artifacts_unordered.png
vrenderparams -oit 1.0
vdump $imagedir/${casename}_blend_artifacts_oit.png
# check depth occlusion
vsetcolor s1 red
vsetcolor s2 black
vviewparams -scale 5.807 -at -59.913 -276.799 -4.312 -eye -69.465 -20.350 23.739 -up 0.999 0.038 -0.009
vrenderparams -oit off
vdump $imagedir/${casename}_occlusion_unordered.png
vrenderparams -oit 0.0
vdump $imagedir/${casename}_occlusion_oit_nodepth.png
vrenderparams -oit 1.0
vdump $imagedir/${casename}_occlusion_oit.png

View File

@@ -0,0 +1,29 @@
puts "==========="
puts "OCC28127"
puts "Visualization - transparent object breaks Z-Layer depth buffer clear"
puts "==========="
puts ""
pload MODELING VISUALIZATION
box r 0 0 0 1 0.1 1
box g 0 0.2 0 1 0.1 1
box b 0 0.4 0 1 0.1 1
vclear
vinit View1
vaxo
vdisplay -noupdate -dispMode 1 -top r g b
vsetcolor -noupdate r RED
vsetcolor -noupdate g GREEN
vsetcolor -noupdate b BLUE
vfit
vdisplay -topmost g
vzbufftrihedron -on -position left_upper
vsettransparency b 0.5
if { [vreadpixel 150 150 rgb name] != "GREEN2" } { puts "Error: wrong color - GREEN box should overlap RED one" }
if { [vreadpixel 84 64 rgb name] == "RED2" } { puts "Error: wrong color - Trihedron should overlap RED box" }
vdump $imagedir/${casename}.png

View File

@@ -0,0 +1,25 @@
puts "============"
puts "0032143: Visualization - add option excluding transparent object from sorting"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1 -width 512 -height 512
vbackground -gradient GRAY20 GRAY80
restore [locate_data_file Ball.brep] b
vdisplay -dispMode 1 b
vfit
set dx 220; set dy 74
set logoPath "$::env(CSF_OCCTResourcePath)/DrawResources/OCC_logo.png"
box logo $dx $dy 0 -preview
vdisplay -dispMode 1 logo -topmost -2d bottomRight [expr $dx+25] 25
vtexture logo "$logoPath"
vaspects logo -alphaMode BLEND -shadingModel UNLIT
vdisplay logo -underlay
if { [vreadpixel 320 440 -rgb -name] != "DEEPSKYBLUE3" && [vreadpixel 320 440 -rgb -name] != "TURQUOISE2" } { puts "Error: Unexpected color for BLEND" }
vaspects logo -alphaMode MASKBLEND 0.001 -shadingModel UNLIT
if { [vreadpixel 320 440 -rgb -name] != "DARKGOLDENROD" } { puts "Error: Unexpected color for MASKBLEND" }
vdump ${imagedir}/${casename}.png

View File

@@ -0,0 +1,18 @@
puts "========"
puts "Transparency - shading highlight"
puts "========"
pload MODELING VISUALIZATION
psphere s 1
vinit View1
vdisplay -dispMode 1 s
vfit
vsettransparency s 0.5
vrenderparams -oit 0
vselprops dynHighlight -dispMode -1
vmoveto 250 250
checkcolor 250 250 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting is broken."
}
vdump $imagedir/${casename}.png

View File

@@ -0,0 +1,51 @@
puts "========"
puts "0031284: Visualization - XCAFDoc_VisMaterialPBR lacks Index of Refraction"
puts "========"
pload MODELING XDE OCAF VISUALIZATION
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
box b 0.5 1.0 -0.5 3 1 1
psphere s1 0.5
psphere s2 0.5
psphere s3 0.5
ttranslate s1 1 0 0
ttranslate s2 2 0 0
ttranslate s3 3 0 0
Close D -silent
XNewDoc D
set l0 [XAddShape D b 0]
set l1 [XAddShape D s1 0]
set l2 [XAddShape D s2 0]
set l3 [XAddShape D s3 0]
XAddVisMaterial D m1 -baseColor GREEN -refractionIndex 1.0 -transparency 0.5 -metallic 0 -roughness 0
XAddVisMaterial D m2 -baseColor GREEN -refractionIndex 1.3 -transparency 0.5 -metallic 0 -roughness 0
XAddVisMaterial D m3 -baseColor GREEN -refractionIndex 2.5 -transparency 0.5 -metallic 0 -roughness 0
XSetVisMaterial D $l1 m1
XSetVisMaterial D $l2 m2
XSetVisMaterial D $l3 m3
vclear
vinit View1
vcamera -persp
vfront
XDisplay -dispMode 1 D
vfit
vviewparams -scale 245 -proj -0 -0.75 -0.66 -up 0 -0.66 0.75 -at 2.0 0.84 0.04
vlight -change 0 -intensity 2.5
vlight -change 1 -intensity 1.0
set aCubeMap [locate_data_file Circus_CubeMap_V.png]
vbackground -cubemap $aCubeMap
vrenderparams -shadingModel PBR -raster
vdump $imagedir/${casename}_pbr.png
if { ![string match "OpenGL ES 2.0*" [vglinfo VERSION]] && ![string match "OpenGL ES 3.0*" [vglinfo VERSION]] } {
vrenderparams -raytrace -gi 0 -reflections 1 -rayDepth 10
vfps 200
vdump $imagedir/${casename}_rt.png
vrenderparams -raytrace -gi 1
vfps 200
vdump $imagedir/${casename}_pt.png
}

View File

@@ -0,0 +1,60 @@
puts "========"
puts "0031571: Visualization, TKOpenGl - provide depth peeling OIT option"
puts "========"
pload MODELING VISUALIZATION
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
# create objects
pcylinder c 0.5 1
box b1 -1 -1 -0.5 1 1 1
box b2 0 0 -0.5 1 1 1
box b3 -1 0 -0.5 1 1 1
vclear
vinit View1
vdisplay -dispMode 1 c b1 b2 b3
vaspects c -color yellow -transparency 0.4
vaspects b1 -color blue -transparency 0.8
vaspects b2 -color green -transparency 0.0
vaspects b3 -color red -transparency 0.5
vfit
vaxo
vzoom 0.9
if { ![string match "OpenGL ES 2.0*" [vglinfo VERSION]] && ![string match "OpenGL ES 3.0*" [vglinfo VERSION]] } {
vraytrace 1
vrenderparams -rayDepth 10
vdump $imagedir/${casename}_raytrace.png
}
vraytrace 0
vrenderparams -oit off
vdump $imagedir/${casename}_nooit.png
vrenderparams -oit weight 0.0
vdump $imagedir/${casename}_weight.png
vrenderparams -oit peeling 4
vdump $imagedir/${casename}_peel.png
# VTK viewer, just for comparison
set hasVtk 0
if { [vdriver -default] == "TKOpenGl" } {
set hasVtk 1
if { [catch { pload VIS }] } { set hasVtk 0 }
}
if { $hasVtk == 1 } {
ivtkinit -msaa 0 -srgb 0
ivtkdisplay c b1 b2 b3
ivtkaxo
ivtksetdispmode 1
ivtksetcolor c yellow
ivtksetcolor b1 blue
ivtksetcolor b2 green
ivtksetcolor b3 red
ivtksettransparency c 0.4
ivtksettransparency b1 0.8
ivtksettransparency b2 0.0
ivtksettransparency b3 0.5
ivtkrenderparams -depthPeeling 4
ivtkdump $imagedir/${casename}_vtk.png
}

View File

@@ -0,0 +1,70 @@
puts "========"
puts "Test various Shading Models assigned per-object with transparency"
puts "========"
pload MODELING VISUALIZATION
# PBR doesn't work with Compatible Profile on macOS
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
# setup viewer
vclear
vclose ALL
vinit View1 -width 912 -height 912
# define spheres with a rough triangulation to easily distinguish Shading Models
psphere p0 10
box b0 4 4 4
copytranslate p11 p0 0 0 0
copytranslate b11 b0 0 0 0
copytranslate p12 p0 40 0 0
copytranslate b12 b0 40 0 0
copytranslate p21 p0 0 20 0
copytranslate b21 b0 0 20 0
copytranslate p22 p0 40 20 0
copytranslate b22 b0 40 20 0
copytranslate p31 p0 0 40 0
copytranslate b31 b0 0 40 0
copytranslate p32 p0 40 40 0
copytranslate b32 b0 40 40 0
compound p11 p12 p21 p22 p31 p32 b11 b12 b21 b22 b31 b32 ss
incmesh ss 1
vdefaults -autoTriang 0
# display objects
vdisplay -dispMode 1 p11 p12 p21 p22 p31 p32 b11 b12 b21 b22 b31 b32
vdrawparray p41 triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 75 0 v 0 55 20 v 0 55 0 v 0 55 20 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
vdrawparray p42 triangles v 40 55 0 v 40 75 0 v 60 55 0 v 40 55 0 v 40 75 0 v 40 55 20 v 40 55 0 v 40 55 20 v 60 55 0 v 40 75 0 v 40 55 20 v 60 55 0
vtop
vrotate -0.9 0.1 0
vfit
set aMatProps "-setMaterial DIAMOND -setColor GRAY70 -setTransparency 0.8"
# customize shading models
vaspects b11 b12 b21 b22 b31 b32 -setShadingModel FRAGMENT -setColor RED
vaspects p11 -setShadingModel VERTEX {*}$aMatProps
vdrawtext t11 Graphic3d_TOSM_VERTEX -pos 10 5 10 -color RED -aspect BOLD
vaspects p12 -setShadingModel FRAGMENT {*}$aMatProps
vdrawtext t12 Graphic3d_TOSM_FRAGMENT -pos 50 5 10 -color RED -aspect BOLD
vaspects p21 -setShadingModel PBR {*}$aMatProps
vdrawtext t21 Graphic3d_TOSM_PBR -pos 10 25 10 -color RED -aspect BOLD
vaspects p22 -setShadingModel PBR_FACET {*}$aMatProps
vdrawtext t22 Graphic3d_TOSM_PBR_FACET -pos 50 25 10 -color RED -aspect BOLD
vaspects p31 -setShadingModel UNLIT {*}$aMatProps
vdrawtext t31 Graphic3d_TOSM_UNLIT -pos 10 45 10 -color RED -aspect BOLD
vaspects p32 -setShadingModel FACET {*}$aMatProps
vdrawtext t32 Graphic3d_TOSM_FACET -pos 50 45 10 -color RED -aspect BOLD
vaspects p41 -setShadingModel VERTEX {*}$aMatProps
vdrawtext t41 Graphic3d_TOSM_VERTEX -pos 10 65 10 -color RED -aspect BOLD
vaspects p42 -setShadingModel FACET {*}$aMatProps
vdrawtext t42 Graphic3d_TOSM_FACET -pos 50 65 10 -color RED -aspect BOLD
vdisplay -topmost t11 t12 t21 t22 t31 t32 t41 t42
vlight -change 0 -intensity 1.0
vlight -change 1 -intensity 0.5
vrenderparams -shadingModel pbr
vdump $::imagedir/${::casename}.png