Skip to content

Commit

Permalink
Enable depth peeling in default config (#1102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meakk authored Dec 19, 2023
1 parent 8f6209e commit 6c7b1e0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ if(NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestDefaultConfigFileTIFF DATA logo.tif CONFIG config_build LONG_TIMEOUT DEFAULT_LIGHTS)
f3d_test(NAME TestDefaultConfigFilePLY DATA suzanneRGBA.ply CONFIG config_build LONG_TIMEOUT DEFAULT_LIGHTS THRESHOLD 100)
f3d_test(NAME TestDefaultConfigFileAndCommand DATA suzanne.stl ARGS --up=-Y --camera-direction=-1,0.5,-1 CONFIG config_build LONG_TIMEOUT DEFAULT_LIGHTS)
f3d_test(NAME TestDefaultConfigTranslucent DATA red_translucent_monkey.gltf CONFIG config_build LONG_TIMEOUT DEFAULT_LIGHTS)

# no-background test needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8501
if(VTK_VERSION VERSION_GREATER_EQUAL 9.1.20211007)
Expand Down
2 changes: 2 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ For F3D users:
- Changed `--no-render` behavior so that it doesn't impact verbosity anymore
- Deprecated `--quiet`, use `--verbose=quiet` instead.
- Reading EXR files is now multi-threaded and much faster.
- Translucency support is now enabled by default.
- A small margin is added between the model and the grid to avoid potential z-fighting.

For libf3d users:
- Added `scene.animation.autoplay` option.
Expand Down
5 changes: 4 additions & 1 deletion library/VTKExtensions/Rendering/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,10 @@ void vtkF3DRenderer::ConfigureGridUsingCurrentActors()
{
for (int i = 0; i < 3; i++)
{
double size = bounds[2 * i + 1] - bounds[2 * i];
// a small margin is added to the size to avoid z-fighting if large translucent
// triangles are exactly aligned with the grid bounds
constexpr double margin = 1.0001;
double size = margin * (bounds[2 * i + 1] - bounds[2 * i]);
gridPos[i] = 0.5 * (bounds[2 * i] + bounds[2 * i + 1] - this->UpVector[i] * size);
}
}
Expand Down
3 changes: 2 additions & 1 deletion resources/configs/config.d/10_global.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"filename": true,
"scalars": "",
"camera-direction": "-1,-0.5,-1",
"hdri-ambient": true
"hdri-ambient": true,
"translucency-support": true
}
}
3 changes: 2 additions & 1 deletion resources/configs/thumbnail.d/10_global.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"no-background": true,
"quiet": true,
"scalars": "",
"tone-mapping": true
"tone-mapping": true,
"translucency-support": true
}
}
4 changes: 2 additions & 2 deletions testing/baselines/TestDefaultConfigFileAssimpFBX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/baselines/TestDefaultConfigTranslucent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestThumbnailConfigFileAssimpFBX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/data/red_translucent_monkey.bin
Git LFS file not shown
3 changes: 3 additions & 0 deletions testing/data/red_translucent_monkey.gltf
Git LFS file not shown

0 comments on commit 6c7b1e0

Please sign in to comment.