Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Calin Leafshade on Sun 30/08/2009 14:32:41

Title: Film Noise
Post by: Calin Leafshade on Sun 30/08/2009 14:32:41
Does anyone know of a decent way to create film noise over your room?

the only way i can think of doing it is using a sprite overlay with an 8 bit alpha channel but to get convincing noise you would need at least 20fps and im not sure if the engine could handle 20 full size sprites a second.

plus not all my rooms are exactly the same size.. and i only want the actual room to have the noise.. not the whole viewport.

any ideas?
Title: Re: Film Noise
Post by: Akatosh on Sun 30/08/2009 14:38:09
A cheap way would be a screen-sized half-transparent unclickable animated GUI. I'm not sure what this would do to the frame rate, but it'd certainly be easier on the engine than a giant sprite overlay.

Additionally, if you set the z-Order correctly, you can get the film noise to be displayed BEHIND other GUIs. That could go a long way in getting the effect you're after.
Title: Re: Film Noise
Post by: Calin Leafshade on Sun 30/08/2009 14:44:29
i havent really looked at guis yet.

how do you animate one? isnt that just the same as wacking a sprite over the top.. except now you have a gui too?
Title: Re: Film Noise
Post by: GarageGothic on Sun 30/08/2009 14:46:18
Yup, Akatosh's suggested method is exactly how I do it, and it looks great. I'm not even using alpha channels, just a 50% transparency - even if white scratches and black hairs would in reality be non-transparent, I find that it disturbs the image a bit too much during normal gameplay.

I'm currently using only 5 frames of noise but was considering making it a bit less repetitive by displaying dust, hairs and scratches on GUI buttons at randomized positions.

As for animating it, simply set up a timer in repeatedly_execute_always and change the background frame on the GUI every time it expires.
Title: Re: Film Noise
Post by: Akatosh on Sun 30/08/2009 14:47:15
Well, I don't know if GUIs can be "animated" as such, but you can certainly keep manipulating their background graphic via repeatedly_execute_always.

It IS basically just whacking a sprite over the top, but with reduced hassle.

/EDIT: Effing ninjas.
Title: Re: Film Noise
Post by: Calin Leafshade on Sun 30/08/2009 15:15:52
yes that does look very cool.

and no frame rate hit as far as i can tell.
Title: Re: Film Noise
Post by: Vince Twelve on Sun 30/08/2009 19:10:14
I did this same thing in Linus Bruckman.  The top half of the screen had a film grain effect and the bottom half has an analog TV effect.

I used a GUI and animated it just as every one else suggests.  For the film grain, if I remember correctly, I had six frames.  Then, I also had a vertical line that would move and dance around the screen randomly, and a couple different hairs and scratches that would appear at random places for random amounts of time.

I think it wound up looking rather nice.  You can download the game for a look (see sig).

(I did find that it impacted the frame rate on some slower computers, though.  So I included the option to turn it off.)
Title: Re: Film Noise
Post by: Gord10 on Tue 08/09/2009 05:51:04
Let me explain my own method:

I have got a dozen of pre-made noise sprites that constitutes the noise animation view.   http://coolbluefiles.net/noise2.png is one of those.


noise.Transparency=92;
noise.SetView(Noiseview);
noise.Animate(0, Noiseview, eRepeat, eNoBlock, eForwards);

is the code that's put in function room_Load() of the room. The appropriate transparency value changes according to the room itself, it needs to be obtained seperately. (I use a debug script that changes the object transparency according on the keys pressed, then it's easier to obtain the appropriate value.)