Created
April 19, 2009 17:19
-
-
Save andsve/98138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main (void) | |
{ | |
float depth = texture2D(tex_depth, gl_TexCoord[0].st).r * 2.0 - 1.0; | |
vec3 norm = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0; | |
//norm = normalize(norm); // no need? | |
vec4 ambient = texture2D(tex_motion, gl_TexCoord[0].st); // currently holds ambient colors | |
// will be used for velocity in future | |
// Viewport position at this pixel in the range -1 to 1. | |
vec4 projection_pos = vec4(gl_TexCoord[0].st * 2.0 - 1.0, depth, 1.0); | |
// Transform by the view-projection inverse. | |
vec4 viewport_pos = invprojmtx * projection_pos; | |
// Divide by w to get the world position. | |
vec4 frag_pos = viewport_pos / viewport_pos.w; | |
// ... blinn-phong calculations | |
gl_FragColor = final_color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment