View Full Version : per pixel lighting using fragment program

05-12-2003, 11:22 AM
I'm thinking of using the GL_ARG_fragment_program extension to do per pixel lighting. The idea seems straight forward, but I need the normal to do the maths, and the normal is a vertex attribute, not a fragment. So how can I code it?

BTW, if anybody knows a web site where I could find good vertex and fragment programs using the ARB extensions, that would be usefull.


05-12-2003, 12:04 PM
If you want to access the normal in the fragment shader, just write it to one of your texcoord outputs in the vertex shader (after transforming it into the correct space).

05-13-2003, 04:02 AM
That sounds like a cool idea. I'll try that! :-)