Gorilla.Controller.Passes.Face

Overview

This unit renders mesh vertex positions (front or back faces) into a floating-point texture. It is primarily used as the entry/exit geometry for ray-cast volumetric rendering: by capturing front-face and back-face positions, a ray's start and end points through a volume can be reconstructed in screen space.

Architecture

The face pass is a pre-pass using RenderListToFBO with ListRendering. A dedicated face material outputs the vertex position in a selectable coordinate space (TFaceOutput). Front- or back-face selection is controlled via FaceKind. The output texture format adapts to the selected output mode and platform (see Technical Details).

Core Classes

TGorillaRenderPassFace

Inherits from: TGorillaRenderPassController

Default pass id: 'Face'

Published Properties

Property Type Default Description
FaceKind TFaceKind — Which side to render: FrontFace or BackFace.
FaceOutput TFaceOutput — Coordinate space written to the texture: Default, ModelSpace, ViewSpace, ViewProjSpace, FragDepth.

Public Properties

Property Type Description
VertexUserFunc TStrings User-defined GLSL vertex code that can modify the position before output.
BiasMatrix TMatrix3D Read-only texture bias matrix.

Key Public Methods

function GetViewMatrix(const AContext : TContext3D) : TMatrix3D; override;
function GetProjectionMatrix(const AContext : TContext3D) : TMatrix3D; override;
procedure SetupMatrices(const AContext : TContext3D);
function GetTextureMatrix(AContext : TContext3D;
  const AUseBias : Boolean = true) : TMatrix3D; override;

Enumerations

TFaceKind   = (FrontFace, BackFace);
TFaceOutput = (Default, ModelSpace, ViewSpace, ViewProjSpace, FragDepth);

TGorillaRenderPassEmbeddedFace

Inherits from: TGorillaRenderPassFace

An internal variant (IsInternalRenderPass returns True) managed by higher-level systems rather than used standalone.

TFaceMaterial / TFaceMaterialSource

Internal material classes holding the per-space vertex shaders. They expose FaceKind, FaceOutput and VertexUserFunc; configure the pass rather than these directly.

Runtime Setup

uses
  Gorilla.Controller.Passes.Face;

var
  LFront, LBack: TGorillaRenderPassFace;
begin
  // Front-face entry positions
  LFront := TGorillaRenderPassFace.Create(nil);
  LFront.Viewport   := GorillaViewport1;
  LFront.FaceKind   := FrontFace;
  LFront.FaceOutput := ModelSpace;
  LFront.Enabled    := True;

  // Back-face exit positions
  LBack := TGorillaRenderPassFace.Create(nil);
  LBack.Viewport   := GorillaViewport1;
  LBack.FaceKind   := BackFace;
  LBack.FaceOutput := ModelSpace;
  LBack.Enabled    := True;
end;

Technical Details

  • Pass type: Pre-pass (TRenderPassType.Pre)
  • Render method: RenderListToFBO
  • Render procedure: ListRendering
  • Output texture format depends on FaceOutput and platform:
    • FragDepth: R16F (Android) / R32F (desktop), single channel.
    • All other modes: RGB16F (Android) / RGB32F (desktop), three channels for the position.
    • Linear filtering, WrapS/WrapT = ClampToBorder.
  • VertexUserFunc allows custom displacement/animation so the captured positions match a deformed mesh.

See Also