best ways of lightmap's packing

Hi!

I think lightmaps are not dead. It’s best and fast way to create static soft shadows.
But, what is best ways of lightmap’s packing
now , for hi-poly geometry ? In old days lightmaps packed by convex faces that lie in one plane. But now we must group many faces to calculate lightmaps. What’s best ways to pack many different lightmaps for triangles groups ? How you doing this ? What do you think about this ?

Thanks

Do a google for “texture atlas”.

I think Hoppe (of Microsoft Research) has a few papers on some techniques that are useful for that.

This is quite easy really, if you can make some assumptions about the model. The assumptions are, that the model’s smoothness can be represented by smoothing groups, and that it’s texture coordinates don’t overlap within a smoothing group. I think these are quite fair assumptions since it’s the way they get usually modeled anyway.

Then all you need to do is to create one lightmap for each smoothing group. The lightmap coordinates are the texture coordinates scaled so that the entire smoothing group’s coordinates fit between 0 and 1. And that’s about it. If you don’t have smoothing group information, you can detect them yourself. And of course you should pack all the lightmaps into one big texture, but you can do that afterwards.

-Ilkka

Looks interesting - I will take a look at the “texture atlas topic” - in the meanwhile, I still wonder how the correct sampling rate can be computed.

Then, when the “polygon lightmaps” are melted into the “big lightmap” there’s the problem of seams and the problem about how to place everything correctly… Can you give me some hints on that also? I will explain me better if needed.

Thanks.

For achieving the correct polygon position in the “big bitmap” that contains your lightmaps , you must take your model , transform it into UV coordinates (which is the texture space) , then create the lightmaps for the polygon section into the “big bitmap” that maps all the model.

but that´s only for the big bitmap apprroach …there are quite a few different for this subject

was i clear enough ? when i was writing things look ok into my head , but after a second reading , i thought …hmmm crazy explanation…

any doubts …just let me know i i´ll try to explain it better : )

If you create one texture per smoothing group, you won’t get seams. If not, man you’re in trouble. I don’t think there’s a way to hide them then, ecxept for blending them somehow.

Placing the little textures into the big map can be tricky, my algorithm goes somehow like this:

-All textures have power of two widths and heights. This is not necessary, but it’s inherent from the time I didn’t pack them and it helps to pack them efficently so why not…
-All textures have width greater or equal to their height. If they don’t, rotate them.

Guess the final texture size. Start by the smallest one that exceeds the summed area of the small ones.

Than call function fill for the entire big texture area.

The fill function takes a rectangle which it’s supposed to fill with little textures. It picks the largest remaining lightmap that can fit into it’s rectangle and inserts it there. Then it recursively calls fill for the two rectangles that form the unfilled area of it’s rectangle.

If all lightmaps don’t fit into the large texture, expand it and try again until they all fit.

I hope that makes sense.

-Ilkka