Skip to content

Repository files navigation

ProEssentials WinUI 3D Wellbore Flythrough

A ProEssentials v11 WinUI 3 .NET 10 demonstration of a complete 3D subsurface visualization with animated roller-coaster style camera flythrough down multiple wellbore trajectories using Pe3doWinUI and Direct3D.

ProEssentials WinUI 3D Wellbore Flythrough


Found ProEssentials through this repo? Use code GITHUB15_OCT31 at checkout for 15% off your first license.

Thanks for sharing — every share and star helps another engineer find this repo.


What This Demonstrates

A full implementation of Example 403 — 3D Surface with Custom Polygon Colors from the ProEssentials library, extended into a standalone wellbore visualization application.

➡️ gigasoft.com/examples/403

The chart-configuration code is identical to the WPF and WinForms versions of this example. The ProEssentials API does not change between interfaces; only the window plumbing differs.


The Flythrough Animation

Press keys 0–9 to fly down any of the wellbore trajectories.

The camera moves point-by-point along the selected well path while simultaneously rotating 1° per frame — producing a roller-coaster style descent through the subsurface. Press the same key again to return to the normal overhead view.

Key 0  — fly down well 0 (press again to exit)
Key 1  — fly down well 1
...
Key 9  — fly down well 9

Click the chart once first so it holds keyboard focus — the ProEssentials WinUI control is a focusable XAML Control and takes focus on left-press.

This is implemented using SetViewingAt() — a ProEssentials Pe3doWinUI function that repositions the Direct3D camera to look at any 3D coordinate in the scene:

// Each timer tick (25ms) advances one step along the well path
Pe3do1.PeFunction.SetViewingAt(x, y, z);
Pe3do1.PeAnnotation.Graph.HighLightAnnotationIndex = currentIndex;
Pe3do1.PeUserInterface.Scrollbar.DegreeOfRotation += 1; // spiral rotation
Pe3do1.Invalidate();

The animation is driven by a DispatcherQueueTimer (WinUI's replacement for WPF's DispatcherTimer). Each tick pauses while a mouse button is held, so the timer and the drag logic never both drive DegreeOfRotation at the same moment.


Scene Contents

Terrain Surface

  • 200×200 grid extracted from a 1500×1500 real elevation dataset (terrain2.bin)
  • A random region is selected each run — the terrain is different every launch
  • Shaded surface with contour color scale (BlueCyanGreenYellowBrownWhite)
  • Contour projection lines on the floor plane

Drill Target

  • Concentric custom-colored rings painted using PointColors[s,p]
  • SurfaceNullDataGaps + NullDataValue=80 creates a visible borehole void
  • Cyan polygon annotation marks the target zone boundary at surface
  • Red ellipse annotations mark the target zone at depth (250ft, 500ft intervals)

Wellbore Trajectories

  • Multiple well paths loaded from DirData1.txt (tab-delimited survey data)
  • Rendered as 3D tubes using LinesOrTubes.AllTubes
  • White color markers indicate formation boundaries at depth intervals
  • Each well labeled "Well 0", "Well 1"... at its terminal depth

ProEssentials Features Demonstrated

Pe3doWinUI — the ProEssentials Direct3D 3D chart object. Handles all scene rendering, lighting, rotation, and camera management in hardware. The WinUI control types carry a WinUI suffix so they can share one namespace with the WinForms and WPF types.

SetViewingAt(x, y, z) — repositions the Direct3D camera focus point at runtime. Used here to drive the flythrough animation by moving the camera along annotation coordinates each timer tick.

PointColors[s,p] — per-polygon color override. Paints individual surface polygons with custom colors independently of the contour scale — used to create the target bullseye rings on the terrain.

LinesOrTubes.AllTubes — renders all line-type graph annotations as 3D tubes with configurable thickness, dramatically improving visual quality for wellbore paths in a 3D scene.

SurfaceNullDataGaps + NullDataValue — removes surface polygons at grid points equal to the null value, creating the visible borehole void.

Graph Annotation Types used in this example:

  • MediumSolidLine / LineContinue — defines 3D polyline paths (well trajectories)
  • StartPoly / AddPolyPoint / EndPolygon — closed polygon (target boundary)
  • AxisDirection / MajorMinorRadii / EllipseMedium / EllipseThin — 3D ellipses
  • Pointer — labeled pointer at well terminal depth

PeCustomTrackingDataText — custom tooltip for surface data points (shows elevation value and grid coordinates).

PeCustomTrackingOtherText — custom tooltip for non-data hot spots. Fires when hovering over well tube annotations (shows 3D XYZ coordinates).

CustomMenuText / PeCustomMenu — adds a custom item to the right-click context menu with checkmark state — "Zoom Rotate on Center" toggles between ViewingMode.Center and ViewingMode.DataLocation.

Freeze / Unfreeze — suspends rendering during initialization to prevent partial renders flickering on screen during property setup.

Force3dxVerticeRebuild / Force3dxAnnotVerticeRebuild — forces the Direct3D engine to recompute all vertex buffers on next render. Required after programmatic annotation changes.


Mouse and Keyboard Controls

Input Action
Keys 0–9 Fly down well 0–9 (press same key to exit)
Left drag Rotate the 3D scene
Shift + drag Translate / pan
Middle drag Rotate the light source
Mouse wheel Zoom in/out
Double-click Start/stop auto-rotation
Right-click Context menu

Data Files

File Contents
terrain2.bin 2,250,000 Int32 elevation values — 1500×1500 grid
DirData1.txt Tab-delimited wellbore survey coordinates (Y/Z/X per row)

Both files are copied to the output directory automatically on build.


Prerequisites

  • Visual Studio 2026 with the .NET desktop development and Windows application development workloads
  • .NET 10 SDK
  • Internet connection for NuGet restore

How to Run

1. Clone this repository
2. Open WellBoreChartWinUI.sln in Visual Studio 2026
3. Build → Rebuild Solution (NuGet restore is automatic)
4. Press F5
5. Click the chart, then press keys 0–9 to fly down wellbore trajectories

What Changed From the WPF Version

The ProEssentials calls are unchanged. Everything that moved is window plumbing:

No XAML designer — Visual Studio has no XAML designer for WinUI 3, in any edition, including VS2026. The chart is declared in markup (<pe:Pe3doWinUI x:Name="Pe3do1" />) rather than dragged from the Toolbox. This is a Windows App SDK limitation, not a ProEssentials one, and it applies to every WinUI control vendor.

Window sizing is code, not XAML — WinUI's Window is not a Control. It has no Height/Width/MinWidth, no Loaded event and no Background. SizeAndCenterWindow() sets the size with a Win32 MoveWindow call, and UseLayoutRounding moves to the root Grid.

Chart Loaded event — ProEssentials initialization runs in the control's own Loaded event (Pe3do1_Loaded). That was already the right place in WPF; in WinUI it is the only place, because the window has no Loaded of its own.

TimerDispatcherTimer becomes DispatcherQueueTimer, created from the window's DispatcherQueue. Its Tick is a TypedEventHandler<DispatcherQueueTimer, object>, so the handler signature differs from the WPF one.

Key codes — WPF's Key enum put D0D9 at 34–43. WinUI hands you a Windows.System.VirtualKey, where Number0Number9 are the Win32 codes 48–57.

Mouse and message boxMouseMove becomes PointerMoved, and MessageBox.Show (WPF only) becomes a direct Win32 MessageBoxW call.


NuGet Package

This project references ProEssentials.Chart.Net10.WinUI from nuget.org. Package restore is automatic on build.

The AnyCpu package embeds the native rendering engines inside the assembly and unpacks the one matching the running process at run time, so unlike the WPF sample there is no native DLL to copy or deploy alongside your app.


Deploying a WinUI App

WinUI deploys differently than WPF and WinForms — worth knowing before you ship:

  • A .NET app is not a single exe. Ship the entire build/publish output folder, never a hand-picked subset. terrain2.bin and DirData1.txt must sit beside the exe.
  • The target machine needs two runtimes: the .NET 10 Desktop Runtime and the Windows App SDK Runtime. Alternatively publish self-contained with -p:WindowsAppSDKSelfContained=true.
  • Your development machine already has both, so it will run from an under-filled folder. Always validate on a clean machine.

Evaluation Watermark

The nuget.org package is the evaluation build and draws an "Evaluating ProEssentials" watermark across the chart. A licensed installation replaces the assembly and the watermark goes away — everything else behaves identically.


Related Examples


License

Example code is MIT licensed. ProEssentials requires a commercial license for continued use.

About

WinUI 3 oil and gas 3D wellbore visualization, .NET 10 C# - animated camera flythrough down multiple well trajectories over real terrain. Drill target annotations, 3D tube paths, contour scale. Press 0-9 to fly a well. Pe3doWinUI, Direct3D.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages