I'm making a DirectX 9 C++ application using the fixed function pipeline, given pre-computated lighting for each vertex, (Regardless of normals/etc) how can I apply this to the final image?
I'm currently using textured primitives and I'm trying to change colour as a whole (over the entire primitive -- rather than using a gradient) and I have to precalculate lighting because of the the number of lights and the application being designed to get decent framerates even on low-end machines. (IE one pass per light is one too many)
My vertex struct looks like
struct Vertex
{
float x, y, z, u, v;
};
Basically I want to add a lighting value to that and apply it using the fixed function pipeline per vertex (without using actual "lights")
Any help would be greatly appreciated...
I no longer work with fixed function pipeline, as I am using shaders like almost anyone else in the field, I have forgotten the details and I am therefore unable to provide a complete and ready to work answer, but this could hopefully give you a start:
Per-Vertex Color State (Direct3D 9).
You need to use FVF like this:
and to enable using the vertex color by:
If you do not want to use any lighting, one option is to use a single directional light with diffuse component black and ambient component white. This way the lighting will be completely flat and only the material colors will be used.
That said, do you really need to be concerned about fixed function rendering? Using shaders it would be very easy to implement this and you can find a lot of people able to give you advice how to do that.