PDA

View Full Version : Lighting vs vertices



Bagoj
03-16-2004, 04:58 PM
Hi there!

Is it possible to change the properties of a light after each vertex in a face? (I want to do some kind of primitive vertex based shadowing) Or is there another way to do this? (for example i want a light to affect 2 vertices with intensity=1 and the third one with only intensity=0.2 )

EraZer
03-16-2004, 05:25 PM
Couldn't you just change the color of vertices? For example: 2 vertices are (1.0f, 1.0f, 1.0f) and the last one is (0.2f, 0.2f, 0.2f). The effect will be same in my opinion, because lighting do the same- changing colors. And this should be faster.

Bagoj
03-16-2004, 05:32 PM
I also need the lighting data. When i wrote intensity=1 or 0.2 i mean multipying the ligth intensity by 1 or 0.2. (And i have more than 1 lights)

EraZer
03-16-2004, 05:56 PM
So multiply them.

EraZer
03-16-2004, 05:58 PM
Draw shaded elements when GL_LIGHTING is disabled.

Bagoj
03-16-2004, 06:15 PM
Ok, ill explain, maybe i wasn't clear:
2 lights lit a face, if the first one lits a vertex and the second not (because some object blocks the ray) than i want the first light calculated with intensity=1 and the secont with intesity=0 but maybe both lights lit the second vertex, and none of them lit the third vertex. That's why i'd like to adjust light parameters before each vertex.
And i cannot do it manually because lighs have different color, intensity, position etc. it would be difficult and slow.

hh10k
03-16-2004, 07:28 PM
You can change the color at each vertex using glMaterial#, or if you're slack you can enable GL_COLOR_MATERIAL and just use glColor#. However, per vertex shadowing is not really the way to go (unless you have a very constained scene).

I'd recommend you take a look around at nvidia's developer site and read some of the papers to find out what your options are, because shadows aren't really a beginners topic http://www.opengl.org/discussion_boards/ubb/smile.gif

mw
03-16-2004, 11:31 PM
If you only need to change intensity for vertex lighting, turn off normalizing of normal vectors and premultiply the vertex normal vectors with your intensity factor

Bagoj
03-17-2004, 04:09 AM
Well, thanks, but material and changig the normal works only if i have 1 light source becuse it affects the light from all sources. I'd like to do it somehow to all separate light sources.

Thanks: Bagoj