PostProcessing

Available in Lenga 0.10.1 and later.

Lenga\Engine\Rendering\PostProcessing manages temporary layers on the active scene. It does not change the authored profile or persist changes. The camera must have Post Processing enabled for a layer to affect the image. A screen-space canvas is composited after these effects.

Methods

PostProcessing::setOverride(string $key, PostProcessingOverride $override): bool

Adds a layer or replaces the entire layer with the same nonempty key. Returns whether the active scene accepted it.

PostProcessing::hasOverride(string $key): bool

Reports whether the active scene contains the named layer. It does not indicate whether the primary camera is displaying the effect.

PostProcessing::clearOverride(string $key): bool

Removes one layer and returns whether it was present. Use this to clean up an effect without removing layers created by other scripts.

PostProcessing::clearOverrides(): bool

Clears every temporary layer on the active scene. Returns whether there was an active scene to clear. The authored profile remains in place.

Layer Options

Create a PostProcessingOverride in Lenga\Engine\Rendering. weight runs from 0.0 (no effect) to 1.0 (full override). Higher priority layers apply after lower-priority layers. At equal priority, the later-added layer applies last. Replacing a key retains its place among layers at the same priority.

Set only the fields you need. A null module or field leaves the current setting in place. Most numeric settings blend with weight; discrete options such as tonemapping mode switch as soon as their layer has nonzero weight.

Option Value type Fields
tonemapping TonemappingOverride enabled, mode (Lenga\Engine\Enumerations\TonemappingMode: None, Neutral, or Aces)
colorAdjustments ColorAdjustmentsOverride enabled, postExposure, contrast, saturation, colorFilter
bloom BloomOverride enabled, threshold, intensity, scatter, tint
vignette VignetteOverride enabled, color, center (Vector2), intensity, smoothness, rounded
filmGrain FilmGrainOverride enabled, intensity, response
chromaticAberration ChromaticAberrationOverride enabled, intensity
peripheralWarp PeripheralWarpOverride See below.

The override types live in Lenga\Engine\Rendering. Color fields accept Lenga\Engine\Core\Color.

Peripheral Warp Options

Field Use
enabled Enables the effect.
intensity Blend between the original and warped scene, from 0 to 1.
safeRadius Normalized radius of the clear center, from 0 to 1.
smoothness Width of the transition beyond that radius, from 0.01 to 1.
rippleAmplitude Ripple displacement, from 0 to 0.1.
rippleFrequency Ripple frequency, from 0 to 30.
phase Ripple phase in radians. Update it to animate the pattern.
chromaticSeparation Color-channel separation, from 0 to 0.05.
innerTint, outerTint Optional colors for the inner and outer edges of the warped region.

For a complete gameplay example, see Create a Temporary Screen Effect.