Download

Baking lightmaps Correctly without increasing lightmap resoltuion

Hi everyone, i have had a look at different tutorials and posts but i cant seem to find a way to bake my modeled geometry correctly which i have made in 3DS MAX without increasing the lightmap resolution to something like 1024 in unreal Engine 4.

I want to be able to bake something that is not so large in size, for example a chair or sofa to 128 lightmap resolution and not get any light bleeding or bad shadows. I have read that the grid size has to be changed to something like

0.0078125 in 3DS MAX in order for a lightmap of 128 to bake properly. This is where i get confused. How does the grid size help set out the geometry, i dont understand if i am meant to rescale it to fit perfectly on the grid or if i have to press a button in 3DS max to automatically position the polygons for me.

I have created a reception desk to use as an example to use to show everyone if i am doing something wrong. I have posted the pictures below

Can someone help please help me by maybe giving me a step by step on what i need to do. i just want a clean mesh. Thanks in advance !!!

Hi,

The lightmap resolution is the most influencial factor for lightmap quality. Texel alignment is also important, but small lightmaps will always yield lower quality results.

The value is exactly 1/128. :slight_smile:
However, since your screenshots are from Maya, Im not sure if you need help with maya or 3dsmax now… :slight_smile:

It doesnt. It just lets you snap the geometry to the texels. So, if one of your UV vertices has the coordinates X: 0,015625 Y: 0,0234375, it is at the second pixel on the third row of the lightmap. If your geometry is “off that grid”, a lightmap pixel will overlap two faces with possibly different shading, but the same lightmap pixel. This is what causes bleeding when the shadow is interpolated…

A little bit of both…
In order to snap the UV segments to the “grid”, you need to have:

  • a texture displayed in the UV editor. (Top right dropdown list in the uv editor)
  • enable the snap. This is a little hidden fly-out button the bottom right corner.
    Its important that you have the map displayed, otherwise snap will not work.

Cheers,
Klaus

Your problem might be due to the padding of your UV islands. You will need at least 2 - 4 pixels of padding. If you setup your grid right in Max on your UV texture editor you can actually snap all your UV shells to your grid for perfect alignment and you can give 2 - 4 pixels of padding between your shells to stop that bleeding your having on your model with the lightmaps.

Find out what resolution you want your lightmaps (I would go no higher than 64 px) and divide your resolution by 1 (divide 1 by 64 = 0.015625) the ‘0.015625’ would be your grid size. You will need to snap all your UV shells to the grid, making sure no UV shells fall between the grid lines. You can downscale your UV layout looking at the screenshots above your shells seem a bit big for a lightmap, remember this isn’t a texture UV layout, your shells don’t have to be big to get a better resolution as long as your snapping your UV’s to your grid and giving the correct padding you will have super clean lightmaps :slight_smile:

One more thing to note once you have fixed your grid size and snapped all your islands downscale your UV shells and make sure between each shell there is 2 grid spaces there (that would be 2 px padding for your islands). Hope that helps man, lightmaps are a nightmare lol

128 is low for that mesh and 256 isnt a lot really. You’d probably need at least 1024 for that mesh back in UDK but UE4 gives better results with less resolution so dont worry about it.

Your UVs are laid out using automatic unwrapping? Because it looks like that and I find it yields the worst results. Ideally you’d have it done by hand with way fewer islands with some of them sharing same edge etc. And I wouldn’t spend so much time trying to get spacing correct etc. It used to be a bit of a nightmare in UDK but in UE4 I never really had any issues with incorrect spacing or anything like that. At the moment I unwrap my assets for normal texturing and then adjust UVs (if needed) for 2nd channel and in most cases they work great.

I want to mention that apparently the correct math for your lightmap grid size isn’t 1/the lightmap resolution. The reason for this is because the engine uses a 1 pixel border for filtering meaning that on a resolution of 128 for example, you’re actually losing 2 pixels from the width and the height. So you need to use 1/126 to get the correct grid size which is actually 0.00793650. https://www.reddit.com/r/UE4Devs/comments/246whl/the_most_important_thing_about_lightmaps/

Hi, i dont want to multiply topics so i’ll ask here:
I have small question about light map preparation process.
Lets say i have long rectangle and thinn lightmap uv
(stairs) And here is the question:
Should i unwrap one stair on square uv space leaving 5/6 space empty because in udk4 engine will pack whole lightmap uvs into one big (or more) textures. OR
Duplicate my stair into full set of stairs and then unwrap and pack it on single squere uv (filling rectangle uv area)
Which workflow is correct?