I'm baking an indirect lightmap, but the result is terrible (as you can see on the ground). There are big white blocks, and one area on my object is missing, so you can see the inside of the object.

What could be the reason? I've tried to change some values in the inspector, to no avail. The current object is about 10 * 15 units.

  • \$\begingroup\$ How big is your floor plane? \$\endgroup\$ – DMGregory Jan 11 at 14:55
  • \$\begingroup\$ 30*30 Units, scale it down? \$\endgroup\$ – Dew Jan 11 at 15:11
  • \$\begingroup\$ With a 1024x1024 lightmap, a 30x30 object can only get about 34 pixels per unit - roughly a quarter of the 128 you seem to be aiming for. Have you considered using larger lightmaps, or shrinking the surface area you're trying to bake lighting for? \$\endgroup\$ – DMGregory Jan 11 at 15:17
  • \$\begingroup\$ I shrink it and waiting to see the result, by the way, why part of my surface gone missing you can check my screen shot \$\endgroup\$ – Dew Jan 11 at 15:27
  • 1
    \$\begingroup\$ That likely has nothing to do with lightmapping. Do you see that part of the surface if you move the camera to the other side? If so, then you probably need to correct the winding of those polygons in your 3D modelling software, to flip them to face outside instead of inside. \$\endgroup\$ – DMGregory Jan 11 at 15:33

After a little digging and trying, I found that it was caused by the plane being too large (about 300 * 300 units), which means a resolution of 2048 * 2048 will be stretched out along the whole mesh.

Let's do the math. I set the texel to be 64, then 64 * 64 will be the total amount of blocks inside one unit. The size of my light map (2048 * 2048), can only accommodate 2048 / 64 = 32 units long. Then the 32 units will wrap the 300 units mesh, thus resulting in a bad look.

  • \$\begingroup\$ Unity won't wrap the lightmap around your object multiple times (repeating patterns of light and shadow on its surface). Instead it will shrink your object's lightmap UVs until they fit inside the lightmap (effectively stretching the lightmap) so you get blockier results than the 64 texels per unit you were aiming for. \$\endgroup\$ – DMGregory Jan 12 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.