Difference between revisions of "How do I..."

From Bakery GPU Lightmapper: Wiki
Jump to navigation Jump to search
(How can I trigger the bake via scripting?)
(How can I trigger the bake via scripting?)
Line 33: Line 33:
 
=== How can I trigger the bake via scripting? ===
 
=== How can I trigger the bake via scripting? ===
 
There are 3 steps involved:
 
There are 3 steps involved:
* Get the render settings object:
+
 
 +
1. Get the render settings object:
 
{{code|<nowiki>ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();
 
{{code|<nowiki>ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();
 
</nowiki>}}
 
</nowiki>}}
  
Modify the settings. Full list can be seen in ftLightmapsStorage.cs. As an example, here is how you can limit the amount of bounces and set the output folder:
+
2. Modify the settings. Full list can be seen in ftLightmapsStorage.cs. As an example, here is how you can limit the amount of bounces and set the output folder:
storage.renderSettingsBounces = 2;
+
{{code|<nowiki>storage.renderSettingsBounces = 2;</nowiki>}}
storage.renderSettingsOutPath = "MyFolder";
+
{{code|<nowiki>storage.renderSettingsOutPath = "MyFolder";</nowiki>}}
          Create Bakery instance, load the settings and bake:
+
 
      ftRenderLightmap bakery = new ftRenderLightmap();
+
3. Create Bakery instance, load the settings and bake:
      bakery.LoadRenderSettings();
+
{{code|<nowiki>ftRenderLightmap bakery = ftRenderLightmap.instance != null ? ftRenderLightmap.instance : new ftRenderLightmap();</nowiki>}}
      bakery.RenderButton();
+
{{code|<nowiki>bakery.LoadRenderSettings();</nowiki>}}
 +
{{code|<nowiki>bakery.RenderButton();</nowiki>}}

Revision as of 09:52, 30 May 2019

How do I make a lightmapped prefab?

See Lightmapped Prefab component.

How do I use git/collab/other version control system with Bakery?

First, make sure all machines have the same version of Unity and Bakery.

Unity 2017.1 or newer:

You should commit:

  • Any updated assets unrelated to Bakery.
  • All updated *.meta files.
  • Lightmap textures.

You should not commit:

  • Bakery folders.

Pre-2017.1 versions of Unity:

  • Also commit ftGlobalStorage.asset.

If UVs don't look right, right click affected models and click Reimport.

How do I share a scene with someone who doesn’t have Bakery installed?

Apart from the scene and its lightmaps you also have to include a few scripts, namely:

  • ftLightmaps.cs
  • ftLightmapsStorage.cs
  • ftLocalStorage.cs
  • ftGlobalStorage.cs
  • ftModelPostProcessor.cs

How do I bake using my own UVs without any alterations to them?

Check out Lightmap Groups ("Original UV" mode).

How can I trigger the bake via scripting?

There are 3 steps involved:

1. Get the render settings object:

ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();

2. Modify the settings. Full list can be seen in ftLightmapsStorage.cs. As an example, here is how you can limit the amount of bounces and set the output folder:

storage.renderSettingsBounces = 2;
storage.renderSettingsOutPath = "MyFolder";

3. Create Bakery instance, load the settings and bake:

ftRenderLightmap bakery = ftRenderLightmap.instance != null ? ftRenderLightmap.instance : new ftRenderLightmap();
bakery.LoadRenderSettings();
bakery.RenderButton();