Gorilla.Volumetric.Mesh Unit Reference

Overview

The Gorilla.Volumetric.Mesh unit provides TGorillaVolumetricMesh, a mesh that renders a 3D scalar field (a volume) with GPU ray marching. It reads its data from a 3D texture and composites the samples along each ray. It is used for medical/scientific volume visualization and is the base class of TGorillaVolumetricNoise.

The mesh embeds a TGorillaVolumetricMeshMaterialSource that exposes most of the rendering parameters; the mesh forwards them, so you normally only touch the mesh.

Class Hierarchy

TGorillaSingletonMesh
  └── TGorillaVolumetricMesh
        └── TGorillaVolumetricNoise   (see separate reference)

Enumerations

TGorillaVolumetricMeshSize = (vms4x4x4, vms8x8x8, vms16x16x16, vms32x32x32,
  vms64x64x64, vms128x128x128, vms256x256x256, vms512x512x512, vms768x768x768,
  vms1024x1024x1024, vmsCustom);

TGorillaVolumetricMeshDataType = (vmdtUInt8, vmdtUInt16, vmdtHalfFloat, vmdtFloat,
  vmdtRGBUInt8, vmdtRGBAUInt8, vmdtRGBFloat, vmdtRGBAFloat);

TGorillaVolumetricMeshShape = (vmsCube, vmsSphere, vmsCylinder);

TGorillaVolumetricMeshByteOrder = (vmboLittleEndian, vmboBigEndian);

TGorillaVolumetricGamutMode = (GamutNone, GamutByValue, GamutByValueMultiply,
  GamutBySum, GamutBySumMultiply);

TRayCastDistanceMethod = (rcdNone, rcdTexture, rcdFocused, rcdLinear, rcdInvLinear,
  rcdQuadratic, rcdInvQuadratic, rcdLogN, rcdInvLogN, rcdGaussian);

TGorillaVolumetricMesh

Published Properties — Data & Size

Property Type Description
Sizes TGorillaVolumetricMeshSize Fixed cubic volume resolution, or vmsCustom
CustomWidth / CustomHeight / CustomDepth Integer Per-axis slice counts when Sizes = vmsCustom (adjusted to multiples of 2)
DataType TGorillaVolumetricMeshDataType Format of a single voxel
Spacings TPoint3D Spacing between voxels/slices (for compressed scans)
Shape TGorillaVolumetricMeshShape Surrounding projection shape (cube/sphere/cylinder)

Published Properties — Blending & Quality

Property Type Description
Details Single Ray-march step density (steps ≈ Slices × Details). Higher = finer/slower
RayStop Single Alpha value at which a ray terminates early (default 0.95)
RayLimits TPoint Ray front offset (X) and back reduction (Y)
Dithering Boolean Per-pixel ray-start jitter to remove step banding (default True)
LinearFiltering Boolean Trilinear filtering of the 3D texture
MipMaps Boolean Mip-map minification filtering
TextureInterpolation TTextureInterpolation Sampling of the front/back-face position textures
RenderInside Boolean Two-sided rendering so the camera can fly inside the volume

Published Properties — Lighting & Iso-Surface

Property Type Description
UseLighting Boolean Enable iso-surface lighting
IsoSurfaceLimit Single Threshold that defines the lit surface
ShadingModel TGorillaShadingModel Shading model when lighting is on
ShadingIntensity Single Shading strength
Brightness Single Final color brightness

Published Properties — Gamut / Transfer Function

Property Type Description
Gamut TBitmap Transfer-function (color) texture
GamutMode TGorillaVolumetricGamutMode How the gamut is applied
GamutFactor Single Value factor before mapping onto the gamut
GamutIntensity Single RGB contribution of the gamut
GamutAlphaIntensity Single Alpha contribution of the gamut

Published Properties — Overlay & Ray Intensity

Property Type Description
Overlay TBitmap Overlay texture projected onto the volume
UseOverlay Boolean Enable overlay rendering
OverlayIntensity Single Overlay strength
ClippingPlane TPlaneF Clipping plane for slice selection
IntensityMode / AlphaIntensityMode TRayCastDistanceMethod Distance-based value / alpha modulation
IntensityFocus / IntensityExp Single Focus band parameters for rcdFocused
AlphaIntensityFocus / AlphaIntensityExp Single Alpha focus band parameters for rcdFocused
RayIntensityTexture / RayAlphaIntensityTexture TBitmap 1D textures used when the mode is rcdTexture
BeforeRaytracingFunc TStrings Custom GLSL run before ray marching (advanced)
BlendFunc TStrings Custom GLSL compositing function (advanced)

Published Properties — Render Passes & Events

Property Type Description
FrontFaceRenderPass TGorillaRenderPassController Pass providing ray entry positions (required)
BackFaceRenderPass TGorillaRenderPassController Pass providing ray exit positions (required)
OnUpdateTexture3D TOnUpdateTexture3D Fired when the internal 3D texture is (re)built

Public Properties

Property Type Description
CustomSize TSize3D Non-adjusted custom volume size (not stored in DFM)

Public Methods — Blend Mode

Method Description
SetEmissionAbsorptionBlend(AAbsorptionScale = 1.0) Switch to the physically based emission-absorption (Beer-Lambert) blend for translucent media (fog/clouds/smoke). The scale is resolution-independent (1.0 = neutral).
SetLinearBlend() Restore the default linear front-to-back compositing (solid / lit objects).

Public Methods — Data Loading

Method Description
SetRawData(AData, ASize, ADoCopyData = True) Upload a raw voxel buffer directly
ClearRawData() Release the cached raw data
PushRawData() Re-upload the cached raw data to the 3D texture
LoadFromRawFile(AFileName, AWidth, AHeight, ADepth, ASrcDataType, AByteOrder, AOffset) Load a RAW volume file
LoadFromRawStream(AStream, AWidth, AHeight, ADepth, ASrcDataType, AByteOrder, AOffset) Load a RAW volume from a stream
LoadFromNRRDFile(AFileName, AByteOrder) Load an NRRD volume file (size/type from header)
LoadFromNRRDStream(AStream, AByteOrder) Load an NRRD volume from a stream
LoadFromImageSlices(APath, AFileNamePattern, AFromIdx, AToIdx, APadLeftLen, APadChar, ATexWidth, ATexHeight, ATexDepth) Assemble a volume from numbered 2D image slices

Public Methods — Utility

Method Returns Description
GetSizeAsVector() TPoint3D Current volume resolution as width/height/depth
BeginUpdate() / EndUpdate() — Batch Sizes / DataType changes to rebuild the texture once

Callback Types

TOnUpdateTexture3D = procedure(ASender: TObject;
  ATexture: TGorillaTextureBitmap) of object;

Notes

  • The mesh requires a front-face and a back-face render pass (TGorillaRenderPassFace, unit Gorilla.Controller.Passes.Face) to obtain ray entry/exit positions.
  • The linear blend produces solid/opaque surfaces (use with UseLighting); SetEmissionAbsorptionBlend produces translucent media. Lit iso-surface hits are refined to sub-sample precision for smooth shading.
  • Iso-surface refinement is a no-op for pure media (where values never exceed IsoSurfaceLimit), so it never affects fog/clouds.

See Also