Hubs-Foundation / hubs-blender-exporter

The Hubs Blender Add-on enables artists to export their creations to the immersive web with Hubs
Mozilla Public License 2.0
165 stars 50 forks source link

Operator to automatically bake lightmaps for selected objects. #281

Open GottfriedHofmann opened 7 months ago

GottfriedHofmann commented 7 months ago

Added an operator that bakes lightmaps using Cycles for all selected objects that have at least one material. It uses UV slot 1 for the lightmap and creates the slot if not present already. It also automatically creates the required MOZ_Lightmap nodes and wires them correctly. If a MOZ_Lightmap node is present, the addon assumes that the user has taken care of the correct setup and bakes directly. Baking happens using the Cycles render engine. The created lightmaps are saved as .hdr to Blender's temporary directory, packed and then removed to keep the user's system clean. The new operator can be found in the Object Properties Editor in a new Panel "Hubs Lightmap Baker" image

GottfriedHofmann commented 2 months ago

I have created this addon with PR https://github.com/Hubs-Foundation/hubs-blender-exporter/pull/48 in mind. My addon currently uses the following logic: Is a material present but no lightmap? - build the lightmap setup Is a material with lightmap present? - assume the user has set up the light map correctly and re-bake.