Sha256: 736e7d23b45b5206de363641cb82ba2327cb4b34a63d65140de4299b0e11d0b7
Contents?: true
Size: 831 Bytes
Versions: 10
Compression:
Stored size: 831 Bytes
Contents
// Toon shader using per-pixel lighting. Based on the glsl // tutorial from lighthouse 3D: // http://www.lighthouse3d.com/tutorials/glsl-tutorial/toon-shader-version-ii/ #define PROCESSING_LIGHT_SHADER uniform mat4 modelview; uniform mat4 transform; uniform mat3 normalMatrix; uniform vec3 lightNormal[8]; attribute vec4 vertex; attribute vec3 normal; varying vec3 vertNormal; varying vec3 vertLightDir; void main() { // Vertex in clip coordinates gl_Position = transform * vertex; // Normal vector in eye coordinates is passed // to the fragment shader vertNormal = normalize(normalMatrix * normal); // Assuming that there is only one directional light. // Its normal vector is passed to the fragment shader // in order to perform per-pixel lighting calculation. vertLightDir = -lightNormal[0]; }
Version data entries
10 entries across 10 versions & 1 rubygems