glsl-basic-vertex-shader
v1.0.0
Published
GLSL snippet for a generic vertex shader
Downloads
5
Readme
glsl-basic-vertex-shader
GLSL snippet for a generic vertex shader for use with glslify
. Includes standard components like model, animate, view, and projection matrices. Designed for standalone use. You might find it useful if you find yourself writing this boilerplate shader, or something similar, a lot.
install
Add to your project with
npm install glsl-basic-vertex-shader
usage
Inside your vertex shader just call
#pragma glslify: main = require('glsl-basic-vertex-shader')
components
Make sure you define all attributes
and uniforms
. If you don't need to use any of the matrices just set them to the identity matrix. The varying
variables can be used in your fragment shader.
attributes
vec3
position
input vertex positionvec3
normal
input vertex normal
uniforms
mat4
projection
projection matrixmat4
view
view matrixmat4
model
model matrixmat4
animate
animation matrixmat3
modelNormal
transpose inverse of model matrixmat3
animateNormal
transpose inverse of animation matrix
varying
vec3
vposition
computed vertex positionvec3
vnormal
computed vertex normal