From 26a30ffa50344ccf1e5b25d0b79d76e94a865052 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 27 Nov 2024 09:04:56 +0100 Subject: [PATCH] Make sure fault geometry always is visible The check for fault was removed in 4cf6a260837ffb275e1a30955446013e9c2711f6 This causes wrong visualization when a range filter is active and a fault is present along the filter. There is some performance issues seen when profiling this code, needs more investigation. --- .../ReservoirDataModel/RigGridBase.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 1adbb1716b..fe38e3c80d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -550,15 +550,23 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible( size_t return true; } - size_t neighborCellIndex = m_grid->cellIndexFromIJK( ni, nj, nk ); + // Do not show cell geometry if a fault is present to avoid z fighting between surfaces + // It will always be a better solution to avoid geometry creation instead of part priority and polygon offset + size_t nativeResvCellIndex = m_grid->reservoirCellIndex( cellIndex ); + const RigFault* fault = m_grid->mainGrid()->findFaultFromCellIndexAndCellFace( nativeResvCellIndex, face ); + if ( fault ) + { + return false; + } + size_t neighborCellIndex = m_grid->cellIndexFromIJK( ni, nj, nk ); // If the neighbour cell is invisible, we need to draw the face if ( ( cellVisibility != nullptr ) && !( *cellVisibility )[neighborCellIndex] ) { return true; } - // Do show the faces in the boarder between this grid and a possible LGR. Some of the LGR cells + // Do show the faces in the border between this grid and a possible LGR. Some of the LGR cells // might not be visible. if ( m_grid->mainGrid()->gridCount() > 1 && m_grid->cell( neighborCellIndex ).subGrid() ) {