Aego Русский

Post Process

Applies an ordered effect stack after all cameras sharing this camera's logical output, before UI.

Run the example, focus Game View and press Space to cycle through Bloom, Color Grading, Vignette, Chromatic Aberration, Pixelate, CRT, a custom colour filter and the original image. The example includes a prepared linear identity LUT and its own material. Saturation makes grading visible even with the identity LUT.

On this page

Minimal camera setup

Add Post Process (render2d.PostProcess) to the same node as Camera2D. Enable the component, add one Bloom effect and enable that instance. Start with an opaque camera output and a bright sprite. Lower Threshold until its bright area receives a halo, then adjust Intensity and Radius. Disable the instance to compare. Bloom spreads bright pixels in the rendered image; use Light2D to illuminate neighbouring surfaces. It does not create a light by itself.

Only one enabled stack may claim a logical camera output. If nothing changes, check the camera's output, component and instance Enabled flags, threshold, and PFX001. A Custom material must use a postfx-domain shader; read MAT004 before changing the shader's purpose.

Add a glow to the platformer

Open the main scene of examples/platformer. Select Camera and expand Post Process. Its Bloom instance uses Threshold 0.75, Intensity 0.22 and Radius 6. Lower Threshold to pick up more bright surfaces. Increase Radius to spread the light over more pixels. Compare the lamp and its sparks with the stack disabled. Open Settings in the game to check that its text remains sharp. The lamp uses its Light2D for neighbouring surfaces and Bloom for the halo on screen.

The stack runs once after the cameras sharing a logical output finish drawing the world. Enable the component on one contributing camera. Scene-linear effects run before exposure and tone mapping. Display-linear effects run after that conversion and before final encoding. Reorder effects within the compatible phase. A linear offscreen output keeps its scene-linear values. Bloom and colour separation require opaque coverage in this renderer.

Reuse a colour filter

Add Custom Material and choose a material backed by a shader with #pragma postfx. The editable example is examples/platformer/assets/postfx/cold.aemat. Enable the effect after assigning the material. It reads the previous effect through aego_sample(aego_uv). Save the material, shader and scene and open a standalone export to verify the result. The camera also carries a disabled Color Grading entry with a LUT. LUTs are standalone linear data strips, 256×16 or 1024×32.

Animation and Tween address a numeric field by instance ID, for example render2d.PostProcess.ef120d00000000000000000000000002:Intensity on the platformer's camera. Reordering an effect preserves that target. Duplicating creates an independent target. Undo restores a removed instance and its ID.

Materials in the demo games

Open examples/platformer/assets/materials/character_flash_lit.aeshader to see how a surface combines forward lighting, the current sprite normal and a per-instance Flash parameter. The Hurt clip animates the Flash parameter of the player’s material override. Other sprites sharing the material retain their own overrides. For an outline on selection, assign the built-in Outline material to the selected sprite, retain its previous material and restore that material on deselection. In examples/topdown the player's Torch is a Spot light whose orientation follows the same aim as the sword. The floor and walls receive its light.

Inspect a pass or edit a camera from a tool

In the Lighting profiler, open Inspect output passes and select the output. With Bloom enabled, locate bright extraction, both blur directions and composite. Disable the stack and inspect the next frame. A timing entry appears when the driver returns a valid sample. A window target reports its drawing size, while a texture target also exposes its storage format.

Use aego postfx get scenes/main.aescene Camera to inspect the instance IDs. In the platformer, aego postfx set scenes/main.aescene Camera ef120d00000000000000000000000002 Intensity 0.35 changes the existing Bloom. The same commands are available as MCP tools. In a bound editor session a write uses the active document and its Undo history.

component render2d.PostProcess

Usage

Needs Camera 2D on the same node.

Try it

Enable camera post-processing

The camera starts with Bloom enabled. Its output stack changes the bright cards before the UI is drawn.

Disable the Post Process component to see the unprocessed output; Reset restores the stack.

Starts the scene; open the example parameters to experiment.
Open in AegoDownload example project
Scene5 nodes
Effects Camera
Transform
position[0, 0]rotation0scale[1, 1]
Camera 2D
zoomfloat53viewportRect[0, 0, 1, 1]maskint-1orderint0clearbooltrueclearColorColor#192535ffscaleenumfitVirtualvirtualVec2[960, 540]activebooltrue
Post Process
enabledbooltrueeffects[]render2d.PostEffect[{ typeID="postfx.bloom" instanceID="bloom" version=1 enabled=true parameters=[{ name="Threshold" kind=float value=[0.4, 0, 0, 0] }, { name="Intensity" kind=float value=[0.7, 0, 0, 0] }, { name="Radius" kind=float value=[12, 0, 0, 0] }] }, { typeID="postfx.color-grading" instanceID="grade" version=1 enabled=false lut=asset("45e397813812442d994a810000000003") parameters=[{ name="Saturation" kind=float value=[0.35, 0, 0, 0] }] }, { typeID="postfx.vignette" instanceID="vignette" version=1 enabled=false parameters=[] }, { typeID="postfx.chromatic-aberration" instanceID="chromatic" version=1 enabled=false parameters=[{ name="OffsetPixels" kind=float value=[12, 0, 0, 0] }] }, { typeID="postfx.pixelate" instanceID="pixelate" version=1 enabled=false parameters=[{ name="Size" kind=int integer=18 }] }, { typeID="postfx.crt" instanceID="crt" version=1 enabled=false parameters=[] }, { typeID="postfx.custom" instanceID="custom" version=1 enabled=false material=asset("45e397813812442d994a810000000002") parameters=[] }]
Card 1
Transform
position[-3, -0.7]rotation0.4scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")layerint0orderint0tintColor#f66163fforiginVec2[0.5, 0.5]sizeVec2[2, 2]flipXboolfalseflipYboolfalseblendenumpremultipliedfilterenumnearest
Card 2
Transform
position[-0.4, 0.6]rotation-0.2scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")layerint0orderint0tintColor#31c8fffforiginVec2[0.5, 0.5]sizeVec2[1.8, 2.9]flipXboolfalseflipYboolfalseblendenumpremultipliedfilterenumnearest
Card 3
Transform
position[2.9, -0.9]rotation0.4scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")layerint0orderint0tintColor#fffad8fforiginVec2[0.5, 0.5]sizeVec2[1.7, 1.7]flipXboolfalseflipYboolfalseblendenumpremultipliedfilterenumnearest
Card 4
Transform
position[3.8, 1.2]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")layerint0orderint0tintColor#fffffffforiginVec2[0.5, 0.5]sizeVec2[0.35, 0.35]flipXboolfalseflipYboolfalseblendenumpremultipliedfilterenumnearest
Scriptmain.aes
package demo

import "aego/input"

// Space advances through the seven effects and the original image.
script EffectSwitch {
    var mode int

    func Update(dt float) {
        if input.KeyPressed(input.KeySpace) {
            mode = (mode + 1) % 8
            fx := node.Get<PostProcess>()
            fx.SetEffectEnabled("bloom", mode == 0)
            fx.SetEffectEnabled("grade", mode == 1)
            fx.SetEffectEnabled("vignette", mode == 2)
            fx.SetEffectEnabled("chromatic", mode == 3)
            fx.SetEffectEnabled("pixelate", mode == 4)
            fx.SetEffectEnabled("crt", mode == 5)
            fx.SetEffectEnabled("custom", mode == 6)
        }
    }
}

Fields

NameTypeDefaultDescription
Enabledbooltrue

Enable this camera's output stack. Disabled stacks do not claim the output.

Effects[]render2d.PostEffect[]

Ordered effect instances. Each instance keeps its own identity and typed parameters.

not in scripts

Methods

SetBool method

func (PostProcess) SetBool(key string, value bool)

Sets a boolean parameter by instanceID:Field.

key is instanceID:Field; the target must be a boolean parameter. Unknown targets or incompatible field kinds report a script error before assignment.

SetEffectEnabled method

func (PostProcess) SetEffectEnabled(instanceID string, enabled bool)

Enables or disables an effect by its stable instance ID.

instanceID is the stable ID of an existing effect, not its type or position in the stack. A missing instance reports a script error before changing it. This changes the instance switch; the component must also be enabled.

SetFloat method

func (PostProcess) SetFloat(key string, value float)

Sets a float parameter using instanceID:Field, without changing any shared material.

key is instanceID:Field, for example the Bloom instance ID followed by :Intensity. value must match the descriptor's floating-point field and constraints. An unresolved instance, missing field or incompatible value reports a script error without applying that assignment. This edits the instance, not a shared material.

SetInt method

func (PostProcess) SetInt(key string, value int)

Sets a signed int32 parameter by instanceID:Field.

key is instanceID:Field. The integer must fit signed int32 and match the field descriptor; an out-of-range integer or unresolved target reports a script error before assignment.

SetVec2 method

func (PostProcess) SetVec2(key string, value Vec2)

Sets a vec2 parameter using instanceID:Field.

key is instanceID:Field; value supplies two lanes. The field descriptor must accept that value. An unresolved target or type mismatch reports a script error before assignment.

SetVec3 method

func (PostProcess) SetVec3(key string, value Vec3)

Sets a vec3 parameter by instanceID:Field.

key is instanceID:Field; value supplies three lanes. The field descriptor must accept that value. An unresolved target or type mismatch reports a script error before assignment.

SetVec4 method

func (PostProcess) SetVec4(key string, value aego/material.Vec4)

Sets a vec4 parameter by instanceID:Field.

key is instanceID:Field; value is material.Vec4, with X, Y, Z and W lanes. The field descriptor must accept that value. An unresolved target or type mismatch reports a script error before assignment.