Packing Lightmaps

algorithms binpacking coding lightmaps

Will Faught

1 minute

Jim Scott at blackpawn.com:

Pop Quiz: You have 765,618 lightmaps for a scene and very few of them have power of 2 dimensions, what do you do? If your answer was to rescale them and call CreateTexture 765,618 times please slap yourself. If your answer had anything to do with glTexImage2D, you might want to leave now. What you really want to do is smush them all into a couple larger textures, and this text will show you one way of doing it.

There are a couple pictures of the result, and they’re fascinating.

π