Skip to main content

๐Ÿ” Water Surface Debugger - Advanced Visualization & Analysis Tools

ยท 4 min read
Galidar
Founder, Galidar Studio

Comprehensive debugging and visualization tools for analyzing water surface behavior, wave calculations, and rendering performance in real-time.

Overviewโ€‹

The Water Surface Debugger provides editor actors and visualization systems for understanding and optimizing water simulation behavior. Essential for development, troubleshooting, and performance analysis.


Water Surface Debugger Actorโ€‹

AOceanologyWaterSurfaceDebuggerโ€‹

Placed in level to visualize water surface calculations:

FeatureDescription
Grid VisualizationDisplay sampling grid over water surface
Height SamplingShow wave heights at grid points
Normal VectorsVisualize surface normals
Flow VectorsDisplay water velocity directions
Depth ColoringColor-coded depth visualization

Visualization Modesโ€‹

Grid Overlayโ€‹

Configure the sampling grid:

ParameterDescription
Grid SizeTotal area covered
Grid ResolutionPoints per axis
Grid Height OffsetVertical offset from water
Show Grid LinesEnable/disable grid rendering

Sphere Samplingโ€‹

Sample water properties at discrete points:

  • Place spheres at wave surface
  • Color by depth/velocity/height
  • Update in real-time
  • Show numerical values

Console Variable Debuggingโ€‹

Core Debug Variablesโ€‹

CVarDescription
r.Oceanology.DebugBuoyancy0=Off, 1=Forces, 2=Detailed
r.Oceanology.ShowTileBoundsQuadTree tile boundaries
r.Oceanology.ShowLODLevelsColor tiles by LOD
r.Oceanology.ShowWireframeWireframe water mesh
r.Oceanology.DrawPerViewDebugInfoPer-camera debug data

Wave Debug Variablesโ€‹

CVarDescription
r.Oceanology.FreezeWavesPause wave simulation
r.Oceanology.OverrideWavesTimeSet specific wave time
r.Oceanology.VisualizeWaveSpectrumShow wave frequency data

Performance Profilingโ€‹

GPU Profilingโ€‹

Use Unreal's built-in profilers:

stat GPU
stat SceneRendering
stat InitViews

Water-Specific Statsโ€‹

StatMeasures
QuadTree BuildTile generation time
Water Mesh DrawRendering time
Wave CalculationCPU wave computation
Buoyancy QueriesPhysics query overhead

Editor Integrationโ€‹

Texture Utilitiesโ€‹

UCLASS()
class UOceanologyTextureUtils : public UObject
{
// Export water info to texture
UFUNCTION(BlueprintCallable)
static void ExportWaterInfoTexture(
UTextureRenderTarget2D* Source,
const FString& FilePath
);

// Analyze texture channels
UFUNCTION(BlueprintCallable)
static void AnalyzeTextureChannels(
UTexture2D* Texture,
FVector4& OutMinValues,
FVector4& OutMaxValues
);
};

Editor Settingsโ€‹

UCLASS(config=EditorPerProjectUserSettings)
class UOceanologyWaterEditorSettings : public UObject
{
UPROPERTY(Config, EditAnywhere)
bool bShowWaterDebugInEditor = false;

UPROPERTY(Config, EditAnywhere)
bool bAutoRefreshWaterInfo = true;

UPROPERTY(Config, EditAnywhere)
float DebugUpdateInterval = 0.1f;
};

Water Info Visualizationโ€‹

Render Target Analysisโ€‹

Visualize Water Info Texture channels:

ChannelDataVisualization
RFlow Velocity XRed gradient
GFlow Velocity YGreen gradient
BWater HeightBlue gradient
AGround HeightAlpha/Gray

Debug Renderingโ€‹

void FOceanologyWaterInfoRendering::RenderDebugInfo(
FRHICommandListImmediate& RHICmdList,
const FViewInfo& View
);

Spline Visualizationโ€‹

Water Spline Component Visualizerโ€‹

Editor visualization for water splines:

FeatureDescription
Spline PathColored curve display
Control PointsEditable handles
Width VisualizationRiver width at each point
Depth ColoringDepth value display
Velocity ArrowsFlow direction indicators

Metadata Displayโ€‹

Show spline metadata per point:

  • Width
  • Depth
  • Velocity
  • Audio settings

Buoyancy Debuggingโ€‹

Force Visualizationโ€‹

When r.Oceanology.DebugBuoyancy is enabled:

LevelVisualization
1Force vectors on floating actors
2Detailed per-pontoon forces

Debug Pointsโ€‹

UPROPERTY()
int32 BuoyancyDebugPoints = 8;

Sample buoyancy at multiple points for accuracy analysis.


QuadTree Debuggingโ€‹

Tile Visualizationโ€‹

CVarEffect
ShowTileBoundsDraw tile boundaries
ShowLODLevelsColor by LOD level
ShowWireframeWireframe mesh view

LOD Level Colorsโ€‹

LODColor
0Red (highest detail)
1Orange
2Yellow
3Green
4Cyan
5+Blue (lowest detail)

Debug Workflowโ€‹

Troubleshooting Stepsโ€‹

  1. Enable Debug Visualization - Set appropriate CVars
  2. Place Debugger Actor - Add to level if needed
  3. Configure Grid - Match area of interest
  4. Analyze Results - Check heights, normals, flow
  5. Profile Performance - Use stat commands
  6. Iterate - Adjust parameters, re-test

Common Issuesโ€‹

SymptomDebug Approach
Incorrect wave heightsEnable height sampling grid
Buoyancy problemsEnable force visualization
Performance issuesProfile with stat GPU
LOD poppingShow LOD levels, adjust bias
Flow direction wrongVisualize flow vectors

Export & Analysisโ€‹

Capture Toolsโ€‹

Export debug data for offline analysis:

  • Water Info Texture export
  • Wave spectrum snapshots
  • Performance frame captures
  • Spline data export (LUA)

Resourcesโ€‹

  • Console Commands: Full CVar reference in Debug Tools post
  • Discord: #debugging channel for help
  • Documentation: Troubleshooting guide