Bake light into texture

Hello evereyone, I have a mesh with a big texture atlas, I’d want to bake lights in the original texture, and get the original texture and the one with the lights. How can I do this, beacuse I tried and this is the result with the original texture and the lights not bakes


And thi is the result making the bake in the original’s texture copy:
.
Also I’d want to include in the texture baked the lights from the HDR that I used in the viewport.

You need two UV here:

  • one for the texture atlas (with overlapand re-use) and
  • a second for the backed environment light with no overlaps and maybe bigger…

You will have to mix the texture form the texture atlas and the env-light-tex acccordingly… so build up a shader for this too.

Unfortunately due to very big dimensions of the mesh and texture atlas(about 16x16) when I try to create the for UV, blender doesn’t respond anymore.
Any solutions?

So if you build a modell too big four your computer (RAM and performance) then… you have to split it somehow… or make it smaller in the first place… because how do you want to handle the complete scene ??

Maybe the question is… why do you want to bake the light. Aren’t any light possibly in you target ??

The facts is that I need to import it in Unreal Engine, using Nanite(it will not be a RAM problem), so when I make the build of the lights in Unreal it is wired beacuse of UV problems with the one generated in Unreal. This is why I need to make it in blender.

Just try unwrapping not everything at once…

Separate it into manageable pieces and unwrap then.

Out of curiosity: why you need an old school and simple lighmap if you would use nanite?
I can get into something like “we use one of the most graphic advanced engine to make game which would look like PS3”, but normally something like that simply doesnt need nanite at all.
Is it just for renders of something?

If I understand what you want…
You should be able to Bake a Combined map with Direct and Diffuse selected, which will Bake the lighting data to a Diffuse Image…


The only problem with this is it bakes the Lighting on the objects but it also bakes in the Shadows…

And a second Bake as Diffuse but only Color selected…

I guess you could also bake just the emissive and use that with an emissive shader ?

I have to use Nanite because I have very big meshs, and I have to use thousands of static spot lights, so i need to bake it.
Basically my scene is a city and I need to make “night lights” but when I bake the lights in Unreal the result is this one:


All those lights in the buildings are not wanted and a warning says to me that there are UVs overlapping

no I want to bake lights in a texture image

Is the entire city a single mesh? If yes, there is no way this is going to work well in Unreal.

I have made large environments in Blender like this for Unreal. The way I did it is to split it in to multiple sections. That way, each section can have lightmap UVs that are of a reasonable size.

Right now, the lightmap UVs probably have thousands of tiny islands and the lightmap’s resolution is just not enough for the whole city. But if you were to split this mesh into, let’s say, 20 objects, each one gets the current lightmap resolution just for itself.

By default, Unreal bakes its lightmaps to the second UV set. You can either make it yourself, or let Unreal unwrap it for you during import if the second UV channel doesn’t exist on the model.

Does Exist some way to divide this mesh, and his texture in automatic way?

Sadly not.

But, I would say it’s not very difficult to do. Just go into top view in Blender, activate X-ray mode and select groups of buildings to split off the model. I think this would just take a few minutes.

Then, for each object you have created, you can make a second UV channel pretty quickly. Lightmaps should work well enough with smart UV unwrap (as long as you use a litle bit of margin), so this step should be pretty easy too.

When exporting the city to Unreal, you can export every model together in a single file, there is an option in Unreal to keep the models split when importing them. You can create a folder in Unreal to put the multiple objects in so they don’t clutter the list. Then, you can select them all and drag them to Unreal’s viewport all at the same time and they will all follow with their proper locations.

Nothing which will lead you to any good results for this particular case.
Best bet is to manually select building one by one and divide it into kind of “district”.

Google Select Linked, Select Coplanar, Separate by Loose part/Separate Selection - those 3 commands would be your best friends for such task.

And how about the texture?

The texture should follow just fine. As long as the existing UVs used for the main textures stay the way they are, they will work the same no matter if the object has been split in sections or not.

I tried in this way, but the fact is that I need something that “cut” the mesh, beacuse in this way the parts between the vertex not selected disappears.

If parts disappear, you must be cutting by deleting vertices. Instead, select the part you want to separate, then use the “p” shortcut or go to this menu.