View Full Version : ChickenDream: realistic film grain generator
cretindesalpes
11th April 2022, 17:44
I wrote a plug-in for realistic film-grain rendering:
>>> chickendream-r2.zip <<< (https://ldesoras.fr/src/vs/chickendream-r2.zip)
https://i.postimg.cc/FKR88BrT/grain.png
Original | mild grain | excessively huge grain
The plug-in supports Vapoursynth and Avisynth+.
Beware, the processing is extremely slow, a few seconds for a single FHD frame (with multi-threading). I know there is another plug-in (https://github.com/AmusementClub/vs-fgrain-cuda) implementing the same grain model with CUDA support, but I haven’t tested it.
There is also a Git repository (https://gitlab.com/EleonoreMizo/chickendream/).
Selur
12th April 2022, 15:48
I know there is another plug-in implementing the same grain model with CUDA support, but I haven’t tested it.
Did a small test with the cuda version from WolframRhodium:
Y, U, V = core.std.SplitPlanes(clip)
Y = core.resize.Bicubic(clip=Y, format=vs.GRAYS)
Y = core.fgrain_cuda.Add(Y)
Y = core.resize.Bicubic(clip=Y, format=vs.GRAY8)
clip = core.std.ShufflePlanes(clips=[Y, U, V], planes=[0, 0, 0], colorfamily=vs.YUV)
works fine.
A FHD clip runs at 1.18fps on my Geforce GTX 1070ti, so not really fast either, but better than 'a few seconds for a single FHD frame' ;)
Cu Selur
cretindesalpes
2nd June 2022, 13:49
ChickenDream r2 (https://forum.doom9.org/showthread.php?p=1967244#post1967244):
Allowed larger grain radius when using large standard deviation values.
Added a draft parameter.
Changed the configure options to compile with Clang.
Fixed a crash when the picture width is not a multiple of 8 (thanks to MonoS for the report).
Couleur
4th June 2022, 10:00
Hey, I'm no grain expert (even though I love how it looks), what makes the process so slow and do you have any comparisons to much faster grain effects like the one you have on NLEs?
cretindesalpes
4th June 2022, 13:35
Hey, I'm no grain expert (even though I love how it looks), what makes the process so slow and do you have any comparisons to much faster grain effects like the one you have on NLEs?
It is slow because it emulates what the film looks like at a microscopic level. So in the end, after billions of individual grains have been generated, the picture is downsampled at its final size. Note that the draft mode introduced in r2 is much faster (like 500×) for small grains because it shortcuts the grain generation and downsampling to keep only the quantitative grain distribution (basically a Poisson process depending on the luminance). Obviously this works only for grain size << pixel size, and the result is a bit softer because it removes a whole layer of specific randomness.
I cannot comment the qualitative comparison with other grain effects; I’m not an expert in grain and usually I spend my efforts into removing it from video clips. I just wanted to write a realistic grain generator and for this I implemented the most advanced models and algorithms I could find on the topic:
Alasdair Newson, Julie Delon, Bruno Galerne, A Stochastic Film Grain Model for Resolution-Independent Rendering (https://hal.archives-ouvertes.fr/hal-01520260), Computer Graphics Forum, Wiley, 2017
Alasdair Newson, Noura Faraj, Julie Delon, Bruno Galerne, Realistic Film Grain Rendering (https://www.ipol.im/pub/art/2017/192), Image Processing On Line 7, 2017, pp. 165–183
kolak
10th July 2022, 11:03
Way better solution are real film grain scans.
Never seen a "nice" synthetic grain.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.