LightBaking in Blender for Mozilla Hubs

This is a quick scan thru’ the video here to extract the salient features!

In the shading settings add an Environment Texture to the WORLD. This will form the basis of lighting. You can get free equirectangular HDRIs from  www.HDRIhaven.com. (The build-in Blender ones don’t affect rendering.) You can of course add lights too.

You also need to set up the renderer, swapping from the built in Eevee to the Cycles render engine. If you are lucky and have a Nvidia card then in you can turn on Denoising. This gets rid of the grainy image. In Blender 2.9.1 this seems to be automagically switched on. Cycles is CPU only, however.

Objects in you scene will need to have textures and be UV mapped..

You will also need to add some Lightmap UV’s too.

Add a new Uvset by hitting plus and call it LightmapUV or similar. For Hubs important that its the second set.

in the 3d window swap to Edit mode, hit Faces Select and A to select all faces Under UV choose Lightmap pack. You can bump the lightmap Image size up to 1024.

Back in the material make a new image, call it LigthmapBake_Start. I’m making mine 2048.

 

Add a UV Map node and set it to use the LightmapUV we made earlier….then make sure LightmapBake_Start is selected  -it needs to be selected to bake properly.

Back in render settings set Bake Type to de diffuse and uncheck colour. Then hit BAKE. You can adjust Sampling / Render to be lower values for testing.  It may take a while to bake.

Then you should see your rendered lightmap. You need to save this rendered image, so click on Image* and choose Save image As….

…in the Save Image dialogue set the Compression to 0%

 

The baked lightmap may be very grainy or noisy. So let’s open the Compositing tab (you may have to tick Use Nodes). Add an image and get your BakedLightmap

 

Add a Despeckle and Denoise filter and a Viewer to see a preview in the background of the window.

 

Edit the Output Properties to set the rendered image to be square, I’m choosing 2048×2048

Then Render and finally save the image as Lightmaps_final.

Now get and install the Hubs Blender Exporter

in the Material swap the image for Lightmaps_final and hook up to a MOZ_Lightmap (in this image it insisted to use Render Result001 as the name when I selected Lightmaps_final )

Also swap the Principled BSDF node for a Background node – Background is under World not Object, copy and paste it here.

Now export as GLTF and you can get it into Spoke.

Avatar photo

About Gibson/Martelli

British electronic arts duo Gibson/Martelli make live simulations using performance capture, computer generated models and an array of technologies including Virtual Reality. Artworks of infinite duration are built within game engines where surround sound heightens the sense of immersion. They playfully address the position of the self in relation to technology, examining ideas of player, performer and visitor -intertwining familiar tropes of video games and art traditions of figure & landscape. www.GibsonMartelli.com