PDA

View Full Version : per pixel lighting using fragment program



vince
05-12-2003, 12:22 PM
Hi,
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.

Thanks.

jra101
05-12-2003, 01: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).

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