# Special Effects

Special effects are activated via @spawn command followed by the effect name. E.g.:

@spawn ShakeBackground

— will shake the main background.

You can control parameters of the effect with params parameter. E.g.:

@spawn ShakeCharacter params:Kohaku,1

— will shake character with ID "Kohaku" once, instead of the default 3.

It's possible to selectively specify a subset of the parameters, leaving the rest at the default values:

@spawn ShakePrinter params:,,0.5

— notice the first two parameters (printer ID and shake count) are skipped and will have their default values, but the third parameter (shake duration) is set to 0.5 seconds.

You can update the effect parameters without re-starting it with the consequent @spawn commands, eg:

; Start slowly shaking `Kohaku` character in a loop, 
; don't wait for completion (it's an infinite loop, anyway)
@spawn ShakeCharacter params:Kohaku,0,,,0.1 wait:false
Kohaku: It's rumbling!
; Shake 3 more times with an increased amplitude
@spawn ShakeCharacter params:Kohaku,3,,,0.8

Some effects are persistent by default and should be manually stopped with @despawn command. E.g.:

; Start the rain
@spawn Rain
; Stop the rain
@despawn Rain

The @despawn commands of some effects can also receive parameters (eg, to control the fade-out duration), eg:

; Stops the rain gradually over 10 seconds
@despawn Rain params:10

When no params is specified, default parameters will be used. You can find both "start" (accepted by the @spawn command) and "stop" (accepted by the @despawn command) parameters available for each effect and their default values in the docs below.

It's possible to start multiple effects of the same type by appending an ID delimited by # after the effect name, eg:

; Shake both `Kohaku` and `Yuko` in a loop
@spawn ShakeCharacter#1 params:Kohaku,0 wait:false
@spawn ShakeCharacter#2 params:Yuko,0 wait:false

When stopping or updating instanced effects, don't forget to specify the ID:

; Stop shaking `Yuko`, increase `Kohaku` amplitude
@despawn ShakeCharacter#2
@spawn ShakeCharacter#1 params:Kohaku,0,,,1

You can use any string for ID (it can be a number like above, or something more meaningful, eg @spawn ShakeCharacter#Kohaku), just make sure it's unique among other IDs you're using with a given effect name.

# Shake Printer

Shakes printer with the specified ID or the default one.

Start Parameters

Name Type Default Description
Printer ID String null ID of the printer to shake. Will shake a default printer when not specified.
Shake count Integer 2 The number of shake iterations. When set to 0, will loop the effect until stopped with @despawn.
Shake duration Decimal 0.15 The base duration of each shake iteration, in seconds.
Duration variation Decimal 0.25 The randomized delta modifier applied to the base duration of the effect.
Shake amplitude Decimal 0.5 The base displacement amplitude of each shake iteration, in units.
Amplitude variation Decimal 0.1 The randomized delta modifier applied to the base displacement amplitude of the effect.
Shake horizontally Boolean false Whether to displace the actor horizontally (by x-axis).
Shake vertically Boolean true Whether to displace the actor vertically (by y-axis).

Be aware, that when UI is set to "Screen Space Overlay" mode, shake amplitude needs to be about x100 times the default one for a noticeable effect.

Examples

; Shake a default printer with default params
@spawn ShakePrinter

; Shake a default printer horizontally 10 times 
@spawn ShakePrinter params:,10,,,,,true,false

; Start shaking a default printer in loop, print some text, stop the shaking
@spawn ShakePrinter params:,0 wait:false
What a shaky situation!
@despawn ShakePrinter

# Shake Background

Shakes background with the specified ID or the main one.

Start Parameters

Name Type Default Description
Background ID String null ID of the background to shake. Will shake main background when not specified.
Shake count Integer 3 The number of shake iterations. When set to 0, will loop the effect until stopped with @despawn.
Shake duration Decimal 0.15 The base duration of each shake iteration, in seconds.
Duration variation Decimal 0.25 The randomized delta modifier applied to the base duration of the effect.
Shake amplitude Decimal 0.5 The base displacement amplitude of each shake iteration, in units.
Amplitude variation Decimal 0.5 The randomized delta modifier applied to the base displacement amplitude of the effect.
Shake horizontally Boolean false Whether to displace the actor horizontally (by x-axis).
Shake vertically Boolean true Whether to displace the actor vertically (by y-axis).

Examples

; Shake main background with default params
@spawn ShakeBackground

; Shake `Video` background twice 
@spawn ShakeBackground params:Video,2

# Shake Character

Shakes character with the specified ID or a random visible one.

Start Parameters

Name Type Default Description
Character ID String null ID of the character to shake. Will shake a random visible one when not specified.
Shake count Integer 3 The number of shake iterations. When set to 0, will loop the effect until stopped with @despawn.
Shake duration Decimal 0.15 The base duration of each shake iteration, in seconds.
Duration variation Decimal 0.25 The randomized delta modifier applied to the base duration of the effect.
Shake amplitude Decimal 0.5 The base displacement amplitude of each shake iteration, in units.
Amplitude variation Decimal 0.5 The randomized delta modifier applied to the base displacement amplitude of the effect.
Shake horizontally Boolean false Whether to displace the actor horizontally (by x-axis).
Shake vertically Boolean true Whether to displace the actor vertically (by y-axis).

Examples

; Shake `Kohaku` character with default parameters
@spawn ShakeCharacter params:Kohaku

; Start shaking a random character, show a choice to stop and act accordingly
@spawn ShakeCharacter params:,0 wait:false
@choice "Continue shaking" goto:.Continue
@choice "Stop shaking" goto:.Stop
@stop
# Stop
@despawn ShakeCharacter
# Continue
...

# Shake Camera

Shakes the main Naninovel render camera.

Start Parameters

Name Type Default Description
Camera Name String null Name of the camera object to shake. Will shake the main Naninovel camera when not provided.
Shake count Integer 3 The number of shake iterations. When set to 0, will loop the effect until stopped with @despawn.
Shake duration Decimal 0.15 The base duration of each shake iteration, in seconds.
Duration variation Decimal 0.25 The randomized delta modifier applied to the base duration of the effect.
Shake amplitude Decimal 0.5 The base displacement amplitude of each shake iteration, in units.
Amplitude variation Decimal 0.5 The randomized delta modifier applied to the base displacement amplitude of the effect.
Shake horizontally Boolean false Whether to displace the actor horizontally (by x-axis).
Shake vertically Boolean true Whether to displace the actor vertically (by y-axis).

Examples

; Shake the main Naninovel camera with default params
@spawn ShakeCamera

; Shake the main Naninovel camera horizontally 5 times 
@spawn ShakeCamera params:,5,,,,,true,false

# Animate Actor

In case you wish to change (animate) actor parameters directly, consider using @animate command.

# Digital Glitch

Applies a post-processing effect to the main camera simulating digital video distortion and artifacts.

Start Parameters

Name Type Default Description
Duration Decimal 1 The duration of the effect, in seconds.
Intensity Decimal 1 The intensity of the effect, in 0.0 to 10.0 range.

Examples

; Apply the glitch effect with default parameters
@spawn DigitalGlitch
; Apply the effect over 3.33 seconds with a low intensity
@spawn DigitalGlitch params:3.33,0.1

# Rain

Spawns a particle system simulating a rain.

Start Parameters

Name Type Default Description
Intensity Decimal 500 The intensity of the rain (particles spawn rate per second).
Fade-in time Decimal 5 The particle system will gradually grow the spawn rate from 0 to the target level over the specified time, in seconds.
X velocity Decimal 1 Multiplier to the horizontal speed of the particles. Use to change angle of the rain drops.
Y velocity Decimal 1 Multiplier to the vertical speed of the particles.

Stop Parameters

Name Type Default Description
Fade-out time Decimal 5 The particle system will gradually lower the spawn rate from the target level to 0 over the specified time, in seconds.

Examples

; Start intensive rain over 10 seconds
@spawn Rain params:1500,10
; Stop the rain over 30 seconds
@despawn Rain params:30

# Snow

Spawns a particle system simulating a snow.

Start Parameters

Name Type Default Description
Intensity Decimal 100 The intensity of the snow (particles spawn rate per second).
Fade-in time Decimal 5 The particle system will gradually grow the spawn rate from 0 to the target level over the specified time, in seconds.

Stop Parameters

Name Type Default Description
Fade-out time Decimal 5 The particle system will gradually lower the spawn rate from the target level to 0 over the specified time, in seconds.

Examples

; Start intensive snow over 10 seconds
@spawn Snow params:300,10
; Stop the snow over 30 seconds
@despawn Snow params:30

# Sun Shafts

Spawns a particle system simulating sun shafts (rays).

Start Parameters

Name Type Default Description
Intensity Decimal 0.85 The intensity of the rays (opacity).
Fade-in time Decimal 3 The particle system will gradually grow the intensity from 0 to the target level over the specified time, in seconds.

Stop Parameters

Name Type Default Description
Fade-out time Decimal 3 The particle system will gradually lower the opacity from the target level to 0 over the specified time, in seconds.

Examples

; Start intensive sunshine over 10 seconds
@spawn SunShafts params:1,10
; Stop the sunshine over 30 seconds
@despawn SunShafts params:30

# Depth of Field (Bokeh)

Simulates depth of field (aka DOF, bokeh) effect, when only the object in focus stays sharp, while the other image is blurred.

Start Parameters

Name Type Default Description
Focus Object Name String null Name of the game object to set focus for (optional). When set, the focus will always stay on the game object and Focus Distance parameter will be ignored.
Focus Distance Decimal 10 Distance from the Naninovel camera to the focus point. Ignored when Focus Object Name is specified.
Focal Length Decimal 3.75 Amount of blur to apply for the de-focused areas; also determines focus sensitivity.
Duration Decimal 1 Interpolation time (how fast the parameters will reach the target values).

Stop Parameters

Name Type Default Description
Stop Duration Decimal 1 Fade-off (disable) duration for the effect parameters to reach default values where the effect is not visible.

Examples

; Enable the effect with default parameters and lock focus to `Kohaku` game object
@spawn DepthOfField params:Kohaku
; Fade-off (disable) the effect over 10 seconds
@despawn DepthOfField params:10
; Set focus point 10 units away from the camera,
; focal distance to 0.95 and apply it over 3 seconds
@spawn DepthOfField params:,10,0.95,3

# Adding Custom Effects

# Standalone Effects

You can add a custom standalone effect (implemented via a prefab, like the "Rain" and "Snow" built-in effects) by adding the effect prefab via spawn resources managers (Naninovel -> Resources -> Spwan) and using @spawn and @despawn commands in the same way as with the built-in effects.

For example, given there is a Explosion.prefab prefab assigned via the spawn manager, following commands will spawn and de-spawn (destroy) the prefab on scene:

@spawn Explosion
@despawn Explosion

In case you have a lot of prefabs to spawn and it's inconvenient to assign them via editor menu, it's possible to just drop them at Resources/Naninovel/Spawn folder and they'll automatically be available in the scripts. You can additionally organize them with sub-folders, if you wish; in this case use forward slashes (/) when referencing them in naninovel scripts. Eg, prefab asset stored as Resources/Naninovel/Spawn/Explosions/Boom01 can be referenced in scripts as Explosions/Boom01.

It's also possible to use addressable asset system to manually expose the resources. To expose an asset, assign address equal to the path you'd use to expose it via the method described above, except omit the "Resources/" part. Eg, to expose a "Boom01" prefab asset, assign the asset following address: Naninovel/Spawn/Boom01. Be aware, that addressable provider is not used in editor by default; you can allow it by enabling Enable Addressable In Editor property in resource provider configuration menu.

Check the built-in effect prefabs stored at Naninovel/Prefabs/FX for reference implementations.

# Camera Effects

If you wish to apply a custom post-processing effect (aka image effect or camera filter, like the "Digital Glitch" built-in effect) to the Naninovel camera, create a camera prefab, add the required effect components to the camera's object and assign the prefab to Custom Camera Prefab field in the camera configuration menu (Naninovel -> Configuration -> Camera).

You can toggle (enable if disabled and vice-versa) the added components via naninovel scripts using toggle parameter and explicitly set the enabled state with set parameter of the @camera command. For example, let's assume you've added a "Bloom Image Effect" component to the camera object. First, find out what is the type name of the component; it's usually specified in the Script field of the component.

In our case the component's type name is BloomImageEffect. Use the type name to toggle this component at runtime like follows:

@camera toggle:BloomImageEffect

You can toggle multiple components at once by delimiting the type names with commas:

@camera toggle:BloomImageEffect,Sepia,CameraNoise

And in case you want to explicitly enable or disable a component:

@camera set:BloomImageEffect.true,Sepia.false,CameraNoise.true

— will enabled BloomImageEffect and CameraNoise components, while disabling Sepia.

To toggle, disable or enable all the components attached to the camera object, use * symbol.

; Toggle all components
@camera toggle:*

; Disable all components
@camera set:*.false

; Enable all components
@camera set:*.true

The state of the currently enabled (and disabled) camera components will be automatically saved and restored on game save-loading operations.

Check out the following video for example on adding a custom camera filter effect.

Last Updated: November 10, 2020