View Full Version : Lighting vs vertices
03-16-2004, 03:58 PM
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 )
03-16-2004, 04: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.
03-16-2004, 04: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)
03-16-2004, 04:56 PM
So multiply them.
03-16-2004, 04:58 PM
Draw shaded elements when GL_LIGHTING is disabled.
03-16-2004, 05: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.
03-16-2004, 06: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
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
03-17-2004, 03: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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.