- Home /
Is anyone able to get this glitch effect working?
https://github.com/staffantan/unityglitch
Here is a link i found but every time i try use it i have errors from
Assets/Glitch/GlitchEffect.cs(17,29): error CS0246: The type or namespace name `ImageEffectBase' could not be found. Are you missing a using directive or an assembly reference?
Appreciate it as i want to use this asset.
I think it has something to do with imageeffectbase not being in unity 4.3
using UnityEngine;
using UnityEditor;
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/GlitchEffect")]
public class GlitchEffect : ImageEffectBase {
public Texture2D displacementMap;
float glitchup, glitchdown, flicker,
glitchupTime = 0.05f, glitchdownTime = 0.05f, flickerTime = 0.5f;
public float intensity;
// Called by camera to apply image effect
void OnRenderImage (RenderTexture source, RenderTexture destination) {
material.SetFloat("_Intensity", intensity);
material.SetTexture("_DispTex", displacementMap);
glitchup += Time.deltaTime * intensity;
glitchdown += Time.deltaTime * intensity;
flicker += Time.deltaTime * intensity;
if(flicker > flickerTime){
material.SetFloat("filterRadius", Random.Range(-3f, 3f) * intensity);
flicker = 0;
flickerTime = Random.value;
}
if(glitchup > glitchupTime){
if(Random.value < 0.1f * intensity)
material.SetFloat("flip_up", Random.Range(0, 1f) * intensity);
else
material.SetFloat("flip_up", 0);
glitchup = 0;
glitchupTime = Random.value/10f;
}
if(glitchdown > glitchdownTime){
if(Random.value < 0.1f * intensity)
material.SetFloat("flip_down", 1-Random.Range(0, 1f) * intensity);
else
material.SetFloat("flip_down", 1);
glitchdown = 0;
glitchdownTime = Random.value/10f;
}
if(Random.value < 0.05 * intensity){
material.SetFloat("displace", Random.value * intensity);
material.SetFloat("scale", 1-Random.value * intensity);
}else
material.SetFloat("displace", 0);
Graphics.Blit (source, destination, material);
}
}
Thanks
No, the requirement to have Unity Pro was a likely reason but scratch that. Try removing "name" after namespace, that doesn't look legit
After you edited the question and cleaned it up - yes, that bit is gone now.
Answer by corriedotdev · Apr 01, 2014 at 09:53 PM
Needed to import the image effects assets first. The WHOLE package, not just the ones it required, also i saw no need for using unity engine
Your answer
Follow this Question
Related Questions
Smooth camera follow seems to be a bit choppy 1 Answer
No Glitch Please ... 1 Answer
How to change the color of a vignette? 0 Answers
Multiple Cars not working 1 Answer
Problem with Camera when building 1 Answer