PDA

View Full Version : Pre calc vertex lights



qiz
05-12-2003, 01:18 AM
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.

knackered
05-12-2003, 01:50 AM
Yes, you need to split them up.

qiz
05-12-2003, 02:13 AM
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.)

knackered
05-12-2003, 03:54 AM
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
05-12-2003, 04:05 AM
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?

CAD_Swede
05-12-2003, 07:46 AM
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

jwatte
05-12-2003, 12:12 PM
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)

knackered
05-12-2003, 01:13 PM
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.

CAD_Swede
05-12-2003, 10:39 PM
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

qiz
05-13-2003, 12:44 AM
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?

knackered
05-13-2003, 01:12 AM
Christ almighty. I'm not repeating myself.