Aura™ Unity 3D SDK (29.10.2020)

SDK for Unity3D which allows to export GameObjects and Scenes as Vuframe .aura3d in order to use it with Vuframe® Studio.

1. Getting Started

Import the .unitypackage into your project. The SDK is developed and tested with Unity 2019.3.14.f1.

Simple Runtime Export

using AuraExport.Exporters.Aura3D;
public class ExportTest
{
public GameObject prefab;
public void Export()
{
string exportPath = Path.Combine(Application.dataPath, "..", "runtime_export", "test");
new Exporter().ExportScene(objectToExport, exportPath);
}
}

Custom Shader Mapping

Vuframe® only supports Unity 3D's built-in shaders. You can still use custom shaders in your Unity 3D project. When exporting your model you can use a delegate method to update your materials to built-in shaders. See the example below.

You need to manually translate the look and feel for your materials to the closest approximation that can be achieved with a built-in shader.

var exporter = new RuntimeExporter();
Dictionary<Material, Material> replacedMaterials = new Dictionary<Material, Material>();
exporter.SetUnsupportedShaderMaterialHandler(delegate (Material original)
{
Debug.LogWarning(original.name + ": Processing Material...", original);
Shader customShader = Shader.Find("Custom/SomeCustomShader");
if (original.shader == customShader)
{
Material copy;
// check if a replacement already exists
if (replacedMaterials.ContainsKey(original))
{
copy = replacedMaterials[original];
// return the replacement
Debug.Log(copy.name + ": using replacement material", copy);
return copy;
}
// create replacement
copy = Material.Instantiate<Material>(original);
copy.name = original.name + "_fixed_shader";
copy.shader = Shader.Find("Standard");
Debug.LogWarning(copy.name + ": replaced shader in material", copy);
replacedMaterials[original] = copy;
return copy;
}
return original;
});
GameObject objectToExport = Instantiate(prefab);
exporter.ExportObject(objectToExport, exportPath);
Destroy(objectToExport);

EgoTriggers and LinkedTours

Simply add 'EgoTrigger' Components too all GameObjects you want us as steps for your linked tour. You can then add a LinkedTour component to another GameObject and assign all EgoTriggers in the desired order as 'tourStops'. By default, Egotriggers have a fixed eye height of 1.62m which means that if the object is played on the ground, the ego trigger will be shown in a height of 1.62m.

var exporter = new RuntimeExporter();
GameObject tourGO = prefab.transform.Find("Tour").gameObject;
if (tourGO.GetComponent<LinkedTour>() == null)
{
tourGO.AddComponent<LinkedTour>();
}
// The LinkedTour Component is used to store the order of the included EgoTriggers
LinkedTour linkedTour = tourGO.GetComponent<LinkedTour>();
List<EgoTrigger> tourStops = new List<EgoTrigger>();
foreach ( Transform child in prefab.GetComponentsInChildren<Transform>(true) )
{
if (child.name.StartsWith("ego_"))
{
if (child.gameObject.GetComponent<EgoTrigger>() == null)
{
child.gameObject.AddComponent<EgoTrigger>();
}
// Add the 'EgoTrigger' Component to all GameObjects that you want to use as steps in your virtual tour
tourStops.Add( child.GetComponent<EgoTrigger>() );
}
}
// Add all EgoTriggers in the desired order to the Linked Tour
linkedTour.tourStops = tourStops.ToArray();
exporter.ExportObject(prefab, exportPath);

Custom Exporter examples

You can extend the exporter class in order to pre-process (e.g. filter) objects before export.

public class CustomExporter : RuntimeExporter
{
public override bool ExportObject(GameObject targetObject, string path, Hashtable properties = null)
{
// Your implementation
}
}

The example project includes several sample scenes:

Skip deactivated objects

Exports only active objects. Please note that this will also affect the child objects.

var exporter = new CustomExporter();
// By default, all child objects (active and inactive) are getting exported.
// We only want to export enabled objects.
exporter.ExportDisabledObjects = false;
exporter.ExportObject(prefab, exportPath);

Export only objects on specific layer

Export only objects which are on a specific layer. Please note that this will also affect the child objects.

var exporter = new CustomExporter();
// Create a custom LayerMask
LayerMask customLayerMask = new LayerMask();
customLayerMask = CustomExporter.AddLayerToMask(customLayerMask, "Default");
// Assign the LayerMask to the exporter
exporter.CustomLayerMask = customLayerMask;
// Start the export
exporter.ExportObject(prefab, exportPath);

Export multiple objects as one scene

You can also export multiple objects as one scene by passing an array of transforms. Those tranforms need to be root objects in the current scene.

var exporter = new CustomExporter();
// Gather all objects you want to export
List<Transform> objectsToExport = new List<Transform>();
objectsToExport.Add( object1 );
objectsToExport.Add( object2 );
objectsToExport.Add( object3 );
// Start the export by passing an array of objects and provide a name for the parent
exporter.ExportObjects(objectsToExport.ToArray(), "Example", exportPath);

Editor Import

2. Changelog

  • v1.0.5

    • Fix: export of non readable textures

  • v1.0.4

    • Material Emission flag is now supported

    • support for Skinned Mesh Renderer

    • Fixed an issue where textures were compressed during export

    • fixed alpha cutout problem

  • v1.0.3

    • support for custom layers

  • v1.0.2

    • implemented automatic preview image generation

    • added option for custom shader mapping (see example scene)

    • support for EgoTriggers and LinkedTours (see example scene)

    • removed unnecessary dependencies

    • removed export of duplicate assets

  • v1.0.1

    • introduced export format Aura 3D (.aura3d)

    • updated examples scenes

    • Support for static preview images (see example scene)

    • Reduced the number of dependencies

  • v1.0.0

    • initial Release

3. Known Issues