Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: Lighting vs vertices

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    18

    Lighting vs vertices

    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 )

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    24

    Re: Lighting vs vertices

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    18

    Re: Lighting vs vertices

    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)

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    24

    Re: Lighting vs vertices

    So multiply them.

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    24

    Re: Lighting vs vertices

    Draw shaded elements when GL_LIGHTING is disabled.

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    18

    Re: Lighting vs vertices

    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.

  7. #7
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    25

    Re: Lighting vs vertices

    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

  8. #8

    Re: Lighting vs vertices

    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

  9. #9
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    18

    Re: Lighting vs vertices

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •