incase someone is interested in this:
http://joshbeam.com/articles/dynamic_li ... in_opengl/
Dynamic Lightmaps in OpenGL
Dynamic Lightmaps in OpenGL
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Code: Select all
struct surface {
float vertices[4][3];
float matrix[9];
float s_dist, t_dist;
};
Imho its ridiculus. Who would like to use such big struct of data for *every* lightmapped surface in game?!We also need to know the world space distances between the surface's top left corner and top right corner (s_dist in the surface structure), and the surface's top left corner and bottom left corner (t_dist in the surface structure). This is so we know how far apart, horizontally and vertically, each pixel of the lightmap should be in world space, which we need to know in order to get a correct lighting value for each pixel. s_dist is equal to sqrt(dot_product(v4 - v1, v4 - v1)), where v4 is the fourth vertex and v1 is the first vertex. t_dist is equal to sqrt(dot_product(v2 - v1, v2 - v1)), where v2 is the second vertex and v1 is the first vertex.
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm