{"_id":"glsl-face-normal","_rev":"25-e8b7ac7e70b59de324e0ae169e15c527","name":"glsl-face-normal","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"glsl-face-normal","version":"1.0.0","keywords":["ecosystem:stackgl"],"author":{"url":"http://github.com/mattdesl","name":"Matt DesLauriers","email":"dave.des@gmail.com"},"license":"MIT","_id":"glsl-face-normal@1.0.0","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-face-normal","bugs":{"url":"https://github.com/stackgl/glsl-face-normal/issues"},"dist":{"shasum":"2cf9539d9eebaae6bcad8cccd004bd0a0a94dd1e","tarball":"https://registry.npmjs.org/glsl-face-normal/-/glsl-face-normal-1.0.0.tgz","integrity":"sha512-hB7EOsdddF9/ulbXn8hTzRybI7SkUIgCqxlsBx2eLVfC/HfpRElqvxCrXoQVnpYHdgQO6JxgbuisDM8pYnUWOg==","signatures":[{"sig":"MEUCIGWJPCimFsqoFj3cZTqXFHPlgWHHyNKpO/Xb+iiJd+UbAiEApmLgFxIhA0hA8cPFf69HqdhU5PebqwcLOxVE+ac6hSY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"2cf9539d9eebaae6bcad8cccd004bd0a0a94dd1e","gitHead":"ba59052c3785d9dfc5d4476628d88097d9acf9a1","scripts":{"build":"browserify demo/test.js -t glslify | uglifyjs -cm > demo/bundle.js","start":"budo demo/test.js:bundle.js --live -t glslify | garnish"},"_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"repository":{"url":"git://github.com/stackgl/glsl-face-normal.git","type":"git"},"_npmVersion":"2.8.2","description":"approximate face normal in the fragment shader","directories":{},"_nodeVersion":"0.10.32","dependencies":{},"devDependencies":{"budo":"^4.0.0","three":"^0.71.0","garnish":"^2.1.3","glslify":"^2.1.2","uglify-js":"^2.4.20","browserify":"^10.0.0","three-orbit-viewer":"^69.3.0"}},"1.0.1":{"name":"glsl-face-normal","version":"1.0.1","keywords":["ecosystem:stackgl","face","faces","flat","shading","stackgl","glsl","glslify","normal","normals","pixel","fragment","shader"],"author":{"url":"http://github.com/mattdesl","name":"Matt DesLauriers","email":"dave.des@gmail.com"},"license":"MIT","_id":"glsl-face-normal@1.0.1","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-face-normal","bugs":{"url":"https://github.com/stackgl/glsl-face-normal/issues"},"dist":{"shasum":"f1f61a9ec22ac21d35f5b8e28e3ec9b5850645e8","tarball":"https://registry.npmjs.org/glsl-face-normal/-/glsl-face-normal-1.0.1.tgz","integrity":"sha512-BC0kRA6ZvXP1tJz9DuTbM1ZLymkqxaAol48WS2iLb2FsG6hk37GE+2b11F4tc3jwNxTKzDY+cuzvfqMg7BAFOg==","signatures":[{"sig":"MEUCIQDH5daB7QmRzKH8R/XjR1x+fEx+4uzyS0iubFgY6rBNUwIgZpXdLk/xTgUfXJeDhAWS0OITRF/MqjOeNRtm4B9Hpcg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"f1f61a9ec22ac21d35f5b8e28e3ec9b5850645e8","gitHead":"22a3253cb2d62ff6f741226c98bef11bcf53899e","scripts":{"build":"browserify demo/test.js -t glslify | uglifyjs -cm > demo/bundle.js","start":"budo demo/test.js:bundle.js --live -t glslify | garnish"},"_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"repository":{"url":"git://github.com/stackgl/glsl-face-normal.git","type":"git"},"_npmVersion":"2.8.2","description":"approximate face normal in the fragment shader","directories":{},"_nodeVersion":"0.10.32","dependencies":{},"devDependencies":{"budo":"^4.0.0","three":"^0.71.0","garnish":"^2.1.3","glslify":"^2.1.2","uglify-js":"^2.4.20","browserify":"^10.0.0","three-orbit-viewer":"^69.3.0"}},"1.0.2":{"name":"glsl-face-normal","version":"1.0.2","keywords":["ecosystem:stackgl","face","faces","flat","shading","stackgl","glsl","glslify","normal","normals","pixel","fragment","shader"],"author":{"url":"http://github.com/mattdesl","name":"Matt DesLauriers","email":"dave.des@gmail.com"},"license":"MIT","_id":"glsl-face-normal@1.0.2","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-face-normal","bugs":{"url":"https://github.com/stackgl/glsl-face-normal/issues"},"dist":{"shasum":"7ee775d919a4f2ee92f57bb698e87cc75dbf1288","tarball":"https://registry.npmjs.org/glsl-face-normal/-/glsl-face-normal-1.0.2.tgz","integrity":"sha512-J1J3RsT/DiRkJ2SUF8eHUsHL0Vd599pL79hGwW7YUuNK9iJNvcW/KxCa9WiCJ9w/gQ6gY0gT3xWB1SC4YjH6zg==","signatures":[{"sig":"MEQCIHNwBhgSqsB3V5FJhYRhSf5nducet4hOOMuMHib7YfYHAiAY74FIl+nQsCTLswcPsrg+v2gB1vXZ5M8I6jwUEQ64LQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"7ee775d919a4f2ee92f57bb698e87cc75dbf1288","gitHead":"cc653ad2b4dc7290fb37e585c3e418a7758e98e1","scripts":{"build":"browserify demo/test.js -t glslify | uglifyjs -cm > demo/bundle.js","start":"budo demo/test.js:bundle.js --live -t glslify | garnish"},"_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"repository":{"url":"git://github.com/stackgl/glsl-face-normal.git","type":"git"},"_npmVersion":"2.8.2","description":"approximate face normal in the fragment shader","directories":{},"_nodeVersion":"0.10.32","dependencies":{},"devDependencies":{"budo":"^4.0.0","three":"^0.71.0","garnish":"^2.1.3","glslify":"^2.1.2","uglify-js":"^2.4.20","browserify":"^10.0.0","three-orbit-viewer":"^69.3.0"}}},"time":{"created":"2015-05-02T18:25:28.863Z","modified":"2024-12-29T00:46:57.509Z","1.0.0":"2015-05-02T18:25:28.863Z","1.0.1":"2015-05-02T19:57:53.769Z","1.0.2":"2015-05-04T19:45:37.912Z"},"bugs":{"url":"https://github.com/stackgl/glsl-face-normal/issues"},"author":{"url":"http://github.com/mattdesl","name":"Matt DesLauriers","email":"dave.des@gmail.com"},"license":"MIT","homepage":"https://github.com/stackgl/glsl-face-normal","keywords":["ecosystem:stackgl","face","faces","flat","shading","stackgl","glsl","glslify","normal","normals","pixel","fragment","shader"],"repository":{"url":"git://github.com/stackgl/glsl-face-normal.git","type":"git"},"description":"approximate face normal in the fragment shader","maintainers":[{"email":"hughskennedy@gmail.com","name":"hughsk"},{"email":"mikolalysenko@gmail.com","name":"mikolalysenko"},{"email":"dave.des@gmail.com","name":"mattdesl"},{"email":"chris@neversaw.us","name":"chrisdickinson"},{"email":"javascript@yosh.is","name":"yoshuawuyts"},{"email":"me@mikkoh.com","name":"mikkoh"},{"email":"tatum.creative@gmail.com","name":"tatumcreative"},{"email":"wwwtyro@gmail.com","name":"wwwtyro"},{"email":"thibaut.seguy@gmail.com","name":"thibauts"},{"email":"post.ben.here@gmail.com","name":"bpostlethwaite"},{"email":"df.creative@gmail.com","name":"dfcreative"},{"email":"arnebackeric@gmail.com","name":"erkaman"},{"email":"renaudeau.gaetan@gmail.com","name":"gre"},{"email":"rsreusser@gmail.com","name":"rreusser"},{"email":"marcin.ignac@gmail.com","name":"vorg"},{"email":"arch.mojtaba.samimi@gmail.com","name":"archmoj"}],"readme":"# glsl-face-normal\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n![demo-image](http://i.imgur.com/PFaEL8y.png)\n\n[(click for demo)](http://stack.gl/glsl-face-normal/demo)\n\n<!-- iframe: http://stack.gl/glsl-face-normal/demo -->\n\nApproximates face normals in the fragment shader for flat shading from the position in camera space.\n\n*Note:* You need to enable `GL_OES_standard_derivatives`.\n\nFragment:\n\n```glsl\n#extension GL_OES_standard_derivatives : enable\nvarying vec3 vViewPos;\n\n#pragma glslify: faceNormal = require('glsl-face-normal')\n\nvoid main() {\n  vec3 normal = faceNormal(vViewPos);\n  //... lighting\n}\n```\n\nVertex: \n\n```glsl\nvarying vec3 vViewPos;\n\nvoid main() {\n  vec4 pos = vec4(position, 1.0);\n  vec4 mpos = modelViewMatrix * pos;\n  gl_Position = projectionMatrix * mpos;\n  vViewPos = -mpos.xyz;\n}\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/glsl-face-normal.png)](https://nodei.co/npm/glsl-face-normal/)\n\n#### `vec3 normal = faceNormal(vec3 pos)`\n\nApproximates the face `normal` from the given `pos`, which is typically the position in camera-space.\n\nFor better precision, you can use the [eye relative position](http://www.enkisoftware.com/devlogpost-20150131-1-Normal_generation_in_the_pixel_shader.html) instead.\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/stackgl/glsl-face-normal/blob/master/LICENSE.md) for details.\n","readmeFilename":"README.md","users":{"hellopath":true,"mystaticself":true}}