Archimatix (AX) can prepare the models it creates for Unitiy’s Global Illumination (GI) , both realtime and baked. Since AX generates models frequently as parameters are modified, the system makes some assumptions about when in your workflow you are ready to have Unity render the metadata that supports GI.

Voila_Capture 2016-08-21_04-20-15_PM

Arch with Global Illumination

General Workflow

Depending on the complexity of the model, pre-computation for Unity’s GI lighting  can take a significant amount of time (to say the least!). By default, Unity tries to initiate this computation any time it senses that static meshes in the scene have been transformed, added or deleted. Although useful in many cases, this default mode of building the lighting model becomes burdensome when modeling with Archimatix, since, as you drag parameter AX handles in realtime, you are usually regenerating hundreds of meshes per second. Even after you stop dragging and AX generates actual GameObjects, you are likely to keep on modifying and tweaking parameters. While this fluid mesh generation is part of the magic of AX, such rapid changes set the  automatic lightmap build into unnecessary overdrive. There are two ways to avoid this this situation.

The first way to avoid unnecessary computation while modifying the parameters of a model is to simply turn the Auto build mode off. This is done by opening the Unity Lighting Window and unchecking the “Auto” checkbox, as show in the image to the right. With Auto off, you can modify AX meshes to your hearts content with out setting off the lighting computation. When you are ready to see the model rendered with GI, click the manual “Build” button to the right of the “Auto” checkbox.

However, if you have a preference to leave “Auto” on, then you can temporarily  disable Lightmap Static flags for your entire AX model by making sure the Lightmap Flags Enabled checkbox in the Inspector for the model is off. This means that, as AX generates GameObjects with meshes, it does not add the Lightmap Static flag to the the GameObjects and the light mapper will not be aware of the changes to the mesh. With this approach, you can model as much as you like, and then when ready to see it rendered with GI, you can click the Lightmap Flags Enabled checkbox.

Note: The Lightmap Flags Enabled parameter for the model is off by default. This means that, when you first create an AX model, you must check this to on before building the lighting.

Once you have finished a session of modeling and tweaking, and you are ready to take a coffee break, you can click the  “Lightmap Flags Enabled” checkbox in the Inspector for the model. If “Auto” is on, the light mapping will shift into high gear. Otherwise, after checking Lightmap Flags Enabled go to the Lighting window and click on the Build button.

In either mode, when the lighting model is being built, it will only take into consideration the objects that have been generated by nodes that have been designated as Lightmap Static, as we shall see next.

Lightmap Static Flags

If a AX ParametricObject, such as the Extrude_9 in the figure to the right, is set to LightmapStatic (red arrow), then when a GameObject gets generated AX, its static flag will be set to Lightmap Static (so long as the Lightmap Flags Enabled is checked when the model is built), and the Unity GI system will treat it as such when rebuilding. This static flags setting is analogous to the flag options for any GameObject in Unity, with the difference being that the flag is set internally in the AX node and transferred to GameObjects when they are built by AX.

When you set the static flag for a node, all its upstream nodes will be set to the same flags.

Secondary UVs for Baking

If you have selected Baked GI in the Unity Lighting Window, then you will want to have SecondaryUV’s generated for the meshes created by Archimatix. Since generating these extra UVs, which are used by the Unity lighting model to created rendered lightmaps, takes some extra computation, you must recreate the secondary UVs each time you bake the lighting.

The checkbox called Create Secondary UV’s appears only after the Lightmap Flags Enabled checkbox has been checked. When you check it, the Secondary’s will be generated for any meshes generated by nodes that have had their flags set to Lightmap Static..

Even if you check the Create Secondary UV’s, this box will become unchecked after the AX model has finished one of its frequent builds.