View Full Version : Film Grain Pixel Shader
XeoneR
11th November 2013, 00:32
Does such shader exist?
mpc-hc, mad or haali, lav
JanWillem32
11th November 2013, 00:58
effect\semi-random grayscale noise.txt
http://forum.doom9.org/showthread.php?t=157634
leeperry
11th November 2013, 01:21
Oh, very nice :)
Do you think that something like GrainFactory3() (http://avisynth.nl/index.php/GrainFactory3) would be doable using a PS script? Basically the ability to choose the size and strength of the added cinema grain depending on the brightness of a pixel, It's a really really great toy...too bad it's quite a CPU hog and works in 8bit only :o
Adding grain also does wonders for hardcore deblocking IME.
JanWillem32
11th November 2013, 02:30
You can experiment with projector film dust, projector film drive scratches, semi-random colored surface noise and semi-random grayscale noise. None of these are heavy filters. I can write variants on request.
leeperry
11th November 2013, 03:10
Well, the truly amazing thing in GrainFactory3() is that you can create grain-based EE and once you find the right strenght/grain size values for dark/mid/bright pixels it really start looking impressive as the grain isn't random whatsoever and when using reasonable values it gives an "analog" look to digital displays that's a real treat to look at :)
JanWillem32
12th November 2013, 05:33
What I could find out about GrainFactory3 was: "noise generator that tries to simulate the behaviour of silver grain on film".
I already wrote some basic noise effect shaders, but maybe I could get closer to the look of silver grain on film.
When I start coding to create an effect, I start with looking at examples on images. I don't just duplicate/imitate other filters. When I've gathered enough research materials, I just start writing out possible parameters for methods in an effect. After that, I try a few methods. These are just calculations that spring to mind, and I usually copy a lot of previously written methods, too. After a bit of tinkering, I usually get the desirable effect from a shader. When transforming the prototype shader to a final type, I optimize first, and add comments. After that, I extract the set of constants, give them names and offer them as user-configurable parameters.
The reason I'm telling this is simple; I can practically guarantee that once I've finished something that resembles silver grain on film, the effect will not have a grand total 19 user input variables like GrainFactory3.
On the other hand, I don't see any options in GrainFactory3 for using color. I would probably add an option or options for this type of filter related to color, for example; to use the properties for sepia toning instead of silver. (This possibly requires separate filters, though.)
To start off simple, the pictures I could find of real film used in cinemas varied strongly over the decades. The most evident changes were the transition from grayscale or toned video to color. The form and amount of grain on film, and the cinema equipment varied, too. Some effects are available: projector film drive scratches, projector film dust, projector film lamp vignette, projector film sepia toning for SD&HD video input, grayscale, projector film shaking, semi-random colored surface noise and semi-random grayscale noise.
What era are you targeting for this kind of vintage look? Which effects are currently missing to complete the illusion of such a look? Please specify with some true vintage cinematic examples and name some very specific factors.
I agree that this is probably better off in the other thread: http://forum.doom9.org/showthread.php?t=157634
XeoneR
12th November 2013, 23:02
effect\semi-random grayscale noise.txtAwesome dither. Thank you! GrainFactory is interesting too.
I usually degrain bd sources before encoding with degrainmedian.
It saves about half of the precious bitrate. They don't remove grain these days.
But for best playback experience proper dithering is essential of course.
*
toniash
20th November 2013, 11:43
What I could find out about GrainFactory3 was: "noise generator that tries to simulate the behaviour of silver grain on film".
Are you working on it?
TheElix
21st November 2013, 08:15
It is interesting that, while some people strive to get rid of grain in their sources, others try to add it. :)
vood007
21st November 2013, 10:05
Yes because there is a huge difference if you want to compress and store content or just watch it...
burfadel
21st November 2013, 13:08
Also a lot of noise is often too heavy, not fine enough, or not dynamic enough. Adding grain on viewing is massively more efficient than adding grain before compressing. If adding before compressing it increases the file size (or reduces quality at a given size) and the quality of the grain is lowered. Remember the stuff people are trying to remove grain from are digitally compressed, meaning the grain has already been compressed.
The quality of the picture can be perceptibly better when adding grain on viewing, as long as, like I said before, the grain is fine, dynamic (random) enough, is of a very low setting, and is luminance noise only (adding color noise doesn't increase picture quality, it tends to reduce it). Also the noise should be the last filter in the chain, so you don't run sharpening, resize, and whatever other filters over the noise you added.
leeperry
21st November 2013, 14:48
^ +1, reason why a PS script applied after scaling could be a lot of fun, provided that it would offer enough variables to finetune it as much as possible.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.