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.

Yes, you need to split them up.

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.)

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).]

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?

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? :slight_smile: all day? :wink:

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. :slight_smile: 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 :wink:

/Henrik

At least those of you who still hold jobs then pay taxes for running the asylum :wink:

(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)

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.

Originally posted by jwatte:
At least those of you who still hold jobs then pay taxes for running the asylum :wink:

Entering Blade Runner Mode

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

:slight_smile:

/Henrik

Originally posted by knackered:
[b]
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).][/b]

Ok, so glLights is faster then using vertex programs?

Christ almighty. I’m not repeating myself.