Skip to content

Special Effects

A number of built-in script commands are dedicated for various special effects. For example, @shake command shakes an actor:

nani
; Shake 'Kohaku' actor
@shake Kohaku

Most effects can be parameterized:

nani
; Shake 'Kohaku' once (instead of the default 3)
@shake Kohaku count:1

You can update effect parameters without restarting the effect:

nani
; Start slowly shaking `Kohaku` actor in a loop
@shake Kohaku loop! power:0.1
Kohaku: It's rumbling!
; Shake 3 more times with an increased amplitude
@shake Kohaku count:3 power:0.8

Some effects are persistent by default and must be explicitly stopped:

nani
; Start the rain
@rain
; Stop the rain
@rain power:0

Read on for descriptions of the built-in effects and the ways to add custom effects.

Spawned Effects

Spawned effects are based on the @spawn command or are derived from it. They can be one-off (like @glitch) or continuous (like @show or @blur). Read on for the list of the standard effects and the ways to add custom ones.


✨ Shake

Shakes the specified actor or the main camera. Dedicated command: @shake

cover

Start Parameters

NameTypeDefaultDescription
IDStringnullID of the actor to shake. Specify Camera to shake main camera.
Shake countInteger3The number of shake iterations.
LoopBooleanfalseWhen enabled, will loop the effect until stopped with @despawn.
Shake durationDecimal0.15The base duration of each shake iteration, in seconds.
Duration variationDecimal0.25The randomized delta modifier applied to the base duration of the effect.
Shake amplitudeDecimal0.5The base displacement amplitude of each shake iteration, in units.
Amplitude variationDecimal0.5The randomized delta modifier applied to the base displacement amplitude of the effect.
Shake horizontallyBooleanfalseWhether to displace the actor horizontally (by x-axis).
Shake verticallyBooleantrueWhether to displace the actor vertically (by y-axis).

Examples

nani
; Shake the current default text printer
@shake

; Shake "Kohaku" actor with default params
@shake Kohaku

; Shake the main camera horizontally 5 times
@shake Camera count:5 hor!

✨ Glitch

Applies a post-processing effect to the main camera simulating digital video distortion and artifacts. Dedicated command: @glitch

cover

Start Parameters

NameTypeDefaultDescription
DurationDecimal1The duration of the effect, in seconds.
IntensityDecimal1The intensity of the effect, in 0.0 to 10.0 range.

Examples

nani
; Apply the glitch effect with default parameters
@glitch

; Apply the effect over 3.33 seconds with a low intensity
@glitch power:0.1 time:3.33

✨ Rain

Spawns a particle system simulating rain. Dedicated command: @rain

cover

Start Parameters

NameTypeDefaultDescription
IntensityDecimal0.5The intensity of the rain (particles spawn rate per second).
Fade-in timeDecimal5The particle system will gradually grow the spawn rate from 0 to the target level over the specified time, in seconds.
X velocityDecimal1Multiplier to the horizontal speed of the particles. Use to change angle of the rain drops.
Y velocityDecimal1Multiplier to the vertical speed of the particles.

Stop Parameters

NameTypeDefaultDescription
Fade-out timeDecimal5The particle system will gradually lower the spawn rate from the target level to 0 over the specified time, in seconds.

Examples

nani
; Start intensive rain over 10 seconds
@rain power:1 time:10

; Stop the rain over 30 seconds
@rain power:0 time:30

✨ Snow

Spawns a particle system simulating snow. Dedicated command: @snow

cover

Start Parameters

NameTypeDefaultDescription
IntensityDecimal0.5The intensity of the snow (particles spawn rate per second).
Fade-in timeDecimal5The particle system will gradually grow the spawn rate from 0 to the target level over the specified time, in seconds.

Stop Parameters

NameTypeDefaultDescription
Fade-out timeDecimal5The particle system will gradually lower the spawn rate from the target level to 0 over the specified time, in seconds.

Examples

nani
; Start intensive snow over 10 seconds
@snow power:1 time:10

;Stop the snow over 30 seconds
@snow power:0 time:30

✨ Sun

Spawns a particle system simulating sun shafts (rays). Dedicated command: @sun

cover

Start Parameters

NameTypeDefaultDescription
IntensityDecimal0.85The intensity of the rays (opacity).
Fade-in timeDecimal3The particle system will gradually grow the intensity from 0 to the target level over the specified time, in seconds.

Stop Parameters

NameTypeDefaultDescription
Fade-out timeDecimal3The particle system will gradually lower the opacity from the target level to 0 over the specified time, in seconds.

Examples

nani
; Start intensive sunshine over 10 seconds
@sun power:1 time:10

; Stop the sunshine over 30 seconds
@sun power:0 time:30

✨ Bokeh

Simulates depth of field (aka DOF, bokeh) effect, where only the object in focus stays sharp while the rest of the image is blurred. Dedicated command: @bokeh

TIP

In case you want to blur just one object (actor), consider using Blur effect instead.

cover

Start Parameters

NameTypeDefaultDescription
Focus Object NameStringnullName 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 DistanceDecimal10Distance from the Naninovel camera to the focus point. Ignored when Focus Object Name is specified.
Focal LengthDecimal3.75Amount of blur to apply for the de-focused areas; also determines focus sensitivity.
DurationDecimal1Interpolation time (how fast the parameters will reach the target values).

Stop Parameters

NameTypeDefaultDescription
Stop DurationDecimal1Fade-off (disable) duration for the effect parameters to reach default values where the effect is not visible.

Examples

nani
; Enable bokeh with default params and lock focus on "Kohaku" game object
@bokeh Kohaku

; Fade-off (disable) the effect over 10 seconds
@bokeh power:0

; Set focus point 10 units away from the camera,
; focal length to 0.95 and apply it over 3 seconds
@bokeh dist:10 power:0.95 time:3

✨ Blur

Applies a blur filter to a supported actor: backgrounds and characters of sprite, layered, diced, Live2D, Spine, video and scene implementations. By default (when the first parameter is not specified), the effect is applied to the MainBackground actor. Dedicated command: @blur

cover

Start Parameters

NameTypeDefaultDescription
Actor IDStringMainBackgroundID of the actor to apply the effect for. The actor should have IBlurable interface implemented in order to support the effect.
IntensityDecimal0.5Intensity of the effect, in 0.0 to 1.0 range.
DurationDecimal1Interpolation time, in seconds (how fast the intensity will reach the target value).

Stop Parameters

NameTypeDefaultDescription
Stop DurationDecimal1Fade-off (disable) duration for the effect, in seconds.

Examples

nani
; Apply the blur to the current main background
@blur

; Apply the blur to "Sky" background with full intensity over 2.5 seconds
@blur Sky power:1 time:2.5

; Fade-off and disable the blur
@blur power:0

Transition Effects

When changing background and character appearances with @back and @char or performing scene transition with @trans command, you can additionally specify which transition effect to use. For example, the following command will transition to the "River" background using the "DropFade" transition effect:

nani
@back River.DropFade

When no transition effect is specified, a cross-fade is used by default.

You can also specify duration of the transition (in seconds) with the time parameter:

nani
@back River.DropFade time:1.5

The above statement will transition to "River" background using "DropFade" transition over 1.5 seconds. Default time for all transitions is 0.35 seconds.

If you wish to wait for the transition to complete before playing the next command, add wait!:

nani
@back River.Ripple time:1.5 wait!
@bgm PianoTheme

— "PianoTheme" background music will start playing only after the transition is complete.

Some of the transition effects also support additional parameters, which you can control with params parameter:

nani
@back River.Ripple params:10,5,0.02

— will set the frequency of the ripple effect to 10, speed to 5 and amplitude to 0.02. When no params is specified, default parameters will be used.

If you wish to modify selected parameters, you can skip others and they'll have their default values:

nani
@back River.Ripple params:,,0.02

All the transition parameters are of decimal type.

The above examples work for characters as well; just assign the transition with via parameter:

nani
@char CharID.Appearance via:TransitionType params:...

You can find available transition effects with their parameters and default values in the docs below.


💫 BandedSwirl

cover

Parameters

NameDefault
Twist amount5
Frequency10

Examples

nani
; Apply the transition with default parameters
@back Appearance.BandedSwirl

; Apply the transition with default twist amount, but low frequency
@back Appearance.BandedSwirl params:,2.5

💫 Blinds

cover

Parameters

NameDefault
Count6

Examples

nani
; Apply the transition with default parameters
@back Appearance.Blinds

; Apply the transition using 30 blinds instead of default 6
@back Appearance.Blinds params:30

💫 CircleReveal

cover

Parameters

NameDefault
Fuzzy amount0.25

Examples

nani
; Apply the transition with default parameters
@back Appearance.CircleReveal

; Apply the transition with a high fuzzy amount
@back Appearance.CircleReveal params:3.33

💫 CircleStretch

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.CircleStretch

💫 CloudReveal

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.CloudReveal

💫 Crossfade

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Crossfade

💫 Crumble

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Crumble

💫 Dissolve

cover

Parameters

NameDefault
Step99999

Examples

nani
; Apply the transition with default parameters
@back Appearance.Dissolve

; Apply the transition with a low step
@back Appearance.Dissolve params:100

💫 DropFade

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.DropFade

💫 LineReveal

cover

Parameters

NameDefault
Fuzzy amount0.25
Line Normal X0.5
Line Normal Y0.5
Reverse0

Examples

nani
; Apply the transition with default parameters
@back Appearance.LineReveal

; Apply the transition with a vertical line slide
@back Appearance.LineReveal params:,0,1

; Apply the transition in reverse (right to left)
@back Appearance.LineReveal params:,,,1

💫 Pixelate

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Pixelate

💫 RadialBlur

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.RadialBlur

💫 RadialWiggle

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.RadialWiggle

💫 RandomCircleReveal

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.RandomCircleReveal

💫 Ripple

cover

Parameters

NameDefault
Frequency20
Speed10
Amplitude0.5

Examples

nani
; Apply the transition with default parameters
@back Appearance.Ripple

; Apply the transition with a high frequency and amplitude
@back Appearance.Ripple params:45,,1.1

💫 RotateCrumble

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.RotateCrumble

💫 Saturate

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Saturate

💫 Shrink

cover

Parameters

NameDefault
Speed200

Examples

nani
; Apply the transition with default parameters
@back Appearance.Shrink

; Apply the transition with a low speed
@back Appearance.Shrink params:50

💫 SlideIn

cover

Parameters

NameDefault
Slide amount1

Examples

nani
; Apply the transition with default parameters
@back Appearance.SlideIn

💫 SwirlGrid

cover

Parameters

NameDefault
Twist amount15
Cell count10

Examples

nani
; Apply the transition with default parameters
@back Appearance.SwirlGrid

; Apply the transition with high twist and low cell count
@back Appearance.SwirlGrid params:30,4

💫 Swirl

cover

Parameters

NameDefault
Twist amount15

Examples

nani
; Apply the transition with default parameters
@back Appearance.Swirl

; Apply the transition with high twist
@back Appearance.Swirl params:25

💫 Water

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Water

💫 Waterfall

cover

Examples

nani
; Apply the transition with default parameters
@back Appearance.Waterfall

💫 Wave

cover

Parameters

NameDefault
Magnitude0.1
Phase14
Frequency20

Examples

nani
; Apply the transition with default parameters
@back Appearance.Wave

; Apply the transition with a high magnitude and low frequency
@back Appearance.Wave params:0.75,,5

Adding Custom Effects

Custom Spawned 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 manager (Naninovel -> Resources -> Spawn) and using @spawn and @despawn commands:

cover

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:

nani
@spawn Explosion
@despawn Explosion

Additional effect parameters can be specified with params:

nani
@spawn Explosion params:Kohaku,3,true

TIP

When building custom effects with multiple parameters, consider creating a custom command and inheriting it from SpawnEffect. This way you won't have to remember parameter positions in the params array and get auto-completion and type-checking when using IDE extension:

nani
@explode Kohaku power:3 smoke!

The @spawn command also has transform parameters, allowing to spawn the object at a specific scene or world positions and with a specific rotation or scale, eg:

nani
; Spawn Explosion 15% from the left border of the screen
; with x10 scale and rotated by 15 degrees over z-axis.
@spawn Explosion pos:15 scale:10 rotation:,,15

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 scenario 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.

Custom 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).

cover

You can toggle (enable if disabled and vice-versa) the added components via scenario 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.

cover

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

nani
@camera toggle:BloomImageEffect

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

nani
@camera toggle:BloomImageEffect,Sepia,CameraNoise

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

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

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

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

nani
; 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.

cover

Custom Transition Effects

Dissolve Mask

You can make custom transitions based on a dissolve mask texture. Dissolve mask is a greyscale texture, where the color defines when the pixel will transition to the target texture. For example, consider the following spiral dissolve mask:

cover

— the black square in the top-right corner indicates that the transition target should be displayed there at the start of the transition and the pure-white square in the center will transition in the very end.

TIP

For optimal memory usage, set "Single Channel" and "Red" in the dissolve texture import settings. Also, make sure Non-Power of 2 and Generate Mip Maps options are disabled to prevent visual artifacts.

cover

To make a custom transition, use Custom transition mode and specify path (relative to project "Resources" folder) to the dissolve mask texture via the dissolve parameter, eg:

nani
@back Appearance.Custom dissolve:Textures/Spiral

To smooth (fuzz) borders of the transition, use first parameter in 0 (no smoothing) to 100 (max smoothing) range, eg:

nani
@back Appearance.Custom dissolve:Textures/Spiral params:90

To invert the transition (brighter areas of the dissolve mask will be displayed first), set second parameter to 1, eg:

nani
@back Appearance.Custom dissolve:Textures/Spiral params:,1

Check out the following video for the usage examples.

cover

Custom Shader

It's possible to add a completely custom transition effect via a custom actor shader ↗.

WARNING

The topic requires graphic programming skills in Unity. We're not providing any support or tutorials on writing custom shaders; consult the support page for more information.

Create a new shader and assign it to Custom Texture Shader property of the actors, which are supposed to use the custom transition effects; see custom actor shader guide for more information on how to create and assign custom actor shaders.

When a transition name is specified in a script command, shader keyword ↗ with the same name (prefixed with NANINOVEL_TRANSITION_) is enabled in the material used by the actor.

To add your own transitions to a custom actor shader, use multi_compile directive, eg:

c
#pragma multi_compile_local _ NANINOVEL_TRANSITION_CUSTOM1 NANINOVEL_TRANSITION_CUSTOM2

— will add Custom1 and Custom2 transitions.

You can then use conditional directives to select a specific render method based on the enabled transition keyword. When re-using built-in actor shader, it's possible to implement custom transitions via ApplyTransitionEffect method, which is used in the fragment handler:

c
fixed4 ApplyTransitionEffect(sampler2D mainTex, float2 mainUV,
    sampler2D transitionTex, float2 transitionUV, float progress,
    float4 params, float2 randomSeed, sampler2D cloudsTex, sampler2D customTex)
{
    const fixed4 CLIP_COLOR = fixed4(0, 0, 0, 0);
    fixed4 mainColor = Tex2DClip01(mainTex, mainUV, CLIP_COLOR);
    fixed4 transColor = Tex2DClip01(transitionTex, transitionUV, CLIP_COLOR);

    #ifdef NANINOVEL_TRANSITION_CUSTOM1 // Custom1 transition.
    return transitionUV.x > progress ? mainColor
        : lerp(mainColor / progress * .1, transColor, progress);
    #endif

    #ifdef NANINOVEL_TRANSITION_CUSTOM2 // Custom2 transition.
    return lerp(mainColor * (1.0 - progress), transColor * progress, progress);
    #endif

    // When no transition keywords are enabled, default to crossfade.
    return lerp(mainColor, transColor, progress);
}

You'll then be able to invoke the added transitions in the same way as the built-in ones, eg:

nani
@back Snow.Custom1
@back River.Custom2

For the complete shader example see custom actor shader guide.