glsl-dof
Physically accurate depth of field calculated from a vertex position.
Based on a post from Martins Upitis and with the help of this thread.
Example
# dof = require('glsl-dof') void
Install
Use npm to install and glslify to consume the function in your shaders.
npm install glsl-dof
Usage
float dof(float depth, float focalDepth)
Default values: focalLength
= 100.0, fstop
= 2.0, near
= 0.01 and far
= 100.0.
float dof(float depth, float focalDepth, float focalLength, float fstop, float near, float far)
License
MIT, see LICENSE.md for details.