Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Pre calc vertex lights

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2000
    Location
    Sweden
    Posts
    29

    Pre calc vertex lights

    I want to use pre calculated vertex lights in my engine.

    Is the only way to calculate the new diffuse color and put it in glColorPointer?

    The problem with that method is that in my engine a vertex can share faces with different diffuse colors = I need to split all these vertices up.

  2. #2
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: Pre calc vertex lights

    Yes, you need to split them up.
    Knackered

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2000
    Location
    Sweden
    Posts
    29

    Re: Pre calc vertex lights

    Ok, no way around?

    What about this method, is it good at all?
    Or should I go for another one?
    (vertex shaders, glLight, lightmaps etc.)

  4. #4
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: Pre calc vertex lights

    If you want static per-vertex lighting, then yes - pre-calculate the diffuse+ambient and store the colour per vertex in the colour array. You won't get specular, however (as that's view dependent, ie. dynamic).

    If you want static per-pixel lighting, then use lightmaps generated using either radiosity or raytracing or highly tesselated per-vertex lighting or any other method you can think of. (again, you won't get specular)

    If you want dynamic per-vertex lights, then stick with the fixed pipeline glLights, as they are usually implemented much faster than anything you could do using vertex programs or the CPU.

    If you want dynamic per-pixel lights, then use a combination of vertex programs (or CPU vertex setup) and pixel/fragment shaders (dot3 texture environment mode is the minimum capability you need on your graphics card).


    [This message has been edited by knackered (edited 05-12-2003).]
    Knackered

  5. #5
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: Pre calc vertex lights

    BTW, there seems to be a hell of a lot of swedish graphics programmers around these days...is buisness booming over there?
    I worked over there for a few months a couple of years ago, and the general feeling was that the swedish software industry was not doing so well - what's happened since then?
    Knackered

  6. #6
    Intern Newbie
    Join Date
    Mar 2003
    Posts
    37

    Re: Pre calc vertex lights

    Originally posted by knackered:
    BTW, there seems to be a hell of a lot of swedish graphics programmers around these days...is buisness booming over there?
    I worked over there for a few months a couple of years ago, and the general feeling was that the swedish software industry was not doing so well - what's happened since then?
    Uhm..Maybe the reason we're not doing so great is that we hang around OpenGL forums (Grammar Check: fora? :-) all day? ;-)

    Seriously, it's not as bad as it was just after the dot-com death, but it's not exactly booming either.

    Also, there's traditionally been a large PC demo scene here in Sweden and during the winters you have PLENTY of time when it's dark, so..I guess all them crazy ASM hackers had to go somewhere. :-) Cool OpenGL demos are one good way. (A bad way would be Mental Institutions, where people fluent in Pentium IV assembly all eventually end up ;-)

    /Henrik

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,704

    Re: Pre calc vertex lights

    At least those of you who still hold jobs then pay taxes for running the asylum ;-)

    (sorry, couldn't resist)

    (yes, I know that insurance distributes the cost in the US, too, and charity/county operations make up the difference for the uninsured)
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  8. #8
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: Pre calc vertex lights

    Huh?
    God forbid an american should pay reasonable taxes to support the less fortunate, eh?
    Follow the bible to the letter, but you can ignore the "there but for the grace of god go I" bit.
    Knackered

  9. #9
    Intern Newbie
    Join Date
    Mar 2003
    Posts
    37

    Re: Pre calc vertex lights

    Originally posted by jwatte:
    At least those of you who still hold jobs then pay taxes for running the asylum ;-)
    *Entering Blade Runner Mode*

    My Taxes? Let me tell you about my Taxes. *blam blam blam*

    :-)

    /Henrik

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2000
    Location
    Sweden
    Posts
    29

    Re: Pre calc vertex lights

    Originally posted by knackered:

    If you want dynamic per-vertex lights, then stick with the fixed pipeline glLights, as they are usually implemented much faster than anything you could do using vertex programs or the CPU.

    [This message has been edited by knackered (edited 05-12-2003).]
    Ok, so glLights is faster then using vertex programs?

Posting Permissions

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