Original Post
This is another question about lightmaps. Not how to use them (I know, multi-texturing...) but how to calulate and draw the actual bitmap used.
I have the following information:
- an array of triangles, each withx y and z coords, and uniques texture u and v coordinates
- an array of (omni) lights, each with a rgb color and an xyz position coordinate.
I want to calculate the amount of light (rgb values) for each triangle (I suppose; would at each vertex be better? How would you do that though?)
I suppose I have to calulate the normals for each triangle, and then find the angle between those / the light. How do I do this? (Please explain clearly, or link to a site that explains it clearly, preferably with code examples).
Once I have a value for each triangle, I want to draw this to a bitmap. I suppose I could just draw a flat shape, but that would result in flat-shaded triangles in-game, wouldn''t it?
So how do I go about blending between the triangles? Does anyone have a code snippet for drawing triangles with a different colour at each vertex? Or should I draw them flat, and then use a blur function? (Now I need to know code for a blur... and how do you calulate how much blur to use?)
Sorry this is such a long post, and asks such a lot... I''m fairly new to OpenGL, and I''ve never used lightmaps before.
TIA, Illuzion.