{"_id":"glsl-specular-cook-torrance","_rev":"26-46e65f5f4b069f5d89da1efebcae9d9a","name":"glsl-specular-cook-torrance","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"glsl-specular-cook-torrance","version":"1.0.0","keywords":["cook","torrance","specular","light","fresnel","glsl","glslify"],"author":{"name":"Mikola Lysenko"},"license":"MIT","_id":"glsl-specular-cook-torrance@1.0.0","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-specular-cook-torrance","bugs":{"url":"https://github.com/stackgl/glsl-specular-cook-torrance/issues"},"dist":{"shasum":"587e0c7651b7e74bf799612833a5d3330cc96cee","tarball":"https://registry.npmjs.org/glsl-specular-cook-torrance/-/glsl-specular-cook-torrance-1.0.0.tgz","integrity":"sha512-PNR4MNjD2itXpYRk6hS60btfwaT2z8O1mh8B9bhRj5f33qVnGKtJ3F3ojNN2o95kemqwM+qJmJC0s4fAC1kvPg==","signatures":[{"sig":"MEUCIH69SY5GQhFZyRKscAZmpN849I1Sqzrfw8uBz7sWg4ppAiEA+5cahelnvMeKVu1Clumn1B+C9wNLRMu8MdZTjxdjOJc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"beefy example/example.js --open"},"_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"browserify":{"transform":"glslify"},"repository":{"url":"git://github.com/stackgl/glsl-specular-cook-torrance.git","type":"git"},"_npmVersion":"1.4.3","description":"Cook-Torrance specular/fresnel lighting term","directories":{"example":"example"},"dependencies":{"glsl-specular-beckmann":"^1.0.0"},"devDependencies":{"beefy":"^2.1.1","glslify":"^1.6.0","a-big-triangle":"^1.0.0"}},"1.0.1":{"name":"glsl-specular-cook-torrance","version":"1.0.1","keywords":["cook","torrance","specular","light","fresnel","glsl","glslify"],"author":{"name":"Mikola Lysenko"},"license":"MIT","_id":"glsl-specular-cook-torrance@1.0.1","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-specular-cook-torrance","bugs":{"url":"https://github.com/stackgl/glsl-specular-cook-torrance/issues"},"dist":{"shasum":"4bc5cc21074ddb50208c4776cd61e16df1d1a7c9","tarball":"https://registry.npmjs.org/glsl-specular-cook-torrance/-/glsl-specular-cook-torrance-1.0.1.tgz","integrity":"sha512-dBLnO4nf1iMcvF8Ki2o76ICwsnysbEoULmpqyuxAt0Pld1AUcFEisjPH3lLqdtyaLrHNwlrZo5uKK3sYS0VW4w==","signatures":[{"sig":"MEQCIGQm7V7KdukN3zoea4dTUedCnNXDKdr3hYn5ANXCIZaHAiA0/pjNXKLR9NrmkXtZ1kKVX7GKAPU4U2TCch1AGZfClA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"4bc5cc21074ddb50208c4776cd61e16df1d1a7c9","gitHead":"97f31a310226856202108291f5cf1995f1890679","scripts":{"test":"beefy example/example.js --open"},"_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"browserify":{"transform":"glslify"},"repository":{"url":"git://github.com/stackgl/glsl-specular-cook-torrance.git","type":"git"},"_npmVersion":"2.1.3","description":"Cook-Torrance specular/fresnel lighting term","directories":{"example":"example"},"_nodeVersion":"0.10.26","dependencies":{"glsl-specular-beckmann":"^1.0.0"},"devDependencies":{"beefy":"^2.1.1","glslify":"^1.6.0","a-big-triangle":"^1.0.0"}},"2.0.0":{"name":"glsl-specular-cook-torrance","version":"2.0.0","keywords":["cook","torrance","specular","light","fresnel","glsl","glslify"],"author":{"name":"Mikola Lysenko"},"license":"MIT","_id":"glsl-specular-cook-torrance@2.0.0","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-specular-cook-torrance","bugs":{"url":"https://github.com/stackgl/glsl-specular-cook-torrance/issues"},"dist":{"shasum":"b8d1798831faad49ba9b8de4797672a96efdfa62","tarball":"https://registry.npmjs.org/glsl-specular-cook-torrance/-/glsl-specular-cook-torrance-2.0.0.tgz","integrity":"sha512-GxH7U+RjsKzYwbbtZh5J0psRi0EjzjjMULuBiNFthmp5AKt4Qm8kBYT7tqAITBqqLyRA1j0bgPdPakbVAw07Bg==","signatures":[{"sig":"MEUCIHwAF+Yi1UyoYoAtIiTPQ67U7c0yFmPDc+1kj9FHrfhkAiEA/b8/Ho6d2+pEILiHPnbmrvakeQiDPiYSEkdRWLgJNHA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"b8d1798831faad49ba9b8de4797672a96efdfa62","gitHead":"6185644b375fd8627a2554075f4ee717a7f758e5","scripts":{"test":"beefy example/example.js --open"},"_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"browserify":{"transform":"glslify"},"repository":{"url":"git://github.com/stackgl/glsl-specular-cook-torrance.git","type":"git"},"_npmVersion":"2.1.3","description":"Cook-Torrance specular/fresnel lighting term","directories":{"example":"example"},"_nodeVersion":"0.10.26","dependencies":{"glsl-specular-beckmann":"^1.1.0"},"devDependencies":{"beefy":"^2.1.1","glslify":"^1.6.0","a-big-triangle":"^1.0.0"}},"2.0.1":{"name":"glsl-specular-cook-torrance","version":"2.0.1","keywords":["cook","torrance","specular","light","fresnel","glsl","glslify"],"author":{"name":"Mikola Lysenko"},"license":"MIT","_id":"glsl-specular-cook-torrance@2.0.1","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"homepage":"https://github.com/stackgl/glsl-specular-cook-torrance","bugs":{"url":"https://github.com/stackgl/glsl-specular-cook-torrance/issues"},"dist":{"shasum":"a891cc06c8c7b4f4728702b4824fdacbb967d78f","tarball":"https://registry.npmjs.org/glsl-specular-cook-torrance/-/glsl-specular-cook-torrance-2.0.1.tgz","integrity":"sha512-bFtTfbgLXIbto/U6gM7h0IxoPMU+5zpMK5HoAaA2LnPuGk3JSzKAnsoyh5QGTT8ioIEQrjk6jcQNrgujPsP7rw==","signatures":[{"sig":"MEQCIBxqWLAAD7gg9awCuST0SkzgoZ///Ro4S/ie6CKftXaFAiAiqT+y4o1ImHXMgTqAqNmvmvDIIhlgdqeb0w3fLDt8SQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"a891cc06c8c7b4f4728702b4824fdacbb967d78f","gitHead":"e0cfb44fe628a3d2fdfa14268870a9792fa26275","scripts":{"test":"beefy example/example.js --open"},"_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"browserify":{"transform":"glslify"},"repository":{"url":"git://github.com/stackgl/glsl-specular-cook-torrance.git","type":"git"},"_npmVersion":"2.1.3","description":"Cook-Torrance specular/fresnel lighting term","directories":{"example":"example"},"_nodeVersion":"0.10.26","dependencies":{"glsl-specular-beckmann":"^1.1.1"},"devDependencies":{"beefy":"^2.1.1","glslify":"^1.6.0","a-big-triangle":"^1.0.0"}}},"time":{"created":"2014-10-12T13:41:56.952Z","modified":"2024-12-29T00:47:13.145Z","1.0.0":"2014-10-12T13:41:56.952Z","1.0.1":"2014-10-15T15:49:41.605Z","2.0.0":"2014-10-15T18:51:39.314Z","2.0.1":"2014-10-18T00:28:09.534Z"},"bugs":{"url":"https://github.com/stackgl/glsl-specular-cook-torrance/issues"},"author":{"name":"Mikola Lysenko"},"license":"MIT","homepage":"https://github.com/stackgl/glsl-specular-cook-torrance","keywords":["cook","torrance","specular","light","fresnel","glsl","glslify"],"repository":{"url":"git://github.com/stackgl/glsl-specular-cook-torrance.git","type":"git"},"description":"Cook-Torrance specular/fresnel lighting term","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-specular-cook-torrance\n\nComputes the specular power in the Cook-Torrance model.\n\n# Example\n\n```glsl\n#pragma glslify: cookTorranceSpec = require(glsl-specular-cook-torrance)\n\nuniform vec3 eyePosition;\nuniform vec3 lightPosition;\n\nuniform float roughness, fresnel;\n\nvarying vec3 surfacePosition, surfaceNormal;\n\nvoid main() {\n  //Light and view geometry\n  vec3 viewDirection = normalize(eyePosition - surfacePosition);\n  vec3 lightDirection = normalize(lightPosition - surfacePosition);\n\n  //Surface properties\n  vec3 normal = normalize(surfaceNormal);\n  \n  //Compute specular power\n  float power = cookTorranceSpec(\n    lightDirection, \n    viewDirection, \n    normal, \n    roughness,\n    fresnel);\n\n  gl_FragColor = vec4(power,power,power,1.0);\n}\n```\n\n# Usage\n\nInstall with npm:\n\n```\nnpm install glsl-specular-phong\n```\n\nThen use with [glslify](https://github.com/stackgl/glslify).\n\n# API\n\n```glsl\n#pragma glslify: cookTorrance = require(glsl-specular-cook-torrance)\n```\n\n##### `float cookTorrance(vec3 lightDir, vec3 eyeDir, vec3 normal, float roughness, float fresnel)`\nComputes the specular power in the Cook-Torrance\n\n* `lightDir` is a *unit length* `vec3` pointing from the surface point toward the light\n* `eyeDir` is a *unit length* `vec3` pointing from the surface point toward the camera\n* `normal` is the *unit length* surface normal at the sample point\n* `roughness` is the surface roughness parameter, between 0 and 1.  0 means surface is perfectly smooth, 1 means surface is matte\n* `fresnel` the Fresnel exponent.  0 = no Fresnel, higher values create a rim effect around objects\n\n**Returns** A `float` representing the specular power\n\n**Note** Unlike the usual Cook-Torrance model, the light power is not scaled by 1/(normal . lightDirection).  This avoids an unnecessary numerically unstable division, but requires modifying how diffuse light is calculated.\n\n# License\n(c) 2014 Mikola Lysenko. MIT License","readmeFilename":"README.md"}