How to do a camera static effect?

For the horror game I’m making, I’m going to have an open-world-ish level format, but there will be barriers throughout the levels so that the player doesn’t overlook things and get lost. But instead of just having an invisible wall, which would be very awkward, I was thinking of making it so that the player can go past the barrier, but as they get further away, the screen gets more and more staticy, until after a certain distance they can’t see anything but static and the player dies from angry spirits. The only problem is that I can’t seem to find any tutorials on how to get this effect. How would I go about doing this, and without crippling performance or having low visual quality (because I want this game to look like it was professionally made and be so visually stunning that it will make the weak cry :smiling_imp: ).

And something a little off topic, but can someone explain to me why my PC seems bipolar to me? Yesterday it would take 20 minutes to render a 30 minute video at TV resolution, but today it’s taking 5 minutes. It still has that heating issue, in fact it got worse after I put it in a free case my school gave me. So I’m confused… .Wlafrnbakej WAAAA! What am I doing? If I question it my PC will just be slow again. But still, someone please explain.

And something WAAAAAY off topic, but are any of you familiar with the anime Nichijou? I started watching it last week and I’m almost done (at episode 19 so don’t spoil anything!) and I’m not ready to say goodbye, so have any of you guys heard of ANYTHING at all about the anime continuing? I know that the last manga was published 6 days ago so…
I NEED MORE NICHIJOU!!! pleeeeeze… :confounded:

Sorry about that, please answer the first question first then do the other two if you can. I’m probably breaking sooooo many forum rules right now.

Well I guess it needs to be a post processor filter, try having a look at Old Film Effect filter

The grainy bit, if that has an intensity you can edit it could work, not sure if it’ll look like what you want.

What are you rendering in?

Generate a couple noise textures and cycle through them. Use your intensity as some threshold.

It looks like what I want, but there has been a report saying that you can’t change the settings without creating a new object. That may have been fixed, we’ll see. But this has also pointed me to the Shaderblow plugin, which I might make use of. Also, I’m not exactly sure what you mean by “What are you rendering in?”

I thought about that, and I ruled that method out because that would require having me having to create a set of noise textures for each level of intensity (unless there is some magical thing I don’t know about). I’ll give the Old Film Effect a try first.

Well, for the effect you want you are going to end up customizing a shader… no way around it. And then it’s pretty easy to just set alpha of the individual pixels based on a threshold related to your intensity.

I was afraid that would be the case. I’m only a beginner in shader programming, but it won’t hurt to learn I guess. What kind of calculations would I have to script to make this effect?

Basically an if statement. If frag color component < intensity frag color alpha = 0.

Start with Unshaded and strip out the parts you don’t care about.

I actually have that Anime shader I made a while ago. I can modify that one instead, since I’d rather not use Unshaded because in my game, lighting is going to be everything. Okay, not EVERYTHING, but a great deal of the visuals are going to come from the lighting. That brings up another issue: How do I get a point light working? My shader treats it the exact opposite as it should work. As the light gets farther away, the spot gets wider, not smaller. I’ll post up my code here in a second.

Okay, here are my scripts that I made:
My vertex shader:

attribute vec3 inPosition;
attribute vec3 inNormal;
attribute vec2 inTexCoord;

uniform mat3 g_NormalMatrix;
uniform mat4 g_WorldViewProjectionMatrix;

varying vec3 normal;
varying vec2 texCoord;

void main(){
    texCoord = inTexCoord;
    normal = inNormal;
    gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);

And my Fragment shader:

uniform vec4 g_LightPosition;
uniform vec4 g_AmbientLightColor;
uniform sampler2D m_DiffuseMap;
uniform sampler2D m_SpecularMap;

varying vec3 normal;
varying vec2 texCoord;

void main()
    vec2 newTexCoord;
    newTexCoord = texCoord;
    vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
    vec4 Diffuse = texture2D(m_DiffuseMap, newTexCoord);
    float intensity;
    float color;
    intensity = dot(, normal);
    vec4 ambicolor = g_AmbientLightColor;
    if (intensity > 0.75)
    color = 1;
    color = 0.75;
    vec3 nc;
    nc = (ambicolor.rgb + Diffuse.rgb * specularColor.rgb) * color;
    gl_FragColor = vec4(nc, 1.0);

Apparently I scrapped the version that “supported” point lights. This one officially supports Ambient and Directional light. All I need left is that point light, but I don’t know how to code it.

…but I thought this shader is just for a quad that covers the view in static. No lighting involved.

1 Like

@pspeed Actually, I was thinking about making the environment in charge of the static somehow. But I like that idea better.

Well, that’s one question down. Feel free to answer the other two if you want.

I haven’t checked that, but here’s an OpenES version of a shader which should basically do what you want: Example of using OpenGL ES shaders to simulate static TV-noise style animation. · GitHub

That looks perfect! Thanks.