Convert Figma logo to code with AI

keijiro logoKinoGlitch

Video glitch effects for Unity

2,493
231
2,493
7

Top Related Projects

Post Processing Stack

4,049

A generic post-processing injector for games and video software.

Quick Overview

KinoGlitch is a collection of glitch effects for Unity's post-processing stack. It provides various visual glitches and distortions that can be applied to the camera output in real-time, enhancing the visual aesthetics of games or interactive experiences with unique, glitchy effects.

Pros

  • Easy integration with Unity's post-processing stack
  • Variety of glitch effects available (e.g., analog noise, digital glitch, scan line jitter)
  • Customizable parameters for fine-tuning effects
  • Lightweight and performant implementation

Cons

  • Requires Unity's post-processing stack to be set up
  • Limited documentation and examples
  • May not be suitable for all art styles or game genres
  • Some effects may be too intense for extended use

Code Examples

  1. Adding a glitch effect to a post-processing volume:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class GlitchEffectExample : MonoBehaviour
{
    void Start()
    {
        var volume = GetComponent<PostProcessVolume>();
        var glitch = volume.profile.AddSettings<AnalogGlitch>();
        glitch.enabled.Override(true);
        glitch.scanLineJitter.Override(0.5f);
    }
}
  1. Animating a glitch effect over time:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class AnimatedGlitchExample : MonoBehaviour
{
    public PostProcessVolume volume;
    private DigitalGlitch glitch;

    void Start()
    {
        glitch = volume.profile.GetSetting<DigitalGlitch>();
    }

    void Update()
    {
        float intensity = Mathf.PingPong(Time.time, 1f);
        glitch.intensity.Override(intensity);
    }
}
  1. Triggering a glitch effect based on an event:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class GlitchTriggerExample : MonoBehaviour
{
    public PostProcessVolume volume;
    private ChromaticAberration chromaticAberration;

    void Start()
    {
        chromaticAberration = volume.profile.GetSetting<ChromaticAberration>();
    }

    public void TriggerGlitch()
    {
        StartCoroutine(GlitchCoroutine());
    }

    private System.Collections.IEnumerator GlitchCoroutine()
    {
        chromaticAberration.enabled.Override(true);
        yield return new WaitForSeconds(0.5f);
        chromaticAberration.enabled.Override(false);
    }
}

Getting Started

  1. Install the Unity post-processing stack from the Package Manager.
  2. Clone or download the KinoGlitch repository from GitHub.
  3. Import the KinoGlitch scripts into your Unity project.
  4. Add a Post-Processing Volume component to your camera or a separate GameObject.
  5. Create a new Post-Processing Profile and assign it to the volume.
  6. Add the desired glitch effect (e.g., AnalogGlitch, DigitalGlitch) to the profile.
  7. Adjust the effect parameters in the inspector to achieve the desired look.
  8. Use the code examples above to control the glitch effects programmatically if needed.

Competitor Comparisons

Post Processing Stack

Pros of PostProcessing

  • More comprehensive and feature-rich post-processing solution
  • Official Unity package with regular updates and support
  • Integrates well with Unity's built-in rendering pipeline

Cons of PostProcessing

  • Heavier performance impact due to more extensive features
  • Steeper learning curve for beginners
  • May require more setup and configuration

Code Comparison

KinoGlitch (Analog Glitch effect):

float u = _ScanLineJitter * Random.value;
float v = _VerticalJump * Random.value;
float y = frac(uv.y + v);
float x = frac(uv.x + u * y);
return float2(x, y);

PostProcessing (Chromatic Aberration effect):

float2 coords = uv - center;
float2 end = center + normalize(coords) * _MaxCoC;
float2 delta = end - uv;
float3 col = 0.0;
int samples = clamp(int(length(delta) * SAMPLES), 3, SAMPLES);

Summary

PostProcessing offers a more comprehensive solution with official support, while KinoGlitch focuses on specific glitch effects. PostProcessing may have a higher performance cost and learning curve, but provides a wider range of features. KinoGlitch is simpler and more specialized for glitch effects.

4,049

A generic post-processing injector for games and video software.

Pros of ReShade

  • More versatile, supporting a wide range of games and applications
  • Extensive library of effects and shaders
  • Active community with frequent updates and contributions

Cons of ReShade

  • More complex setup and configuration process
  • Potential performance impact on lower-end systems
  • May not be compatible with all games or graphics APIs

Code Comparison

KinoGlitch (Unity shader):

fixed4 frag(v2f_img i) : SV_Target
{
    fixed4 color = tex2D(_MainTex, i.uv);
    color.rgb = lerp(color.rgb, _GlitchColor.rgb, _GlitchIntensity);
    return color;
}

ReShade (HLSL shader):

float4 PS_Main(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float4 color = tex2D(ReShade::BackBuffer, texcoord);
    color.rgb = lerp(color.rgb, GlitchColor.rgb, GlitchIntensity);
    return color;
}

Both examples show a simple glitch effect, blending the original color with a glitch color based on intensity. ReShade's implementation is more flexible, allowing for use across various games and applications, while KinoGlitch is specifically designed for Unity projects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

KinoGlitch

KinoGlitch is a collection of glitch video effects. At the moment, it provides two types of glitch effects.

  • Analog Glitch: scan line jitter, color drift, vertical jump, horizontal shake.

anim1 anim2

  • Digital glitch: block damage.

anim3

License

Copyright (C) 2015 Keijiro Takahashi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.