Skip to content

Commit

Permalink
Use SSIM image comparison (#1544)
Browse files Browse the repository at this point in the history
 - Use vtkImageSSIM when available in the provided VTK version
 - Rework image::compare API by using a better error metrics and drop the diff image
 - Update all baselines that were incorrect and not detected as such because of the previous algorithm
 - Add legacy support for previous VTK version
 - Exclude a few more tests for macOS and sanitizer
 - Update usages in F3D and libf3d
 - Update testing macros and all tests
 - Update doc
 
 All baselines update have been manually validated.
  • Loading branch information
mwestphal authored Aug 17, 2024
1 parent ee81651 commit 7693955
Show file tree
Hide file tree
Showing 81 changed files with 437 additions and 225 deletions.
4 changes: 2 additions & 2 deletions .github/actions/generic-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ runs:
runner.os == 'macOS' &&
inputs.cpu == 'x86_64'
shell: bash
run: echo "F3D_CTEST_EXCEPTIONS=(TestScalarsCell)|(TestXCAFColors)" >> $GITHUB_ENV
run: echo "F3D_CTEST_EXCEPTIONS=(TestDXF)|(TestScalarsCell)|(TestXCAFColors)" >> $GITHUB_ENV

# Certain tests are failing on macOS arm64 for unknown reasons
# https://github.com/f3d-app/f3d/issues/1276
Expand All @@ -213,7 +213,7 @@ runs:
runner.os == 'macOS' &&
inputs.cpu == 'arm64'
shell: bash
run: echo "F3D_CTEST_EXCEPTIONS=(TestDXF)|(TestScalarsCell)|(TestXCAFColors)|(TestGrid)|(TestConfig)|(TestGLTFDracoImporter)" >> $GITHUB_ENV
run: echo "F3D_CTEST_EXCEPTIONS=(TestDepthPeelingToneMapping)|(TestDepthPeeling)|(TestTextureColor)|(TestDXF)|(TestScalarsCell)|(TestXCAFColors)|(TestGrid)|(TestConfig)|(TestGLTFDracoImporter)" >> $GITHUB_ENV

- name: Test
shell: bash
Expand Down
7 changes: 6 additions & 1 deletion .github/actions/sanitizer-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ runs:
shell: bash
run: Xvfb $DISPLAY -screen 0 1280x1024x24 &

# Certain interaction test are failing because sanitizer is slow in CI
- name: Set CI test exception
shell: bash
run: echo "F3D_CTEST_EXCEPTIONS=(TestInteractionAnimationSlow)" >> $GITHUB_ENV

- name: Test
shell: bash
working-directory: ${{github.workspace}}/build
run: |
export LSAN_OPTIONS=suppressions=$(pwd)/../source/.lsan.supp:use_tls=0
export TSAN_OPTIONS=suppressions=$(pwd)/../source/.tsan.supp
ctest -C Release -j 2 --output-on-failure || ctest -C Release -j 1 --rerun-failed -VV
ctest -E "${{ env.F3D_CTEST_EXCEPTIONS }}" -C Release -j 2 --output-on-failure || ctest -E "${{ env.F3D_CTEST_EXCEPTIONS }}" -C Release -j 1 --rerun-failed -VV
- name: Upload Tests Artifact
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion application/F3DOptionsParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct F3DAppOptions
bool NoBackground = false;
bool NoRender = false;
bool Watch = false;
double RefThreshold = 50;
double RefThreshold = 0.05;
double MaxSize = -1.0;

std::vector<int> Resolution{ 1000, 600 };
Expand Down
4 changes: 1 addition & 3 deletions application/F3DStarter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ int F3DStarter::Start(int argc, char** argv)
f3d::image ref(this->Internals->AppOptions.Reference);
f3d::image diff;
double error;
if (!img.compare(ref, this->Internals->AppOptions.RefThreshold, diff, error))
if (!img.compare(ref, this->Internals->AppOptions.RefThreshold, error))
{
if (this->Internals->AppOptions.Output.empty())
{
Expand All @@ -651,8 +651,6 @@ int F3DStarter::Start(int argc, char** argv)
" is higher than the threshold of ", this->Internals->AppOptions.RefThreshold, ".\n");

img.save(this->Internals->AppOptions.Output);
diff.save(
fs::path(this->Internals->AppOptions.Output).replace_extension(".diff.png").string());
}
return EXIT_FAILURE;
}
Expand Down
66 changes: 32 additions & 34 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ f3d_test(NAME TestMHD DATA HeadMRVolume.mhd ARGS --scalars --roughness=1)
f3d_test(NAME TestVTICell DATA waveletMaterial.vti ARGS --scalars=Material -c --roughness=1)
f3d_test(NAME TestSSAO LONG_TIMEOUT DATA suzanne.ply ARGS -q)
f3d_test(NAME TestDepthPeeling DATA suzanne.ply ARGS -sp --opacity=0.9)
f3d_test(NAME TestBackground DATA suzanne.ply ARGS --bg-color=0.8,0.2,0.9 THRESHOLD 100)
f3d_test(NAME TestBackground DATA suzanne.ply ARGS --bg-color=0.8,0.2,0.9 THRESHOLD 0.1) # Threshold is needed for legacy image comparison for VTK 9.3
f3d_test(NAME TestGridWithDepthPeeling DATA suzanne.ply ARGS -gp --opacity=0.2)
f3d_test(NAME TestFilename DATA suzanne.ply ARGS -n)
f3d_test(NAME TestFilenameWhiteBg DATA suzanne.ply ARGS -n --bg-color=1,1,1)
Expand All @@ -168,7 +168,7 @@ f3d_test(NAME TestCameraClipping DATA checkerboard_colorful.obj CONFIG ${F3D_SOU
f3d_test(NAME TestCameraOrthographic ARGS --camera-orthographic DATA cow.vtp)
f3d_test(NAME TestToneMapping DATA suzanne.ply ARGS -t TONE_MAPPING)
f3d_test(NAME TestDepthPeelingToneMapping DATA suzanne.ply ARGS --opacity=0.9 -pt TONE_MAPPING)
f3d_test(NAME TestVolume DATA HeadMRVolume.mhd ARGS -v --camera-position=127.5,-400,127.5 --camera-view-up=0,0,1 LONG_TIMEOUT THRESHOLD 300) # High threshold for volume as it is dependent on the OpenGL implementation
f3d_test(NAME TestVolume DATA HeadMRVolume.mhd ARGS -v --camera-position=127.5,-400,127.5 --camera-view-up=0,0,1 LONG_TIMEOUT)
f3d_test(NAME TestVolumeInverse DATA HeadMRVolume.mhd ARGS -vi --camera-position=127.5,-400,127.5 --camera-view-up=0,0,1 LONG_TIMEOUT)
f3d_test(NAME TestVolumeMag DATA vase_4comp.vti ARGS -vb LONG_TIMEOUT)
f3d_test(NAME TestVolumeComp DATA vase_4comp.vti ARGS -vb --comp=3 LONG_TIMEOUT)
Expand All @@ -185,7 +185,7 @@ f3d_test(NAME TestMultiblockMetaData DATA mb.vtm ARGS -m)
f3d_test(NAME TestTIFF DATA f3d.tif ARGS -sy --up=-Y)
f3d_test(NAME TestLightIntensityBrighter DATA cow.vtp ARGS --light-intensity=5.0)
f3d_test(NAME TestLightIntensityDarker DATA cow.vtp ARGS --light-intensity=0.2)
f3d_test(NAME TestLightIntensityBrighterFullScene DATA WaterBottle.glb ARGS --light-intensity=5.0 THRESHOLD 60)
f3d_test(NAME TestLightIntensityBrighterFullScene DATA WaterBottle.glb ARGS --light-intensity=5.0)
f3d_test(NAME TestLightIntensityDarkerFullScene DATA WaterBottle.glb ARGS --light-intensity=0.2)
f3d_test(NAME TestUTF8 DATA "(ノಠ益ಠ )ノ.vtp")
f3d_test(NAME TestFilenameCommasSpaces DATA "tetrahedron, with commas & spaces.stl")
Expand Down Expand Up @@ -313,15 +313,15 @@ if(NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestDefaultConfigFileVTI DATA vase_4comp.vti CONFIG config_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestDefaultConfigFileSTL DATA suzanne.stl CONFIG config_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestDefaultConfigFileTIFF DATA f3d.tif CONFIG config_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestDefaultConfigFilePLY DATA suzanneRGBA.ply CONFIG config_build LONG_TIMEOUT TONE_MAPPING THRESHOLD 100)
f3d_test(NAME TestDefaultConfigFilePLY DATA suzanneRGBA.ply CONFIG config_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestDefaultConfigFileAndCommand DATA suzanne.stl ARGS --up=-Y --camera-direction=-1,0.5,-1 CONFIG config_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestDefaultConfigTranslucent DATA red_translucent_monkey.gltf CONFIG config_build LONG_TIMEOUT TONE_MAPPING)

file(COPY "${F3D_SOURCE_DIR}/resources/configs/thumbnail.d/" "${F3D_SOURCE_DIR}/plugins/native/configs/thumbnail.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/thumbnail_build.d")
f3d_test(NAME TestThumbnailConfigFileVTU DATA dragon.vtu CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestThumbnailConfigFileVTI DATA vase_4comp.vti CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestThumbnailConfigFileSTL DATA suzanne.stl CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestThumbnailConfigFilePLY DATA suzanneRGBA.ply CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING THRESHOLD 100)
f3d_test(NAME TestThumbnailConfigFilePLY DATA suzanneRGBA.ply CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
endif()

# color texture with opacity needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9467
Expand Down Expand Up @@ -396,14 +396,14 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220)
f3d_test(NAME TestHDRIBlurCoCSmall DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=10 --camera-position=-20,0,20)
f3d_test(NAME TestHDRIBlurCoCMedium DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=50 --camera-position=-20,0,20)
f3d_test(NAME TestHDRIBlurCoCLarge DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=100 --camera-position=-20,0,20)
f3d_test(NAME TestHDRIBlurCoCZero DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=0 --camera-position=-20,0,20 THRESHOLD 75)
f3d_test(NAME TestHDRIBlurCoCZero DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=0 --camera-position=-20,0,20 THRESHOLD 0.08) # Threshold is needed for legacy comparison method for VTK 9.3
f3d_test(NAME TestHDRIBlurCoCNegative DATA suzanne.ply HDRI shanghai_bund_1k.hdr ARGS -u --blur-coc=-100 --camera-position=-20,0,20)
f3d_test(NAME TestHDRIBlurRatio DATA suzanne.ply HDRI palermo_park_1k.hdr RESOLUTION 600,100 ARGS -u)
f3d_test(NAME TestHDRIEdges DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -e THRESHOLD 60)
f3d_test(NAME TestHDRIEdges DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -e)
f3d_test(NAME TestHDRI8Bit DATA suzanne.ply HDRI f3d.tif ARGS --color=1.0,0.0,0.0)
f3d_test(NAME TestHDRIOrient DATA suzanne.stl HDRI palermo_park_1k.hdr ARGS --up=+Z)
f3d_test(NAME TestHDRIToneMapping DATA suzanne.ply HDRI palermo_park_1k.hdr TONE_MAPPING ARGS -t)
f3d_test(NAME TestInteractionHDRIMove DATA suzanne.ply HDRI palermo_park_1k.hdr INTERACTION THRESHOLD 60) #Shift+MouseRight;
f3d_test(NAME TestInteractionHDRIMove DATA suzanne.ply HDRI palermo_park_1k.hdr INTERACTION) #Shift+MouseRight;
f3d_test(NAME TestInteractionHDRIBlur DATA suzanne.ply HDRI palermo_park_1k.hdr INTERACTION) #U
f3d_test(NAME TestInteractionHDRIReload DATA suzanne.ply HDRI palermo_park_1k.hdr INTERACTION) #Up
f3d_test(NAME TestInteractionHDRIChange DATA multi HDRI palermo_park_1k.hdr CONFIG ${F3D_SOURCE_DIR}/testing/configs/complex.json INTERACTION) #Left
Expand All @@ -415,7 +415,7 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220)
f3d_test(NAME TestInvalidHDRI DATA cow.vtp HDRI invalid.png REGEXP "Cannot open HDRI file" NO_BASELINE)

# Use a dummy HDRI for simplicity to test default HDRI
f3d_test(NAME TestHDRIDefault DATA suzanne.ply HDRI dummy.png THRESHOLD 110)
f3d_test(NAME TestHDRIDefault DATA suzanne.ply HDRI dummy.png THRESHOLD 0.11) # Threshold is needed for legacy comparison method for VTK 9.3

configure_file("${F3D_SOURCE_DIR}/testing/configs/hdri.json.in" "${CMAKE_BINARY_DIR}/hdri.json")
f3d_test(NAME TestConfigFileHDRI DATA dragon.vtu CONFIG "${CMAKE_BINARY_DIR}/hdri.json" LONG_TIMEOUT)
Expand All @@ -438,17 +438,17 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220)

if(F3D_MODULE_RAYTRACING)
# XXX: These tests are impacted by https://github.com/f3d-app/f3d/issues/933
f3d_test(NAME TestHDRIRaytracing DATA suzanne.ply HDRI palermo_park_1k.hdr THRESHOLD 120 ARGS -r --samples=1)
f3d_test(NAME TestHDRIRaytracingSkyboxOnly DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-skybox -r --samples=1 LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracingAmbientOnly DATA suzanne.ply THRESHOLD 120 ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-ambient -r --samples=1 LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracingAmbientOnlyNoBackground DATA suzanne.ply THRESHOLD 120 ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-ambient -r --samples=1 --no-background LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracingNone DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -r --samples=1 LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracing DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -rd --samples=4)
f3d_test(NAME TestHDRIRaytracingSkyboxOnly DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-skybox -rd --samples=4)
f3d_test(NAME TestHDRIRaytracingAmbientOnly DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-ambient -rd --samples=4 LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracingAmbientOnlyNoBackground DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr --hdri-ambient -rd --samples=4 --no-background LONG_TIMEOUT)
f3d_test(NAME TestHDRIRaytracingNone DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -rd --samples=4)

f3d_test(NAME TestInteractionHDRIRaytracingRemoveSkybox DATA suzanne.ply HDRI palermo_park_1k.hdr THRESHOLD 120 ARGS -r --samples=1 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingRemoveAmbient DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -r --samples=1 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingRemoveBoth DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -r --samples=1 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingLoop DATA suzanne.ply HDRI palermo_park_1k.hdr THRESHOLD 120 ARGS -r --samples=1 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingFullFromNone DATA suzanne.ply THRESHOLD 120 ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -r --samples=1 LONG_TIMEOUT INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingRemoveSkybox DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -rd --samples=4 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingRemoveAmbient DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -rd --samples=4 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingRemoveBoth DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -rd --samples=4 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingLoop DATA suzanne.ply HDRI palermo_park_1k.hdr ARGS -rd --samples=4 INTERACTION)
f3d_test(NAME TestInteractionHDRIRaytracingFullFromNone DATA suzanne.ply ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -rd --samples=4 INTERACTION)

endif()
endif()
Expand All @@ -464,23 +464,24 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20230603)
endif()

if(F3D_MODULE_RAYTRACING)
f3d_test(NAME TestRaytracingGLTF DATA WaterBottle.glb ARGS -r --samples=1)
f3d_test(NAME TestRaytracingBackground DATA suzanne.ply ARGS -r --samples=1 --bg-color=1,0,0)
f3d_test(NAME TestRaytracingPointCloud DATA pointsCloud.vtp THRESHOLD 120 ARGS -r --point-size=20)
f3d_test(NAME TestRaytracingDenoise DATA suzanne.ply THRESHOLD 120 ARGS -rd --samples=1)
f3d_test(NAME TestRaytracingGLTF DATA WaterBottle.glb ARGS -rd --samples=4)
f3d_test(NAME TestRaytracingBackground DATA suzanne.ply ARGS -rd --samples=4 --bg-color=1,0,0)
f3d_test(NAME TestRaytracingPointCloud DATA pointsCloud.vtp ARGS -rd --samples=4 --point-size=20 THRESHOLD 0.1) # Threshold needed because of difference in rendering in VTK 9.3
f3d_test(NAME TestRaytracingDenoise DATA suzanne.ply ARGS -rd --samples=4)
f3d_test(NAME TestRaytracingNoDenoise DATA suzanne.ply ARGS -r --samples=20)
f3d_test(NAME TestVersionRaytracing ARGS --version REGEXP "Raytracing module: ON")
f3d_test(NAME TestInteractionRaytracingDenoise DATA suzanne.ply THRESHOLD 120 ARGS --samples=1 INTERACTION) #RD
f3d_test(NAME TestRaytracingScalarBar DATA dragon.vtu ARGS -rsb --samples=1)
f3d_test(NAME TestInteractionRaytracingDenoise DATA suzanne.ply ARGS --samples=4 INTERACTION) #RD
f3d_test(NAME TestRaytracingScalarBar DATA dragon.vtu ARGS -rsbd --samples=4 THRESHOLD 0.06) # Threshold needed because of difference in rendering in VTK 9.3 on macOS

if(NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestRaytracingDefaultConfigFile DATA dragon.vtu THRESHOLD 150 CONFIG config_build ARGS -r --samples=1 LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestRaytracingThumbnailConfigFile DATA dragon.vtu THRESHOLD 100 CONFIG thumbnail_build ARGS -r --samples=1 LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestRaytracingDefaultConfigFile DATA dragon.vtu CONFIG config_build ARGS -rd --samples=4 LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestRaytracingThumbnailConfigFile DATA dragon.vtu CONFIG thumbnail_build ARGS -rd --samples=4 LONG_TIMEOUT TONE_MAPPING)
endif()

f3d_test(NAME TestRaytracingNoBackground DATA suzanne.ply ARGS -r --samples=1 --no-background)
f3d_test(NAME TestRaytracingNoBackground DATA suzanne.ply ARGS -rd --samples=4 --no-background LONG_TIMEOUT)

else(F3D_MODULE_RAYTRACING)
f3d_test(NAME TestInteractionRaytracingDenoiseNoRaytracing DATA suzanne.ply ARGS INTERACTION NO_BASELINE REGEXP "Raytracing options can't be used if F3D has not been built with raytracing") #RD
f3d_test(NAME TestInteractionRaytracingDenoiseNoRaytracing DATA suzanne.ply INTERACTION NO_BASELINE REGEXP "Raytracing options can't be used if F3D has not been built with raytracing") #RD
endif()

if(F3D_MODULE_EXTERNAL_RENDERING)
Expand All @@ -506,7 +507,7 @@ if(F3D_PLUGIN_BUILD_ASSIMP)
f3d_test(NAME TestOFF DATA teapot.off ARGS --up=+Z --load-plugins=assimp)
f3d_test(NAME Test3MF DATA cube_gears.3mf ARGS --load-plugins=assimp)
f3d_test(NAME TestFBX DATA phong_cube.fbx ARGS --load-plugins=assimp)
f3d_test(NAME TestFBX16bits DATA 16bit.fbx ARGS --load-plugins=assimp THRESHOLD 70)
f3d_test(NAME TestFBX16bits DATA 16bit.fbx ARGS --load-plugins=assimp)
f3d_test(NAME TestVerboseCameraAssimp DATA duck.dae ARGS --verbose --load-plugins=assimp NO_BASELINE REGEXP "camera1")

if(NOT APPLE OR VTK_VERSION VERSION_GREATER_EQUAL 9.3.0)
Expand Down Expand Up @@ -663,10 +664,7 @@ if(F3D_PLUGIN_BUILD_USD)

f3d_test(NAME TestUSDZAnimated DATA AnimatedCube.usdz ARGS --load-plugins=usd --animation-time=0.3 --animation-progress)
f3d_test(NAME TestUSDZRigged DATA RiggedSimple.usdz ARGS --load-plugins=usd --animation-time=0.3)

# The threshold is quite high because of macos
# However, the PNSR is >30db which is acceptable
f3d_test(NAME TestUSDZMaterials DATA McUsd.usdz ARGS --load-plugins=usd --camera-position=1055,912,-247 --camera-focal-point=69,173,63 THRESHOLD 280)
f3d_test(NAME TestUSDZMaterials DATA McUsd.usdz ARGS --load-plugins=usd --camera-position=1055,912,-247 --camera-focal-point=69,173,63 THRESHOLD 0.3) # High threshold because of legacy comparison methods in VTK 9.3

if(NOT F3D_MACOS_BUNDLE)
file(COPY "${F3D_SOURCE_DIR}/plugins/usd/configs/config.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/config_build.d")
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When contributing to F3D, it is necessary that new code is covered by a test in
### Application layer

All application tests are initiated via the `CTest` (https://cmake.org/cmake/help/book/mastering-cmake/chapter/Testing%20With%20CMake%20and%20CTest.html) testing framework.
`CTest` runs `f3d` with the `--output` and `--ref` arguments which renders an output image and compares it to a reference image. F3D compares the differences between the 2 images and generates a diff file if there are differences between the images.
`CTest` runs `f3d` with the `--output` and `--ref` arguments which renders an output image and compares it to a reference image. F3D compares the differences between the 2 images and compute a difference value and compare it to a threshold to check if a test passes or not.

All aspects of the application test framework are handled in `application/testing/CMakeLists.txt`.

Expand Down
2 changes: 1 addition & 1 deletion doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Options|Description
Options|Default|Description
------|------|------
\-\-ref=\<png file\>||Render and compare with the provided *reference image*, for testing purposes. Use with output option to generate new baselines and diff images.
\-\-ref-threshold=\<threshold\>|50|Set the *comparison threshold* to trigger a test failure or success. The default (50) correspond to almost visually identical images.
\-\-ref-threshold=\<threshold\>|0.05|Set the *comparison threshold* to trigger a test failure or success. The default (0.05) correspond to almost visually identical images.
\-\-interaction-test-record=\<log file\>||Path to an interaction log file to *record interaction events* to.
\-\-interaction-test-play=\<log file\>||Path to an interaction log file to *play interactions events* from when loading a file.

Expand Down
3 changes: 1 addition & 2 deletions examples/libf3d/cpp/render-image/check.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ int main(int argc, char** argv)
f3d::image img1(argv[2]);

// Compare them
f3d::image diff;
double error;
return img0.compare(img1, 50, diff, error) ? EXIT_SUCCESS : EXIT_FAILURE;
return img0.compare(img1, 50, error) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Loading

0 comments on commit 7693955

Please sign in to comment.