PDA

View Full Version : Couple q's about vertex programs & lights



robert
02-25-2002, 01:38 AM
1) looking through the NVIDIA labs on vertex programs, and the first one, to do with per pixel lighting has material color. Now, say i want to have a 'red' light, then i just change the material color? I think that's right, because isn't that the way it is done with normal vertex lighting? I think i've prob answered my own question http://www.opengl.org/discussion_boards/ubb/wink.gif

2) If i wanted more than one light (different colours) would i have to draw the scene each time for each light? or do i have multiple vertex programs operating on at a time?

3) What is the easiest way to do bump-mapping and per pixel lighting together?

thanks!

Julien Cayzac
02-25-2002, 02:22 AM
Originally posted by robert:
If i wanted more than one light (different colours) would i have to draw the scene each time for each light? or do i have multiple vertex programs operating on at a time?
You can do it a single program. Vertex programs can use up to 96 constant registers. You can pass many lights' directions (or position) / colors to a program using these.



3) What is the easiest way to do bump-mapping and per pixel lighting together?

Using the core GL only, try looking at the combine textures abilities (it was called ARB_texture_env_combine in OpenGL 1.2). If you plan to make things faster (and driver dependent), look at NV_texture_shader (GeForce3/4Ti), NV_register_combiners(TN2, gf256, gf2/3/4), or ATI_fragment_shader(Radeon).

Julien.

robert
02-25-2002, 05:51 PM
You can do it a single program. Vertex programs can use up to 96 constant registers. You can pass many lights' directions (or position) / colors to a program using these.

How would i do this in a vertex program? Say at one time i need two lights, at another i only need one. Would i have to write a vp that would work on three lights?

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif