x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.9
Tags:
more ▼

asked Dec 02 '15 at 05:46 PM in Bug Reports

avatar image

John Vanderbeck
146 9 20 36

avatar image John Vanderbeck Dec 02 '15 at 06:42 PM

Ok maybe I am being too harsh on Unreal here :) To do some tests I opened the alembic into Modo to use Modo's Pack feature (which is basically the same thing) to pack all the UDIM UVs into 0,1 with no overlaps and it has been running for 10 minutes and is nowhere near complete.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Dec 03 '15 at 06:50 PM

avatar image

John Vanderbeck
146 9 20 36

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi John,

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.

Thank you!

Tim

more ▼

answered Dec 02 '15 at 07:59 PM

avatar image

Tim Hobson ♦♦ STAFF
48.8k 887 101 878

avatar image John Vanderbeck Dec 02 '15 at 10:12 PM

Hi Tim,

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.

Well like I said we wrote our own Alembic importer and everything with the exception of lightmap UVs works just perfect. All standard UVs come in properly. However they are all overlapping because we go from a model with one material and 30 or 40 UDIMs, to a StaticMesh where each UDIM is converted to a material, and the UVs repositioned to 0,1. The end result is a mess of overlapping UVs given to Unreal. Everything looks perfect in the engine with the exception of Lightmaps.

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.

The exact same UVs given to Modo properly pack into a non overlapping 0,1 space, and all Modo does is translate, rotate, and uniformly scale the UVs. so it isn't an issue with seams or anything. However it took like 30 minutes for Modo to do the operation.

So my guess here is that the algorithm in Unreal is designed for speed, not completeness, and after a certain number of iterations it just gives up?

avatar image Tim Hobson ♦♦ STAFF Dec 03 '15 at 04:03 PM

I'm not completely familiar with that part of the code, but I would say that it would focus on speed.

Overall, it's an ongoing process to improve this feature that was introduced with 4.5/4.6.

Brian laid out the plan, but no obvious timeframe for all the improvements that would need to happen. https://forums.unrealengine.com/showthread.php?32574-How-we-plan-to-make-lightmaps-awesome-in-UE4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question