Commit 93d49a24 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

fix tile display with translucent geometry

Since vtkIceTCompositePass renders to full window irrespective of
renderer's viewport, need to make sure that the vtkRenderer's viewport
is updated to full size as well, otherwise internal passes like depth
peeling can have issues when rendering on tile displays.

Fixes #18978

Updating TileDisplaySplitView to test translucent geomtry. Also added
support to render larger tiles for better test image comparison.
parent 4de48b3a
50decef3f4c1d3330d7e1cc3213c2dbcc237b0a09f68a79e7401e14c38be1c5c8cae9196ab6bb96ee3f2ebe746d1e6352b778d8b0c19ebc66105c801ae768ea3
fb41237c12021f0fbbe09a49e64104da10126e0197b684be31080b056f386d459f942c6dff163a065a453d9da5bbe2c0473f9a77b1fd1469140f4b53575846ac
2c9f4f8ea337006385ad6d57d15bbe52fea15209868af6e00303d84448838bd3fcccb1110620cbb1a8f3b2dbe2aca83212a20a4871f98f737921f701ecd32ab0
b5a3892e71a289dd193cd4ffc56499c4cdada4416fa6acfbf8bb1a4abe031d0498624b804415d0e4752cdcb68eb5a9de52a317c329fe8836e215ef15c2101b06
f07129d6acc00632ae7fdd1b0fcad6d86835de02eec050badde774d36b85e1b6226dc5d76d5e92fb8fb6ad0bdcc4f9c2baf25a1252d1e7115efb316eb20abb6e
68967ebf07ac5818b252310aea29bf802cc6dc3656c13265e01df416303129d82a01a4ee49a280db4995a0c8a95f596cbbcb6bb3945356e0ffd34cad79b6d771
b6c3f261de95d8fb48202eed4a85e0103fb6bc71a79cbb88cb74f4116922c2e1a6ad06a45f7f100dc7dd77b07cb27b4161fb45b32355d945a9330ef88d985630
09bb813273416042463d7aa74040a165292288ba6cd6dc1b012ba994b2c3ef87d37ce6452848b08fc853161051d08a9a1548875ef368728666a211807c292134
93e38a7eaed85aa8b2209c72197582ec0548a53fb859e7b79f31bbe2c33ff2345f8c2d7ab0f00ac75618982245561dc4b5a70ce383b50bd27d4529701c4428a1
e15f4af962b79e60848344f20f504ddde0897672c0b9b0ff195ffba515517a04e019c86a96c2e0b7cd0c30a1e4b1fc2e19247b930f0d977a2db88089fa5d55e5
e84de4f679861df40da6c2225dee616512787f2bff408c96d3bb120512f9158ef2c0e749d0778790d6f04fd97cc0331680d46a6894c96bb8a1bbd7d6e9a9fb44
92a42c15353e40a040e520a010eb48e7b450ae4eb03b7a31844d28288df3ce04834800be829f4761208fa97a06b28a7049a058935fff786e8f7faa933d76bfb6
7125b6e507a174f89d72542e92f74211e62562a7f33e6e0193953bc68e800fb7c25493c2ea87810078c809eed6243f034777277b52074ae9c714a7a4c43e7bde
d90be562a9036d3b9b5697488bd12978bafb8ba73480cd1324675747996035f5f5d499e35a6de5669e250d7df4ed282eedefbc949e0bf9f6cafe54c0d3d55905
794949f0ede8d83db53a3a8c7d6698e7c330f36b184e98ef7442c2d9ab86e2b9f0c57110175bd29dea126b5029c28099392ed1835d7338e9d283641701159410
1293703541e77c788d445195512493419190e1be0f89a90c1f85dc05543ae7717f30d71ff82176fce59e760a9175220c6c692ed04030e56f6fa9f0de206b6d06
......@@ -338,6 +338,10 @@ ExternalData_Expand_Arguments(ParaViewData _
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-3x1-tile0.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-3x1-tile1.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-3x1-tile2.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-2x2-tile0.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-2x2-tile1.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-2x2-tile2.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TileDisplaySplitView-2x2-tile3.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TimeStepProgressBar_Inter.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TraceExodus.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/TraceMultiViews.png}"
......@@ -1543,6 +1547,8 @@ paraview_add_tile_display_tests(1 1
if (PARAVIEW_USE_MPI)
paraview_add_tile_display_tests(2 1
TEST_SCRIPTS TileDisplaySplitView.xml)
paraview_add_tile_display_tests(2 2
TEST_SCRIPTS TileDisplaySplitView.xml)
paraview_add_tile_display_tests(3 1
TEST_SCRIPTS TileDisplaySplitView.xml)
endif()
......
......@@ -15,9 +15,11 @@
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ElevationFilter" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- change opacity to 0.5 to trigger ordered compositing -->
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Opacity/DoubleRangeWidget/DoubleLineEdit" command="set_string" arguments="0.5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Opacity/DoubleRangeWidget/DoubleLineEdit" command="key" arguments="16777221" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/InteractiveLine/show3DWidget" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/TitleBar/TitleLabel" command="mousePress" arguments="1,1,0,48,4" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/TitleBar/TitleLabel" command="mouseMove" arguments="1,0,0,58,4" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/TitleBar/TitleLabel" command="mouseRelease" arguments="1,0,0,58,4" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="TextSource" />
......@@ -36,6 +38,20 @@
tdx="2" tdy="1" rank="1"
baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/TileDisplaySplitView-2x1-tile1.png" />
<!-- tiles on 2x2 -->
<pqcomparetile object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/CentralWidgetFrame/Viewport"
tdx="2" tdy="2" rank="0"
baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/TileDisplaySplitView-2x2-tile0.png" />
<pqcomparetile object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/CentralWidgetFrame/Viewport"
tdx="2" tdy="2" rank="1"
baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/TileDisplaySplitView-2x2-tile1.png" />
<pqcomparetile object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/CentralWidgetFrame/Viewport"
tdx="2" tdy="2" rank="2"
baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/TileDisplaySplitView-2x2-tile2.png" />
<pqcomparetile object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/CentralWidgetFrame/Viewport"
tdx="2" tdy="2" rank="3"
baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/TileDisplaySplitView-2x2-tile3.png" />
<!-- tiles on 3x1 -->
<pqcomparetile object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.3/CentralWidgetFrame/Viewport"
tdx="3" tdy="1" rank="0"
......
......@@ -304,7 +304,7 @@ function (paraview_add_tile_display_tests width height)
PREFIX "pvcs-tile-display"
SUFFIX "-${width}x${height}"
ENVIRONMENT
PV_ICET_WINDOW_BORDERS=1
PV_SHARED_WINDOW_SIZE=800x600
SMTESTDRIVER_MPI_NUMPROCS=${_paraview_add_tile_display_cpu_count}
_COMMAND_PATTERN
--server "$<TARGET_FILE:ParaView::pvserver>"
......
......@@ -23,6 +23,7 @@
#include "vtkRenderer.h"
#include <vtksys/SystemTools.hxx>
#include <algorithm>
#include <cassert>
#include <string>
......@@ -204,7 +205,22 @@ vtkRenderWindow* vtkPVProcessWindow::NewTileDisplayWindow()
window = renWindow;
}
if (vtksys::SystemTools::GetEnv("PV_ICET_WINDOW_BORDERS"))
if (auto pv_shared_window_size = vtksys::SystemTools::GetEnv("PV_SHARED_WINDOW_SIZE"))
{
auto parts = vtksys::SystemTools::SplitString(pv_shared_window_size, 'x');
if (parts.size() == 2)
{
const int w = std::max(50, std::atoi(parts[0].c_str()));
const int h = std::max(50, std::atoi(parts[1].c_str()));
window->SetSize(w, h);
}
else
{
const int sz = std::max(50, std::atoi(parts[0].c_str()));
window->SetSize(sz, sz);
}
}
else if (vtksys::SystemTools::GetEnv("PV_ICET_WINDOW_BORDERS"))
{
window->SetSize(400, 400);
}
......@@ -264,7 +280,22 @@ vtkRenderWindow* vtkPVProcessWindow::NewCAVEWindow()
window->SetBorders(showborders ? 1 : 0);
// Preserve old behavior for PV_ICET_WINDOW_BORDERS env var
if (vtksys::SystemTools::GetEnv("PV_ICET_WINDOW_BORDERS"))
if (auto pv_shared_window_size = vtksys::SystemTools::GetEnv("PV_SHARED_WINDOW_SIZE"))
{
auto parts = vtksys::SystemTools::SplitString(pv_shared_window_size, 'x');
if (parts.size() == 2)
{
const int w = std::max(50, std::atoi(parts[0].c_str()));
const int h = std::max(50, std::atoi(parts[1].c_str()));
window->SetSize(w, h);
}
else
{
const int sz = std::max(50, std::atoi(parts[0].c_str()));
window->SetSize(sz, sz);
}
}
else if (vtksys::SystemTools::GetEnv("PV_ICET_WINDOW_BORDERS"))
{
window->SetSize(400, 400);
}
......
......@@ -2074,8 +2074,11 @@ bool vtkPVRenderView::GetUseOrderedCompositing()
case vtkProcessModule::PROCESS_SERVER:
case vtkProcessModule::PROCESS_BATCH:
case vtkProcessModule::PROCESS_RENDER_SERVER:
if (vtkProcessModule::GetProcessModule()->GetNumberOfLocalPartitions() > 1)
if (vtkProcessModule::GetProcessModule()->GetNumberOfLocalPartitions() > 1 ||
this->InTileDisplayMode())
{
// in tile display mode, we need ordered compositing as
// vtkIceTCompositePass uses that as indicator to not use z buffer.
return true;
}
VTK_FALLTHROUGH;
......
......@@ -572,8 +572,18 @@ void vtkIceTCompositePass::Draw(
cam->SetExplicitProjectionTransformMatrix(this->IceTProjection);
cam->UseExplicitProjectionTransformMatrixOn();
// since icetPhysicalRenderSize is set to full window implying that we are
// rendering to the full window, we need to update flags on the renderer
// here so that depth peeling etc. uses correct viewport.
// see paraview/paraview#18978
double viewport[4];
ren->GetViewport(viewport);
ren->SetViewport(0, 0, 1, 1);
this->RenderPass->Render(render_state);
// reset viewport
ren->SetViewport(viewport);
// Reset the projection matrix:
cam->SetExplicitProjectionTransformMatrix(oldExplicitProj);
cam->SetUseExplicitProjectionTransformMatrix(oldUseExplicitProj);
......@@ -712,7 +722,6 @@ vtkFloatArray* vtkIceTCompositePass::GetLastRenderedRGBA32F()
//----------------------------------------------------------------------------
void vtkIceTCompositePass::DisplayResultsIfNeeded(const vtkRenderState* render_state)
{
using RenUtils = vtkOpenGLRenderUtilities;
if (this->DisplayRGBAResults)
{
vtkSynchronizedRenderers::vtkRawImage tile;
......@@ -724,9 +733,9 @@ void vtkIceTCompositePass::DisplayResultsIfNeeded(const vtkRenderState* render_s
vtkVLogF(PARAVIEW_LOG_RENDERING_VERBOSITY(), "displaying rgba results");
auto renderer = render_state->GetRenderer();
RenUtils::MarkDebugEvent("vtkIceTCompositePass: display RGBA results begin");
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: display RGBA results begin");
tile.PushToViewport(renderer);
RenUtils::MarkDebugEvent("vtkIceTCompositePass: display RGBA results end");
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: display RGBA results end");
vtkOpenGLCheckErrorMacro("failed after push rgba buffer");
}
// tile.SaveAsPNG(std::string("/tmp/" + vtkPVLogger::GetThreadName() + ".png").c_str());
......@@ -734,9 +743,9 @@ void vtkIceTCompositePass::DisplayResultsIfNeeded(const vtkRenderState* render_s
if (this->DisplayDepthResults)
{
vtkVLogF(PARAVIEW_LOG_RENDERING_VERBOSITY(), "displaying depth results");
RenUtils::MarkDebugEvent("vtkIceTCompositePass: display depth results begin");
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: display depth results begin");
this->PushIceTDepthBufferToScreen(render_state);
RenUtils::MarkDebugEvent("vtkIceTCompositePass: display depth results end");
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: display depth results end");
vtkOpenGLCheckErrorMacro("failed after push depth buffer");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment