Stylize effects
Updated
Stylize effects give the whole image a look: chunky Pixelation, ASCII text art, a printed Dot Screen, CRT Scanlines, film-grain Noise and a digital Glitch. Each is one component on a camera.
| Component | Type | What it does |
|---|---|---|
| Pixelation Effect | comp-pixelation-effect | Draws the image in large square pixels, like a retro game. |
| Ascii Effect | comp-ascii-effect | Redraws the image as text characters. |
| Dot Screen Effect | comp-dot-screen-effect | Redraws the image as halftone dots, like print. |
| Scanline Effect | comp-scanline-effect | Horizontal lines over the image, like an old screen. |
| Noise Effect | comp-noise-effect | Animated film grain over the image. |
| Glitch Effect | comp-glitch-effect | Tears and shifts the image now and then, like a broken video signal. |
The effects
Section titled “The effects”Pixelation
Section titled “Pixelation”PixelationEffectComponent draws the image in large square pixels.
| Prop | Type | Default | Description |
|---|---|---|---|
granularity |
number |
6 |
Size of a pixel block, in screen pixels, 0 to 128. |
AsciiEffectComponent redraws the image as text characters.
| Prop | Type | Default | Description |
|---|---|---|---|
characters |
string |
" . |
Characters from darkest to brightest. An empty string restores the default. |
font |
string |
'inter' |
A font family by name: bundled, saved in the project, or registered by a script with Fonts.. |
fontSize |
number |
54 |
Font size of the character atlas, in pixels, 8 to 256. |
cellSize |
number |
16 |
Size of a character cell on screen, in pixels, 1 to 128. |
color |
string |
none | One colour for every character; unset keeps the image’s colours. |
invert |
boolean |
false |
Use the brightest characters for the darkest parts. |
ASCII reads the image as the effects before it left it, so Bloom and Lens Drops show through the characters. It costs one more full-screen pass when another effect comes before it.
The camera's ASCII effect redraws a sunny courtyard as text characters. Buttons switch between the full-colour look and a green terminal, and between fine and coarse cells.
Press Colour, Terminal or Coarse, and orbit the camera to watch the characters follow the shapes. Drag to orbit the camera, scroll to zoom.
Dot Screen
Section titled “Dot Screen”DotScreenEffectComponent redraws the image as halftone dots, like print.
| Prop | Type | Default | Description |
|---|---|---|---|
intensity |
number |
1 |
How strongly the dots replace the image, 0 to 1. |
angle |
number |
90 |
Angle of the dot grid, in degrees, -180 to 180. |
scale |
number |
1 |
Grid frequency, -2 to 2; higher magnitudes are finer. |
The camera's Dot Screen effect turns the view into printed halftone dots, at the runtime Effects demo's strength. The script turns the dot grid and steps it between fine and coarse.
Watch the dot grid turn and change size every few seconds. Drag to orbit the camera, scroll to zoom.
Scanline
Section titled “Scanline”ScanlineEffectComponent draws horizontal lines over the image, like an old screen.
| Prop | Type | Default | Description |
|---|---|---|---|
intensity |
number |
0.5 |
How dark the lines are, 0 to 1. |
density |
number |
1.25 |
Lines per screen pixel row, -2 to 2; higher is finer. |
scrollSpeed |
number |
0 |
How fast the lines roll down the screen, -5 to 5. 0 keeps them still. |
NoiseEffectComponent adds animated film grain.
| Prop | Type | Default | Description |
|---|---|---|---|
intensity |
number |
0.25 |
How strong the grain is, 0 to 1. |
premultiply |
boolean |
false |
Scale the grain by the image’s brightness, so dark areas stay clean. |
Glitch
Section titled “Glitch”GlitchEffectComponent tears and shifts the image now and then, like a broken video signal.
| Prop | Type | Default | Description |
|---|---|---|---|
active |
boolean |
true |
Whether glitches happen. false keeps the effect ready but quiet. |
delay |
[number, number] |
[1.5, 3.5] |
Seconds between glitches, as [min, max], each 0 to 10. |
duration |
[number, number] |
[0.6, 1] |
Seconds a glitch lasts, as [min, max], each 0 to 5. |
strength |
[number, number] |
[0.3, 1] |
Strength of weak and strong glitches, as [weak, strong], each 0 to 1. |
columns |
number |
0.05 |
Width of the torn columns, 0 to 1. |
ratio |
number |
0.85 |
Share of weak glitches, 0 to 1. |
The camera's Glitch effect tears and shifts the view now and then, like a damaged feed. Buttons switch between a calm feed, the default glitches and a badly broken signal.
Press Calm, Glitchy or Broken and watch how often and how hard the picture tears. Drag to orbit the camera, scroll to zoom.
Examples
Section titled “Examples”1. Switch a retro screen on and off
Section titled “1. Switch a retro screen on and off”Pixelation, Scanline and Noise on the camera together make the scene look like an old monitor. Space fades all three in or out at once.
#pragma lifecycle(startup, update)
let pixels;let lines;let grain;let retro = true;let fade = null;
function setRetro(amount) { pixels.setProps({ granularity: Math.max(1, Math.round(amount * 8)) }); lines.setProps({ intensity: amount * 0.3 }); grain.setProps({ intensity: amount * 0.08 });}
function startup() { const eye = findEntity('Main Camera'); pixels = eye.getComponent(PixelationEffectComponent); lines = eye.getComponent(ScanlineEffectComponent); grain = eye.getComponent(NoiseEffectComponent); setRetro(1); log('Retro screen on');}
function update() { if (!Input.keyboard.isKeyReleased(Key.Space)) return; retro = !retro; if (fade) fade.stop(); fade = Tween.value(retro ? 0 : 1, retro ? 1 : 0, setRetro, { duration: 0.6, ease: Ease.InOutQuad }); log(retro ? 'Retro screen on' : 'Clean picture');}Pixelation, Scanline and Noise effects on the camera make the scene look like an old monitor; pressing Space tweens all three in or out together.
Click the scene, then press Space to fade between the retro look and the clean picture. Drag to orbit the camera, scroll to zoom.
- One function,
setRetro, sets all three effects from a single amount, so a tween of that amount fades the whole look. granularitystays at least1: a block of one screen pixel is the clean picture.- A new press stops the running tween first, so a quick double press turns the fade around instead of fighting it.