Optimization with Lightmaps, LOD, and Collisions

From PSwiki
Revision as of 14:32, 26 April 2020 by Zweitholou (talk | contribs) (optimization walkthrough)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Once a mesh asset has been brought into unreal, there are a few important optimizations and fixes to improve performance for players.

For Lightmap UVs, most of these will have been created automatically on import. However, there can be a few errors with the automatic process. To check lightmap density, use the lightmap density visualizer view mode, or alt+0.

This view mode uses a color scale and grid texture to simplify balancing lightmap resolutions, and also identify mapping errors. In this layout, blue is too low res, green is optimal, and red is too high res. Occaisionally errors will create purple when there is overlap or sever distortion.

In the case of correct mapping but incorrect scale, lightmap resolution should be changed from the default 64 to a size that shifts the color to green, done under lightmap settings in the the mesh details panel.

For the purple errors, the mesh needs a lightmap unwrapped in blender, typically because it already has multiple internal UV maps and can't properly autogenerate to a new channel. To fix this, first make sure the correct channel is assigned, by looking at the mesh uv channels and determining if there is a proper lightmap channel already. These typically show every face mapped individually and quite small in a large array.

If there is no proper lightmap, open the mesh in blender and use unwrap lightmap uvs, making sure to unwrap to a new channel and not over the main texture channel. Once done, reimport without autogeneration of lightmaps on, and select the new channel for lightmap baking.

For LOD, or level of detail, unreal engine has a good auto LOD generator that can be used bot for distance meshes and higher quality collision meshes where appropriate. First, set the asset to the correct LOD group, which will auto generate the LODs. Then, check the new LODs and test them at their set distances to make sure the swap is clean between them, and that the generation process didn't distort the profile too much. If it did, play with the reduction settings by changing the percent decrease slider until you have the right balance.

Additionally, these new lower LOD models can be applied as a complex collision mesh, which for certain assets like buildings gives a better performance than using LOD0 as a complex collision mesh, but offers higher fidelity for things like columns that auto convex collision doesn't work well for.