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 =newRuntimeExporter();Dictionary<Material,Material> replacedMaterials =newDictionary<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 existsif (replacedMaterials.ContainsKey(original)) { copy =replacedMaterials[original]; // return the replacementDebug.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 =newRuntimeExporter();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 EgoTriggersLinkedTour linkedTour =tourGO.GetComponent<LinkedTour>();List<EgoTrigger> tourStops =newList<EgoTrigger>();foreach ( Transform child inprefab.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 tourtourStops.Add( child.GetComponent<EgoTrigger>() ); }}// Add all EgoTriggers in the desired order to the Linked TourlinkedTour.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.
publicclassCustomExporter:RuntimeExporter{publicoverrideboolExportObject(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 =newCustomExporter();// 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 =newCustomExporter();// Create a custom LayerMaskLayerMask customLayerMask =newLayerMask();customLayerMask =CustomExporter.AddLayerToMask(customLayerMask,"Default");// Assign the LayerMask to the exporterexporter.CustomLayerMask= customLayerMask;// Start the exportexporter.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 =newCustomExporter();// Gather all objects you want to exportList<Transform> objectsToExport =newList<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 parentexporter.ExportObjects(objectsToExport.ToArray(),"Example", exportPath);
2. Changelog
v1.0.8
Fix: UV export
v1.0.7
Fix: export of compressed textures
v1.0.6
Fix: export of compressed textures
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)