#14083 Well Disks: Stagger disks vertically to reduce z-fighting

Well disks are flat, zero-thickness discs drawn at a fixed elevation above each
well head. When the disks of different wells overlap horizontally they end up
coplanar at the same depth and z-fight.

Offset each disk along Z by a small per-well amount derived from the stable
resultWellIndex(), scaled by arrowLength so the spacing tracks the disk scale and
view zoom. Coincident disks fan out into a readable vertical stack instead of
fighting.
This commit is contained in:
Kristian Bendiksen committed 2026-06-01 08:19:44 +02:00
1 parent 8f082fc969
commit fe81dd8f3e
1 file changed
+6
@@ -113,6 +113,12 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
cvf::Vec3d diskPosition = whEndPos;
diskPosition.z() += pipeRadius + arrowLength * 2.0;
// Stagger disks vertically per well so wells whose disks overlap do not render coplanar and z-fight.
// resultWellIndex() gives a stable, unique per-well index; arrowLength keeps the spacing consistent with the disk
// scale and view zoom.
const double diskStaggerFactor = 0.05; // fraction of arrowLength per well index
diskPosition.z() += m_rimWell->resultWellIndex() * arrowLength * diskStaggerFactor;
cvf::Vec3d textPosition = diskPosition;
textPosition.z() += 0.1;