I implemented another method that adapts to the screen resolution AND consumes only ~ 150 KB of videomemory by still looking the same as OrangeBrat did it. Have fun!

Here is the link: I am the link! Hell yeah!

From the readme:

--------------------------------------------------------------------
Low memory consumptioning realtime filmgrain
Created by: Christian Behrenberg - 2006-09-02
--------------------------------------------------------------------

Instead of circulate some big sized bitmaps for a realtime filmgrain, I use the natural property of grain: it is tileable. I took a filmgrain sample picture and converted it into a 512x512 DDS texture to save memory. It is only 129 KB big!

The method to emulate the previous method is to shift repeatingly the UV parameters of the skin in random matter. No one will see that you are just shifting the texture and badabing! you have a well done filmgrain effect. To achieve this, I use a screenentity for this. It is a 2 polygonal plane with the typical 4:3 ratio. So, nothing big in here. Additionally, I randomize each cycle the alpha value in a certain range.

With this package I provide 2 MDLs. The MDLs contain already the DDS texture, if you wish to link them to the external files, I added them also. I included two different grainstyles: the first one is the default black and white one, the second is a sepia version whereas I adapted the color of the grain to the typically sepia color. You can easily decide what you want by commenting in/out the corresponding line in the WDL.

To implement the grain just copy the code into your project or include the WDL. To start the refreshing function, just call HUD_grainRefresh(); once.. in your main loop, in your HUD initialization or whatever. You can easily change the variables to create your personal grain-style.

NOTE:

The disadvantage that it is a screenentity is, that it changes size when you change the camera.arc. So you may should write additional lines to compensate that side effect. Just modify dynamically the .x property of the HUD_grain entity.

Have fun and finish that AAA title

THIS CODE AND ITS CONTENTS ARE FREEWARE
if you like to write any thanks into your credits, feel free to send me a note so that I can play your game seeing my grain (what a rhyme!) in action

Greetings
Christian Behrenberg

Last edited by HeelX; 09/02/06 11:32.