<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_GrainFactory3</id>
	<title>Vapoursynth GrainFactory3 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_GrainFactory3"/>
	<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_GrainFactory3&amp;action=history"/>
	<updated>2026-11-19T05:56:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.selur.net/index.php?title=Vapoursynth_GrainFactory3&amp;diff=555&amp;oldid=prev</id>
		<title>Selur: New filter page (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_GrainFactory3&amp;diff=555&amp;oldid=prev"/>
		<updated>2026-11-16T08:50:10Z</updated>

		<summary type="html">&lt;p&gt;New filter page (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;float:right; margin:0 0 1em 1em;&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;GrainFactory3&amp;#039;&amp;#039;&amp;#039; generates film-like grain with separate strength, size and sharpness for dark, mid-tone and bright areas, blended by brightness. It was written by Didée for AviSynth and comes to Hybrid from the old havsfunc.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Filtering → Vapoursynth → Add Grain&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Vapoursynth_GrainFactory3.png|none|GrainFactory3 controls in Hybrid]]&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
Three grain layers are generated, each at a reduced or enlarged resolution given by its &amp;#039;&amp;#039;Size&amp;#039;&amp;#039; and resized back with a bicubic kernel whose sharpness comes from the &amp;#039;&amp;#039;Sharpness&amp;#039;&amp;#039; value. Luma masks with two soft transition zones decide where each layer applies. The grain is added to luma only; chroma stays untouched. Optionally the grain is averaged over time and an extra fine layer is added on top.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* A grain plugin (vs-noise on all platforms, AddGrain on Linux/macOS) and an Expr implementation; works on all platforms.&lt;br /&gt;
&lt;br /&gt;
== Settings ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Parameter !! Range / values !! Hybrid default !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| Dark: Strength / Sharpness / Size || g1str, g1shrp, g1size || 0 – 1000 / 0 – 100 / 0.5 – 4 || 7.0 / 60 / 1.5 || Grain of the dark areas.&lt;br /&gt;
|-&lt;br /&gt;
| Mid: Strength / Sharpness / Size || g2str, g2shrp, g2size || 0 – 1000 / 0 – 100 / 0.5 – 4 || 5.0 / 66 / 1.2 || Grain of the mid-tones.&lt;br /&gt;
|-&lt;br /&gt;
| Bright: Strength / Sharpness / Size || g3str, g3shrp, g3size || 0 – 1000 / 0 – 100 / 0.5 – 4 || 3.0 / 80 / 0.9 || Grain of the bright areas.&lt;br /&gt;
|-&lt;br /&gt;
| Temp average || temp_avg || 0 – 100 % || 0 || Temporal averaging of the grain; needs scene change detection.&lt;br /&gt;
|-&lt;br /&gt;
| On top grain || ontop_grain || 0 – 1000 || 0 || Strength of an extra fine grain layer.&lt;br /&gt;
|-&lt;br /&gt;
| Dark-&amp;gt;Midtone zone (Start/End) || th1, th2 || 0 – 255 || 24 / 56 || Brightness range (8-bit scale) where dark grain fades into mid-tone grain.&lt;br /&gt;
|-&lt;br /&gt;
| Midtone-&amp;gt;Bright zone (Start/End) || th3, th4 || 0 – 255 || 128 / 160 || Brightness range (8-bit scale) where mid-tone grain fades into bright grain.&lt;br /&gt;
|-&lt;br /&gt;
| Seed || seed || −1 – 1000 || −1 || 0 or higher selects a repeatable grain sequence.&lt;br /&gt;
|-&lt;br /&gt;
| Tools: expr || – || akarin, cranexpr, std || – || Expr implementation.&lt;br /&gt;
|-&lt;br /&gt;
| Tools: grain || – || noise, grain (Linux/macOS) || – || Grain plugin.&lt;br /&gt;
|-&lt;br /&gt;
| Tools: scd || – || scd, misc (Windows), std, mv || scd || Scene change detection; only with Temp average above 0.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Default settings on a 10-bit YUV 4:2:0 source (640x356):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adding grain using GrainFactory3&lt;br /&gt;
clip = addGrain.GrainFactory3(clip, tools={&amp;#039;expr&amp;#039;: &amp;#039;akarin&amp;#039;, &amp;#039;scd&amp;#039;: &amp;#039;scd&amp;#039;, &amp;#039;grain&amp;#039;: &amp;#039;noise&amp;#039;})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How Hybrid calls it ==&lt;br /&gt;
* Works on integer YUV clips.&lt;br /&gt;
* Only values that differ from the script defaults are written, plus the tools.&lt;br /&gt;
* A Sharpness value is disabled while its Size is 1.0, because the layer is then not resized.&lt;br /&gt;
* The zone thresholds are scaled by the script to the bit depth; the grain strengths are scaled by the grain plugin.&lt;br /&gt;
* Hybrid does not check the order of the zones; keep Start below End and the dark zone below the bright zone (equal Dark-&amp;gt;Midtone Start and End values cause an error).&lt;br /&gt;
* GrainFactory3 also offers the [[Vapoursynth common filter options|common options]] (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== GrainFactory3 ===&lt;br /&gt;
Didée&amp;#039;s GrainFactory3 is a classic AviSynth script for film-like grain. Its defaults give the dark areas the strongest and coarsest grain and the bright areas the weakest and finest. The VapourSynth version was part of havsfunc; current havsfunc no longer documents it, so Hybrid keeps its own copy.&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
* [https://github.com/HomeOfVapourSynthEvolution/havsfunc havsfunc]&lt;br /&gt;
* [https://github.com/wwww-wwww/vs-noise vs-noise]&lt;br /&gt;
* [https://github.com/Selur/VapoursynthScriptsInHybrid VapoursynthScriptsInHybrid] (the script collection Hybrid uses)&lt;br /&gt;
* Hybrid&amp;#039;s tooltips&lt;br /&gt;
&lt;br /&gt;
[[Category:Vapoursynth Filters]]&lt;/div&gt;</summary>
		<author><name>Selur</name></author>
	</entry>
</feed>