#Weirdly stretched lightmap

1 messages · Page 1 of 1 (latest)

sharp obsidian
#

The lightmap on my wall looks stretched, and I don’t know how to fix it. I’m using Unity’s automatically generated lightmap UVs.

#

This is a screenshot of the wall in Blender, showing the geometry I exported to Unity. The issue appears after baking lightmaps in Unity, but in Blender the wall looks fine.

jaunty orbit
sharp obsidian
#

So what should I do?

#

Should I generate a lightmap in Blender?

jaunty orbit
#

It's still very inefficient topology for lightmap UVs even if force it to work

#

I'd make vertical cuts on both sides of each door for quad topology

#

No geometry seams, just splitting the face into more edges

sharp obsidian
#

like this?

jaunty orbit
sharp obsidian
#

But if i checked triangulate faces option when exporting model it kinda worked

#

only the area above the doors is broken

jaunty orbit
#

Doesn't look broken

sharp obsidian
#

the lightning is darker above the doors

jaunty orbit
#

Not "broken" broken
It's expected that lightmap texels from different UV regions can be different
Unless Stitch Seams is enabled and there's enough lightmap space for the necessary variance

#

But in your case the UV island is barely bigger than one lightmap texel

#

Meaning the lightmap resolution is incredibly low

#

If the resolution you're baking at is lower than minimum lightmap resolution in mesh lightmap UV generation settings, then leaking will occur and make that kind of problem worse

sharp obsidian
#

I can try baking at higher resolution

jaunty orbit
#

What is the resolution

sharp obsidian
#

I was testing on 256

#

and 20 texels

jaunty orbit
#

How tall is the hallway in unity units?

sharp obsidian
#

but i never heard about stitch seams

sharp obsidian
jaunty orbit
sharp obsidian
#

it's around 3 units

jaunty orbit
sharp obsidian
#

here's the new image

#

it's 40 texels per unit

jaunty orbit
#

That would mean the texels on the floor and walls actually have a effective resolution closer to 0.5 or less

#

Logically if the wall heightwise has just one and a half lightmap pixels, it can't accurately represent shadows and the pixels will be cut off by UV seams too

#

That typically occurs when you export meshes in wrong scale

sharp obsidian
#

i have noticed something

#

i can cause the issue

#

my wall for some reason is at scale 100 100 100

jaunty orbit
#

The reason is exporting meshes in wrong scale

#

Possibly unapplied transforms but more likely wrong fbx unit scale

sharp obsidian
#

transforms are applied

#

how can i set fbx unit scale

jaunty orbit
sharp obsidian
#

i am exporting my mesh with this settings

jaunty orbit
#

Use the settings detailed in the article
Or use an export script/plugin that does it right

sharp obsidian
#

i exported the model and now the walls have scale of 1

jaunty orbit
#

When the lightmap resolutions aren't totally wrong because of object scale, next pay attention not to bake with lower resolution than the lightmap UV generation defines as minimum

#

40 is considered relatively high resolution

sharp obsidian
#

okay

#

I will try to bake the light and check if the problem is solved

jaunty orbit
sharp obsidian
#

it's better i guess?

#

stitch seams is enabled

#

Okay, I fixed the issue by removing the additional cuts I had made before.

#

Anyway, @jaunty orbit , thank you for helping and for spending your time.

jaunty orbit
#

If the whole wall can fit in the lightmap UV space without having to have its size changed, it's as good as solved

#

But eventually you'll need to place seams like that in some places
In that case it'll be an important to know how to avoid light bleeding issue like that and to investigate its causes