Dynamic Lightmaps in OpenGL

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Dynamic Lightmaps in OpenGL

Post by Virion »

incase someone is interested in this:

http://joshbeam.com/articles/dynamic_li ... in_opengl/
booe
Posts: 76
Joined: Thu Jul 29, 2010 2:12 pm

Post by booe »

Code: Select all

	struct surface {
		float vertices[4][3];
		float matrix[9];

		float s_dist, t_dist;
	};
	
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.
Imho its ridiculus. Who would like to use such big struct of data for *every* lightmapped surface in game?!
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

I wouldn't call it ridiculous. The struct size in total is 92 bytes. So even for 10,000 surfaces would be 920k, less than a megabyte.
Post Reply