Blender Addon for lightbaking

Great addon from Naxela called The Lightmapper simplifies the process. Download the addon here and install it using the Blender Prefs

Make a simple scene with a cube and plane to test
Join the cube and plane (select both ctrl J)

Select the Cube and under Cube Properties look for The Lightmapper, and tick enable lightmapping. Here set the reslution of the lightmap e.g 1024

Under Render Properties look under The Lightmapper. Set the resolution scale to 1/1. Quality can be bumped up too but will really hit bake times. Tick Denoise too.


Then choose Build Lightmaps

The Explore lightmaps button shows the directory containing the lightmap. The addon creates a material for the cube or appends the current mat with the lightmap.

if I look at my scene here I can see the bake result:

and the denoised map looks like this:

but to export I need to riddle a little. Look under the shading window and you can see that a lightmap UV has been added. To get this mesh to export using the material properly, you need to set the material to use the  lightmap UV (instead if the regular UV). So under the object data properties under UV map, delete UV map. Then export  for example I’m using gltf format for Hubs.

 

Now I’ve gone back a step and deleted all the materials, clicked the Clean Lightmaps button and made a new material with a brick texture and redone the UV like this

The uv’s look like this:

..and the brick material looks like this:

So I repeat the process for lightbaking and that basically appends the lightmap into the brick texture.

…now we have to do a bit of jiggery-pokery to get it to export correctly.

First get the Hubs blender exporter from here  and install it.

Then we need to set the lightmap to use the Moz Lightmap node
Delete the Principled BSDF node and instead use a Background node.

Find a Background node in the World  setting here:

set it up like this, my brick texture is the background and so it won’t get or use any lighting in Hubs.

..the lightmap is using the UVMap_Lightmap (channel 2) whereas the texture is using  the uv from channel 1
To export as a gLTFmake sure the gltf settings are using Hubs Components…

 

And here it is in Spoke – with baked lightmaps.