Hi everyone, this is my first post, so first of all hi! My name is Aimee, and I’ve been programming for about 11 years now.
After successfully building a great little 2d ortho engine, I’ve moved over to learning the 3d side of game rendering. At the moment everything seems to be coming together quite nicely as allot of this stuff is not really new to me. However my current focus is light maps, and I’m struggling with one aspect that is turning into a bit of a thorn.
In particular I’m talking about the dynamic light map generation. I have a routine that takes in a polygon, two arrays (one for the normal’s and texture uv’s associated with each point on the polygon), and an array of light objects (which contain position and color).
From my understanding the following should happen:
-
create a matrix that contains information for each lumel on the light map.
-
calculate each lumel’s distance from each light.
-
decide each lumel’s color based on it’s distance from light.
-
pack the matrix into a new gl texture.
-
upon render, use multi-texturing to layer the underlying texture, and the light map to create the effect.
Out of those 5 steps, the one that is giving me a headache is the 2nd, I understand that first the position of the lumel need’s to be converted from 2d to 3d space, but how do I do do this conversion for each lumel? Unfortunately the only article I’ve found so far with a clear example of the math uses a rotation matrix for quad’s, and that just confuses things.
Thank’s in advance, and don’t worry about me not understanding a potential answer, I aim to master this, and any pointers will be a great help.
Aimee.