- Home /
Camera Static Effect
I want to make like a noise/static effect on screen simulating like you would be watching through a video camera. How would one be able to achieve these kind of effects with Unity Free?
For a question like this one, a screen shot would be very helpful. Better yet, a pointer to a video (and time within the video), that shows what you are looking for. To me "static Effect' can mean several things. You care limited in what you can do in Free, but there a couple of things that may get you what you want.
Here is a video Part 0:56 you can see the noise effect.
Answer by robertbu · Oct 29, 2013 at 09:18 PM
The most efficient method would be with a custom shader. The second most efficient method is likely to be a set of images animated on plane or a GUITexture in front of the camera. You will find code here to animate a set of images.
http://wiki.unity3d.com/index.php?title=Texture_swap_animator
A less efficient method is to dynamically calculate changes in a texture:
Create a Quad (Game Object > Create Other > Quad).
Move the Quad directly in front of the camera just in front of the camera and just in front of the near clip plane of the camera
Make the Quad a child of the camera
Create a material using the Unlit/Transparent shader and apply it to the Quad (no need for a texture)
Add the script below to the Quad.
pragma strict
var lineFrequency = 5; var updateFrequency = 5.0;
private var tex : Texture2D; private var pixels : Color32[]; private var mat : Material;
function Start () { mat = renderer.material; tex = new Texture2D(255, 255); var c32 = Color32(0, 0, 0, 0); pixels = tex.GetPixels32(); for (var i = 0; i < pixels.Length; i++) { pixels[i] = c32; } tex.SetPixels32(pixels); tex.Apply(); mat.mainTexture = tex;
InvokeRepeating("UpdateStatic", 0.0, 1.0/updateFrequency); } function UpdateStatic() { for (var i = 0; i < pixels.Length; i++) { if ((((i / tex.width ) % lineFrequency) == 0 )) pixels[i].a = Random.Range(85, 101.0); else pixels[i].a = Random.Range(0, 25); } tex.SetPixels32(pixels); tex.Apply(); mat.mainTexture = tex; }
There are a number of things here to play with to get the effect the way you want:
The size of the texture and the line frequency will effect the softness/hardness of the lines...and will also have an impact on efficiency.
The Random.Range() calls determines the look of the static for both lines and non-line areas.
'updateFrequency determines the rate at which the static refreshes.
Answer by Tanshaydar · Oct 29, 2013 at 06:13 PM
In here, this person explains how to create a Slender game in detail using Unity Free version. http://www.youtube.com/watch?v=JXDBNNE4aFY
He speaks in Portuguese but it's pretty much clear how he does that, so here you go.
Your answer
Follow this Question
Related Questions
GUI click through? 3 Answers
Disable script on 2. object by boolean from 1. object. 0 Answers
Select text in multiple text areas simultaneously 2 Answers