Autogeneration of lightmap UVs often fails
I have written a custom importer for Alembic meshes for our studio pipeline, and everything works fine except for Lightmap UVs. When the StaticMesh is set to generate lightmap UVs, it often fails to do so. At first I thought maybe there was something wrong on my end, but then I realized that some meshes do properly get generated lightmap UVs, but most do not.
My guess is that the algorithm to generate them is simply failing due to incredibly complex and dense UVs. The meshes have upwards of 20 materials on them in order to maximize texture density, so there are tons of overlapping UVs. These are imported from a VFX pipeline that uses UDIMs, so each UDIM gets converted to a separate material and the UVs normalized to 0,1 space.
Is there anything I can do here or are we going to be stuck manually making UVs for lightmap?
asked Dec 02 '15 at 05:46 PM in Bug Reports
Ok putting this here for future reference if others have this same issue.
The algorithm UE4 uses apparently takes texel resolution into account, and will fail to generate UVs if the resulting resolution would be too small. Or, well, something like that I guess.
By going into the StaticMesh build settings and increasing the "Min Lightmap Resolution" to 2048, and applying the change I was able to get proper UVs to be generated which took about as long as it does in Modo, about 30 minutes to process.
So long story short I guess, if your Lightmap UVs come out blank, try increasing your Min Lightmap Resolution.
answered Dec 03 '15 at 06:50 PM
As you're already aware Alembic support is not one of our import options, but is on the wishlist/backlog to have at some point. I would probably expect there to be some issues though because it's not uncommon for other types of assets to have issues generating lightmap UVs in UE4.
There are a couple considerations to remember when using the generated lightmap UVs,
UE4 will not create new seams and break UV islands apart. It will only repack the existing UV. So with this in mind you will need to at least have setup your UVs in a way that can be repacked for use with this system. As an example if you have a cylinder and you do not break the side face so that it can be unwrapped as a rectangle, when the lightmap is generated in UE4 the face will result in overlapping UVs because it cannot be packed and seamed correctly.
So with that in mind, depending on the assets being used it may be better to do a rough UV just to create some UV islands and then let UE4 repack the lightmap.
answered Dec 02 '15 at 07:59 PM
Tim Hobson ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here