Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glsl-specular-blinn-phong

Package Overview
Dependencies
Maintainers
9
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-specular-blinn-phong

Blinn-Phong specular effect

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
9
Weekly downloads
 
Created
Source

glsl-specular-blinn-phong

Computes the Blinn-Phong specular weight for a light source

Example

#pragma glslify: blinnPhongSpec = require(glsl-specular-blinn-phong)

uniform vec3 eyePosition;
uniform vec3 lightPosition;

uniform float shininess;

varying vec3 surfacePosition;
varying vec3 surfaceNormal;

void main() {
  vec3 eyeDirection = normalize(eyePosition - surfacePosition);
  vec3 lightDirection = normalize(lightPosition - surfacePosition);
  vec3 normal = normalize(surfaceNormal);

  float power = blinnPhongSpec(lightDirection, eyeDirection, normal, shininess);

  gl_FragColor = vec4(power,power,power,1.0);
}

Usage

Install with npm:

npm install glsl-specular-blinn-phong

Then use with glslify.

API

#pragma glslify: blinnPhong = require(glsl-specular-blinn-phong)
float blinnPhong(vec3 lightDir, vec3 eyeDir, vec3 normal, float shininess)

Computes the specular power in the Blinn-Phong lighting model.

  • lightDir is a unit length vec3 pointing from the surface point toward the light
  • eyeDir is a unit length vec3 pointing from the surface point toward the camera
  • normal is the surface normal at the sample point
  • shininess is the exponent in the Phong equation (default 20.0)

Returns A float representing the power of the Blinn-Phong lighting equation

License

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 04 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc