API ReferenceGE ExtensionsClient
PostFx Flash Effect
Screen flash post-processing effect for damage and whiteout visual feedback. Creates a `FlashFx` PostEffect driven by shader constants for damage flash intensity and whiteout amount.
Screen flash post-processing effect for damage and whiteout visual feedback. Creates a FlashFx PostEffect driven by shader constants for damage flash intensity and whiteout amount.
Overview
This file is a declarative setup script (no M module). It registers:
PFX_FlashShader- ShaderData for the flash pixel shaderFlashFx- PostEffect (disabled by default, priority 10, renders after diffuse)FlashFxCallbacks- Global callback table withsetShaderConsts
The effect composites a white/red flash over the back buffer based on damage and whiteout parameters.
Scene Objects
| Object | Type | Default Enabled | Description |
|---|---|---|---|
PFX_FlashShader | ShaderData | - | Flash pixel shader with configurable white/mul colors |
FlashFx | PostEffect | false | Screen flash overlay, renders PFXAfterDiffuse |
Global Callbacks
The table FlashFxCallbacks is set on _G via rawset.
| Callback | Description |
|---|---|
setShaderConsts() | Sets $damageFlash and $whiteOut shader constants (currently hardcoded to 0) |
Shader Defines
-- White and multiply colors configured as shader defines
pfxFlashShader:setField("defines", 0,
"WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)")Usage Example
-- Enable the flash effect
local flashFx = scenetree.findObject("FlashFx")
if flashFx then
flashFx:enable()
end
-- The callback updates shader uniforms each frame
-- damageFlash and whiteOut are intended to come from Game.getDamageFlash() / Game.getWhiteOut()Notes
- Both
damageFlashandwhiteOutare hardcoded to0with TODO comments indicating they should come from engine functions - The effect reads from
$backBufferand renders at priority 10 - Reflection passes are excluded (
allowReflectPass = false)
See Also
- PostFx Fog - Fog post-processing
- PostFx Utils - Preset load/save for post effects