Blender Lightmap Problems

Hello,I am trying to make meshes in blender and import them to ue4,and some of them end up with weird shadow bleed,I am kinda new to modeling so i probably done something wrong,the thing is,that i saw many videos\posts on this subject and i yet to find a proper answer for my problem,its even harder when most of the detailed tutorials are for Maya,and although i saw them,didn’t help me as much as i thought.

Anyway,here are the pictures of the mesh inside Ue4(before and after build):


and in blender (two objects with two different lightmaps and uvs,i tried combining them,but it yields bad results):

Thanks in advance.

The after image didnt open for me.
But probably the problem is that the shadow information in the lightmap bleeds out to other faces.
That happens when the gap between the uv islands is too small.

You have 2 solutions:

  • Increase the gap betweern the uv islands in your uv. Then reimport that mesh in unreal and use that uv for lightmap calculations (dont let unreal create a lightmap uv at import)
  • Increase the lightmap resolution. This one should be used with caution because it affects performance.

You can use a combination of the two methods, until you get a good result.

But, as i have some experience with that, you may get some shadow bleed from time to time.
When you get all the scene together, with normal maps and occlusion, its hard to notice the shadow bleed .

I already tried that,but the problem persists.
ill upload the picture agian:

i also forgot to mention that the shadow itself becomes twisted,and not only the mesh itself.

Seeing the image looks like a bleed problem. I got this problem one time and increasing the lightmap resolution solved.
Did you try increasing the lightmap to a very high valeu just to see if
something changes?

I can see in your uv all faces are separated as islands… You should try to merge some islands. Like the main branch of the tree. Theres no reason to have 1 uv island for each face.

I would say that maybe the normals of some faces are twisted… When the face are full dark…

Besides the lightmap and uv issue, I dont know what that could be…

you have way too many uv islands, which wastes most of your texture data on padding, and creates islands thinner than a pixel in lightmap resolution.

break the object down into cylinders and spheres, unwrap each cylinder with a single UV island, and unwrap each sphere with 2 islands, splitting the sphere into top and bottom halfs.

its kinda hard for me to understand,you mean that i should separate parts of the mesh into objects(branches from bark and so on) in the shapes that you described?

and by unwrapping with single islands,do you mean marking seams and manually unwrapping?

i am still getting the hang of blender so its kinda hard for me >_<

setting the resolution to a very high value did make the bleed disappear,though the shadow itself still looks twisted,and its probably wont be performance wise to use the resolution in that amount.
ill try to decrease the amount of islands.

Did you check the normals inside blender ? (In Editmode: Ctrl + N / Shift + Ctrl + N)

Tried it now,sadly it didn’t help >_<

you don’t have to physically separate the meshes or split them into separate objects, i meant you should treat each of those parts as separate uv islands.

blender’s lightmap pack will break every face into individual islands, which means each face will need to waste extra space on padding.

instead of lightmap pack, try using smart uv project with an angle between 60 and 80, with island margin of 1. if that still doesn’t give great results, mark edges with seams and manually unwrap, so that you can make better use of the texture space.

if you are still getting problems after all of that, increase the padding between islands, or increase the lightmap resolution of the mesh in ue4.

but if you did want to break the model into separate meshes, it might help you create more variety. with separate meshes for a trunk, a branch, and a sphere, you could make a blueprint with a construction script that uses random numbers to add variation to the orientation and scale of spawned instanceStaticMeshes. basically, you would be making a simple version of speed tree in ue4.

or, if you wanted to skip the coding part, you could just place those tree parts in the level, and when you build a tree you want to reuse, you can convert those meshes into a blueprint, which you can reuse anywhere.

Reducing your uv island might do the trick. Like Scott told.

using this method really reduces the amount of bleed,though there still is a small amount of bleed, i did “smart uv project” as you said,and then i packed islands.

I tried to mark seams and do a normal unpacking,but it didn’t yield good results,i probably didn’t mark them properly,ill just try it differently now.

This is the result:

for some reason the shadow itself is still twisted,and i have no idea why,it happens with different meshes too (even the engine defaults ones).

i really liked the idea that you can create a verity of trees with multiple meshes,i think i will try it too,and i will try to create uvs as you said, im starting to understand the uv packing much better with your information!

if there is still a small amount of bleed, and its visible from your in game view, you can increase the uv padding in blender, by using PackIslands with a larger margin.

the twisted bumpy shadows on the floor is a different problem, caused by the lightmap resolution of the floor mesh. if you increase the lightmap resolution of the floor, it should solve that problem. lightmap resolution affects how well an object receives shadows, but doesn’t affect how an object casts shadows. each of those bumps in the floor shadow is actually the size of a single pixel in the lightmap of that floor mesh.

Wow! thanks a ton! the mesh looks much better now!
Not only you solved my problem,you taught me new things!
Thanks for the help!