{"_id":"glsl-film-grain","_rev":"10-97e0794de36e796a0415413f9faf01d5","name":"glsl-film-grain","description":"natural looking film grain using noise functions","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"glsl-film-grain","version":"1.0.0","description":"natural looking film grain using noise functions","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"glsl-noise":"0.0.0"},"devDependencies":{"a-big-triangle":"^1.0.0","dom-css":"^1.0.6","domready":"^1.0.7","gl-texture2d":"^2.0.8","glsl-blend-soft-light":"^1.0.4","glsl-luma":"^1.0.1","glslify":"^1.6.0","lena":"^1.0.0","raf-loop":"^1.0.1","webgl-context":"^2.1.1","wzrd":"^1.2.1","xtend":"^4.0.0"},"scripts":{"start":"wzrd demo.js:bundle.js -- -d -t glslify"},"keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"homepage":"https://github.com/mattdesl/glsl-film-grain","bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"gitHead":"c2d32c6ef8be6b186bac7aa1298c8d8658909212","_id":"glsl-film-grain@1.0.0","_shasum":"bddec2b71f3f08cb401139d4ffd29b4a5aefb96d","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"dist":{"shasum":"bddec2b71f3f08cb401139d4ffd29b4a5aefb96d","tarball":"https://registry.npmjs.org/glsl-film-grain/-/glsl-film-grain-1.0.0.tgz","integrity":"sha512-9YgM43L0uza3Jqxmr3ibtK8sDZm3TrwewWJEbwUvSSCRTTyhIVG6rlQVIfLHqhmg1K8L2gKymSKHPJxl6D/3/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICHV+3CaCEc/K/vxVIemoN5Sc0zVmQ88oJbRMmYmrraMAiBzKk/BQJlCPWI5WkykB/EtaHDe3zQgRHY5RowFOttX0w=="}]}},"1.0.1":{"name":"glsl-film-grain","version":"1.0.1","description":"natural looking film grain using noise functions","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"glsl-noise":"0.0.0"},"devDependencies":{"a-big-triangle":"^1.0.0","browserify":"^8.1.1","dom-css":"^1.0.6","domready":"^1.0.7","gl-texture2d":"^2.0.8","glsl-blend-soft-light":"^1.0.4","glsl-luma":"^1.0.1","glslify":"^1.6.0","lena":"^1.0.0","raf-loop":"^1.0.1","uglify-js":"^2.4.16","webgl-context":"^2.1.1","wzrd":"^1.2.1","xtend":"^4.0.0"},"scripts":{"bundle":"browserify demo.js -t glslify | uglifyjs -cm > bundle.js","start":"wzrd demo.js:bundle.js -- -d -t glslify"},"keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"homepage":"https://github.com/mattdesl/glsl-film-grain","bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"gitHead":"ec6bde4b899104cf25372d54d2c191614a8fad3b","_id":"glsl-film-grain@1.0.1","_shasum":"2a59271233ae0536b6d9c2db8b503edd273583b9","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"dist":{"shasum":"2a59271233ae0536b6d9c2db8b503edd273583b9","tarball":"https://registry.npmjs.org/glsl-film-grain/-/glsl-film-grain-1.0.1.tgz","integrity":"sha512-8zPjeDX6G/SVdkFDiSKWcZkl5wNiQ17swcGbFVexIA5BheFyzNVDtWAAe97SePwMy34SltXGMOynvw28LsDlcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICNcUAP9PG6zS2IQx3CQ2LembquEP+Il07sYh2/EViVfAiEArDZGf1pcH3tKMw6dlt33rr9qXkpuR/pb+/OSnYcTtoY="}]}},"1.0.2":{"name":"glsl-film-grain","version":"1.0.2","description":"natural looking film grain using noise functions","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"glsl-noise":"0.0.0"},"devDependencies":{"a-big-triangle":"^1.0.0","browserify":"^8.1.1","dom-css":"^1.0.6","domready":"^1.0.7","gl-texture2d":"^2.0.8","glsl-blend-soft-light":"^1.0.4","glsl-luma":"^1.0.1","glslify":"^1.6.0","lena":"^1.0.0","raf-loop":"^1.0.1","uglify-js":"^2.4.16","webgl-context":"^2.1.1","wzrd":"^1.2.1","xtend":"^4.0.0"},"scripts":{"bundle":"browserify demo.js -t glslify | uglifyjs -cm > bundle.js","start":"wzrd demo.js:bundle.js -- -d -t glslify"},"keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"homepage":"https://github.com/mattdesl/glsl-film-grain","bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"gitHead":"4a2c8424976c998078eba2404250df1d2e57453f","_id":"glsl-film-grain@1.0.2","_shasum":"51665fba922332fc2aa7b72871d5a2ad8bb2517f","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"dist":{"shasum":"51665fba922332fc2aa7b72871d5a2ad8bb2517f","tarball":"https://registry.npmjs.org/glsl-film-grain/-/glsl-film-grain-1.0.2.tgz","integrity":"sha512-DxCC3/BYN6FjWbB2aVdVAAyesaCrcbdVs8LY6ycZZpwjhO95fHxdVF2kREKbqELcchbztATHKth64uf1pncsWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5JEZG0QnpBuUf9u1x5PBGKKMqhioJxrufp+fQPDQXbQIgfNZPnuQWcbhVgvgyTxyGqgf+IRssXvZF9SoerbLeLG8="}]}},"1.0.3":{"name":"glsl-film-grain","version":"1.0.3","description":"natural looking film grain using noise functions","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"glsl-noise":"0.0.0"},"devDependencies":{"a-big-triangle":"^1.0.0","browserify":"^8.1.1","dom-css":"^1.0.6","domready":"^1.0.7","gl-texture2d":"^2.0.8","glsl-blend-soft-light":"^1.0.4","glsl-luma":"^1.0.1","glslify":"^1.6.0","lena":"^1.0.0","raf-loop":"^1.0.1","uglify-js":"^2.4.16","webgl-context":"^2.1.1","wzrd":"^1.2.1","xtend":"^4.0.0"},"scripts":{"bundle":"browserify demo.js -t glslify | uglifyjs -cm > bundle.js","start":"wzrd demo.js:bundle.js -- -d -t glslify"},"keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"homepage":"https://github.com/mattdesl/glsl-film-grain","bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"gitHead":"c24cb40dfb3d2c24ce3be524a5dc46a120348871","_id":"glsl-film-grain@1.0.3","_shasum":"f620ade99f9870ba50012f86bb9a22a0dce56a99","_from":".","_npmVersion":"2.14.12","_nodeVersion":"5.0.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"f620ade99f9870ba50012f86bb9a22a0dce56a99","tarball":"https://registry.npmjs.org/glsl-film-grain/-/glsl-film-grain-1.0.3.tgz","integrity":"sha512-UGLNHZuCLcPnF64LokOdo83TNg5FU2bDXGvSjjrRXkFB8DKKSMLhMqzx/YPv0czfnLOz7FKWMTHaRvyD9DY4nQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHPwSoBgZWUcVYDELTYsQh0zttHbYFXG01q78HbrJuDwAiBftl1v1au5n6s0kersGrQpCt0ZK7TFo7d09SQX9yt4iQ=="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/glsl-film-grain-1.0.3.tgz_1457733188109_0.3166627115570009"}},"1.0.4":{"name":"glsl-film-grain","version":"1.0.4","description":"natural looking film grain using noise functions","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"glsl-noise":"0.0.0"},"devDependencies":{"a-big-triangle":"^1.0.0","browserify":"^8.1.1","dom-css":"^1.0.6","domready":"^1.0.7","gl-texture2d":"^2.0.8","glsl-blend-soft-light":"^1.0.4","glsl-luma":"^1.0.1","glslify":"^1.6.0","lena":"^1.0.0","raf-loop":"^1.0.1","uglify-js":"^2.4.16","webgl-context":"^2.1.1","wzrd":"^1.2.1","xtend":"^4.0.0"},"scripts":{"bundle":"browserify demo.js -t glslify | uglifyjs -cm > bundle.js","start":"wzrd demo.js:bundle.js -- -d -t glslify"},"keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"homepage":"https://github.com/mattdesl/glsl-film-grain","bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"gitHead":"4eea024331c65ba82a40cc3741f327eed517f636","_id":"glsl-film-grain@1.0.4","_shasum":"66a9a98f3fda72d295ed1049e61c5a0b42a3fb9e","_from":".","_npmVersion":"2.14.12","_nodeVersion":"5.0.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"66a9a98f3fda72d295ed1049e61c5a0b42a3fb9e","tarball":"https://registry.npmjs.org/glsl-film-grain/-/glsl-film-grain-1.0.4.tgz","integrity":"sha512-LQf7un13hr0g+apnLo7G50hGfzbAd+Hpiv5nWJlh8CUl7r+UuIaFAJ4wUthsXSGfVdn+QLldY4KUoJyrLEOJAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICrs+JRyZy95Wgwk+Hs9U/1tZn/vECRexkIfNIqfcLnoAiACrVVrDFBmlB7c4bHB7QMpXZoNlGXXaMx8xf+sDhYnRw=="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/glsl-film-grain-1.0.4.tgz_1457734783676_0.7977385986596346"}}},"readme":"# glsl-film-grain\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n![img](http://i.imgur.com/uXUivnH.png)\n\n[(click for demo)](http://mattdesl.github.io/glsl-film-grain)\n\nNatural looking film grain using 3D noise functions. Inspired by [Martins Upitis](http://devlog-martinsh.blogspot.ca/2013/05/image-imperfections-and-film-grain-post.html). \n\nThis is a fairly expensive technique to achieve film grain, but it looks more realistic than a [hash function](https://www.npmjs.com/package/glsl-random) and also produces better motion.\n\nSimplest example:\n\n```glsl\n#pragma glslify: grain = require(glsl-film-grain)\n\nvoid main() {\n    float grainSize = 2.0;\n    float g = grain(texCoord, resolution / grainSize);\n    vec3 color = vec3(g);\n    gl_FragColor = vec4(color, 1.0);\n}\n```\n\nResults in:\n\n![grain](http://i.imgur.com/OEBZs8B.png)\n\n\nSee [blending tips](#blending-tips) and the [demo source](demo.js) for details.\n\n## Usage\n\n[![NPM](https://nodei.co/npm/glsl-film-grain.png)](https://www.npmjs.com/package/glsl-film-grain)\n\n#### `f = grain(texCoord, resolution[, frame[, q]])`\n\nReturns a float for the monochromatic grain with the given options:\n\n- `texCoord` the UV coordinates of your scene\n- `resolution` the resolution of your scene in pixels, optionally scaled to adjust the grain size\n- `frame` the animation frame, which is an offset into the Z of the 3D noise\n- `q` is a coefficient for the offset calculation, and may evoke subtly different motion. Defaults to 2.5\n\n## blending tips\n\nThere are a lot of ways to blend the noise onto the 3D scene or image. The solution used in the demo uses [glsl-blend-soft-light](https://www.npmjs.com/package/glsl-blend-soft-light) and [glsl-luma](https://www.npmjs.com/package/glsl-luma).\n\n```glsl\n    vec3 g = vec3(grain(texCoord, p));\n  \n    //blend the noise over the background, \n    //i.e. overlay, soft light, additive\n    vec3 color = blend(backgroundColor, g);\n    \n    //get the luminance of the background\n    float luminance = luma(backgroundColor);\n    \n    //reduce the noise based on some \n    //threshold of the background luminance\n    float response = smoothstep(0.05, 0.5, luminance);\n    color = mix(color, backgroundColor, pow(response, 2.0));\n    \n    //final color\n    gl_FragColor = vec4(color, 1.0);\n```\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/glsl-film-grain/blob/master/LICENSE.md) for details.\n","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2022-06-18T13:00:43.944Z","created":"2015-01-26T13:44:05.871Z","1.0.0":"2015-01-26T13:44:05.871Z","1.0.1":"2015-01-26T13:52:57.280Z","1.0.2":"2015-01-26T13:58:57.858Z","1.0.3":"2016-03-11T21:53:10.428Z","1.0.4":"2016-03-11T22:19:45.866Z"},"homepage":"https://github.com/mattdesl/glsl-film-grain","keywords":["noise","film","grain","lens","imperfections","ecosystem:stackgl","stackgl","webgl","glsl","glslify"],"repository":{"type":"git","url":"git://github.com/mattdesl/glsl-film-grain.git"},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"bugs":{"url":"https://github.com/mattdesl/glsl-film-grain/issues"},"license":"MIT","readmeFilename":"README.md"}