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

1
using AuraExport.Exporters.Aura3D;
2
3
public class ExportTest
4
{
5
public GameObject prefab;
6
7
public void Export()
8
{
9
string exportPath = Path.Combine(Application.dataPath, "..", "runtime_export", "test");
10
11
new Exporter().ExportScene(objectToExport, exportPath);
12
}
13
}
Copied!

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.
1
var exporter = new RuntimeExporter();
2
3
Dictionary<Material, Material> replacedMaterials = new Dictionary<Material, Material>();
4
5
exporter.SetUnsupportedShaderMaterialHandler(delegate (Material original)
6
{
7
Debug.LogWarning(original.name + ": Processing Material...", original);
8
Shader customShader = Shader.Find("Custom/SomeCustomShader");
9
if (original.shader == customShader)
10
{
11
Material copy;
12
// check if a replacement already exists
13
if (replacedMaterials.ContainsKey(original))
14
{
15
copy = replacedMaterials[original];
16
// return the replacement
17
Debug.Log(copy.name + ": using replacement material", copy);
18
return copy;
19
}
20
21
// create replacement
22
copy = Material.Instantiate<Material>(original);
23
copy.name = original.name + "_fixed_shader";
24
copy.shader = Shader.Find("Standard");
25
Debug.LogWarning(copy.name + ": replaced shader in material", copy);
26
replacedMaterials[original] = copy;
27
return copy;
28
}
29
return original;
30
});
31
32
GameObject objectToExport = Instantiate(prefab);
33
exporter.ExportObject(objectToExport, exportPath);
34
Destroy(objectToExport);
Copied!

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.
1
var exporter = new RuntimeExporter();
2
3
GameObject tourGO = prefab.transform.Find("Tour").gameObject;
4
5
if (tourGO.GetComponent<LinkedTour>() == null)
6
{
7
tourGO.AddComponent<LinkedTour>();
8
}
9
10
// The LinkedTour Component is used to store the order of the included EgoTriggers
11
LinkedTour linkedTour = tourGO.GetComponent<LinkedTour>();
12
13
List<EgoTrigger> tourStops = new List<EgoTrigger>();
14
15
foreach ( Transform child in prefab.GetComponentsInChildren<Transform>(true) )
16
{
17
if (child.name.StartsWith("ego_"))
18
{
19
if (child.gameObject.GetComponent<EgoTrigger>() == null)
20
{
21
child.gameObject.AddComponent<EgoTrigger>();
22
}
23
24
// Add the 'EgoTrigger' Component to all GameObjects that you want to use as steps in your virtual tour
25
tourStops.Add( child.GetComponent<EgoTrigger>() );
26
}
27
}
28
29
// Add all EgoTriggers in the desired order to the Linked Tour
30
linkedTour.tourStops = tourStops.ToArray();
31
32
exporter.ExportObject(prefab, exportPath);
Copied!

Custom Exporter examples

You can extend the exporter class in order to pre-process (e.g. filter) objects before export.
1
public class CustomExporter : RuntimeExporter
2
{
3
public override bool ExportObject(GameObject targetObject, string path, Hashtable properties = null)
4
{
5
// Your implementation
6
}
7
}
Copied!
The example project includes several sample scenes:
Skip deactivated objects
Exports only active objects. Please note that this will also affect the child objects.
1
var exporter = new CustomExporter();
2
3
// By default, all child objects (active and inactive) are getting exported.
4
// We only want to export enabled objects.
5
exporter.ExportDisabledObjects = false;
6
exporter.ExportObject(prefab, exportPath);
Copied!
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.
1
var exporter = new CustomExporter();
2
3
// Create a custom LayerMask
4
LayerMask customLayerMask = new LayerMask();
5
customLayerMask = CustomExporter.AddLayerToMask(customLayerMask, "Default");
6
7
// Assign the LayerMask to the exporter
8
exporter.CustomLayerMask = customLayerMask;
9
10
// Start the export
11
exporter.ExportObject(prefab, exportPath);
Copied!
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.
1
var exporter = new CustomExporter();
2
3
// Gather all objects you want to export
4
List<Transform> objectsToExport = new List<Transform>();
5
objectsToExport.Add( object1 );
6
objectsToExport.Add( object2 );
7
objectsToExport.Add( object3 );
8
9
// Start the export by passing an array of objects and provide a name for the parent
10
exporter.ExportObjects(objectsToExport.ToArray(), "Example", exportPath);
Copied!

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

Last modified 11mo ago