{"bugs":{"url":"https://github.com/hughsk/glsl-fog/issues"},"dist":{"shasum":"e104daba4343c74ea94038a41b3dd971d57372ee","tarball":"https://registry.npmjs.org/glsl-fog/-/glsl-fog-0.0.1.tgz","integrity":"sha512-iWsoojWRORUxvj5YiutFKchrWbSAumU/uMHB+6ub6f85OJ5KzNtebVhUJMMBhZ/d3P0mEWvGkLI69IALtxDURg==","signatures":[{"sig":"MEUCIQDUCAJeieMJPtlLtX48yqKS6nadX7yLd+hFyaaipIRuBgIgM5J2qCos/LuMmIeG3g5zPZoYKYWO2bwrVHO++gghBcE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"exp2.glsl","name":"glsl-fog","_from":".","author":{"url":"http://github.com/hughsk","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"readme":"# glsl-fog [![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nBasic fog functions for GLSL, generic but intended for use with\n[glslify](http://github.com/chrisdickinson/glslify).\n\n## Usage ##\n\n[![glsl-fog](https://nodei.co/npm/glsl-fog.png?mini=true)](https://nodei.co/npm/glsl-fog)\n\nHere's a hypothetical example of linear fog calculated in a vertex shader:\n\n``` glsl\n#define FOG_START 100\n#define FOG_END 500\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nattribute vec3 position;\nvarying float fogAmount;\n\n#pragma glslify: fog_linear = require(glsl-fog/linear)\n\nvoid main() {\n  gl_Position = projection * view * model * vec4(positon, 1.0);\n  float fogDistance = length(gl_Position.xyz);\n  fogAmount = fog_linear(fogDistance, FOG_START, FOG_END);\n}\n```\n\nAnd another (separate) example using exp/exp2 per-pixel fog:\n\n``` glsl\n#define FOG_DENSITY 0.05\n\nvarying vec4 vertexColor;\n\n// Take your pick: these should be usable interchangeably.\n#pragma glslify: fog_exp2 = require(glsl-fog/exp2)\n#pragma glslify: fog_exp = require(glsl-fog/exp)\n\nvoid main() {\n  float fogDistance = gl_FragCoord.z / gl_FragCoord.w;\n  float fogAmount = fog_exp2(fogDistance, FOG_DENSITY);\n  const float fogColor = vec4(1.0); // white\n\n  gl_FragColor = mix(vertexColor, fogColor, fogAmount);\n}\n```\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/glsl-fog/blob/master/LICENSE.md) for details.\n","browser":"exp2.glsl","license":"MIT","scripts":{},"_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"keywords":["glsl","fog","function","distance","draw","fade","exp2"],"repository":{"url":"git://github.com/hughsk/glsl-fog","type":"git"},"_npmVersion":"1.3.11","description":"Basic fog functions for GLSL: linear, exp and exp2","maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dependencies":{},"readmeFilename":"README.md","devDependencies":{},"_id":"glsl-fog@0.0.1","version":"0.0.1"}