plattar / gltf-exporter Goto Github PK
View Code? Open in Web Editor NEWUnity3D GLTF2 importer and exporter toolchain
License: Apache License 2.0
Unity3D GLTF2 importer and exporter toolchain
License: Apache License 2.0
Hello! This might be a bit of a longshot, but I've noticed that exporting some varieties of custom materials results in material data being lost. For example, exporting an object that looks like this
results in
I imagine there are limitations to what can be supported by the exporter tool, but I imagine that custom material types such as these are relatively common in Unity projects and that custom materials need to be in some sort of unified format for Unity to recognize and use them.... hoping that there's an implementable solution for this asset that could be applied in the future.
I should mention that regular material assets export just fine.
How do I export 3D models from Unity, including lightmaps? Is it possible to export baked lighting?
I'm looking for a tool that allows you to burn lighting from a 3D scene and save it in glTF format - unfortunately 3DS MAX (with V-Ray) or Unity can calculate great lighting but do not have a glTF exporter ...
Hi,
First of all, thank you for the great plugin.
We were wondering if there is any chances you will implement URP support?
Kind Regards,
Thijs
I export a gameObject with material animation,but didn't with it?what kind of material can i export or how to resulve it?
Trying to figure out what I am doing wrong.. I imported PlattarExporter by double clicking on the unity package downloaded from releases section. I see PlattarExporter in the Assets folder now. But no toolbar as suggest in the screenshot.
I am using Unity 2020.3.27f1 Personal
Am I importing the package incorrectly?
I don't know if im doing something bad or if is the plugin but when i try do export the GLTF this error appears. i'm trying to export in runtime.
Exception: Accessors can not have a count of 0. UnityGLTF.GLTFSceneExporter.ExportAccessor (UnityEngine.Vector3[] arr) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:938) UnityGLTF.GLTFSceneExporter.ExportPrimitive (UnityEngine.GameObject gameObject) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:304) UnityGLTF.GLTFSceneExporter.ExportMesh (System.String name, UnityEngine.GameObject[] primitives) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:263) UnityGLTF.GLTFSceneExporter.ExportNode (UnityEngine.Transform nodeTransform) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:158) UnityGLTF.GLTFSceneExporter.ExportNode (UnityEngine.Transform nodeTransform) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:175) UnityGLTF.GLTFSceneExporter.ExportNode (UnityEngine.Transform nodeTransform) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:175) UnityGLTF.GLTFSceneExporter.ExportNode (UnityEngine.Transform nodeTransform) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:175) UnityGLTF.GLTFSceneExporter.ExportScene (System.String name, UnityEngine.Transform[] rootObjTransforms) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:125) UnityGLTF.GLTFSceneExporter.SaveGLTFandBin (System.String path, System.String fileName) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFSceneExporter.cs:84) Plattar.Exporter.GenerateGLTF (UnityEngine.GameObject selectedObject) (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:247) Plattar.Exporter.GenerateGLTFZipped (UnityEngine.GameObject selectedObject) (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:210) Plattar.Exporter.OnGUI () (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:131) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:367) UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:361) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:337) UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:398) UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:388) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:293) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:508) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:491) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:484) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:477) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:449) UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:77) UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:92) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:310) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:275) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:238) UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:203) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:301) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:159) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:256) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:404) UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:194) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:187)
Hi,
Thank you for this fantastic exporter for Unity
I would know if is possible to export also "Audio Sorce" and not only Animations
If not, is it in develop?
Thanks again :)
I installed the asset over the unitypackage, the new toolbar item is missing and i get two errors:
Assets\PlattarExporter\UnityGLTF\Scripts\GLTFUtils.cs(191,3): error CS0433: The type 'ZipFile' exists in both 'Ionic.Zip.Unity, Version=1.9.1.9000, Culture=neutral, PublicKeyToken=null' and 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c'
Assets\PlattarExporter\UnityGLTF\Scripts\GLTFUtils.cs(191,3): error CS0433: The type 'ZipFile' exists in both 'Ionic.Zip.Unity, Version=1.9.1.9000, Culture=neutral, PublicKeyToken=null' and 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c'
I'm on windows 10 and my Unity version is 2020.2.2f1
I am selecting a proper game object in Unity for export. The GLTF zip only contains the normal map texture along with the mesh and .bin file. The normal map texture appears as a pink image. Not as a usual purple normal map. Also, I expected my baked game object to include the baked look of the asset. I mean, its in Unity, I bake my scene, and select a game object to export as GLTF and expected to see the lightmap in the GLTF version. Is this supported?
Im trying to use GLTF objects from Unity for Babylon.js scenes.
Can I export to gltf a gameobject that is created at runtime? Can I have a reference to said model in memory, and not have to save it?
![01:56:51] Assembly for Assembly Definition File 'Assets/PlattarExporter/Resources/ResourceCompile.asmder will not be compiled, because it has no scripts associated with it.
! UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,stringfl)
!(01:56:53] Assets\PlattarExporter1UnityGLTF Scripts1GLIFScenelmporter.cs(103,18): warning CS0618: 'UnityWebRequest.Sencl(l is obsolete: 'Use SendWebRequest. It returns a UnityWebRequestAsyncOperation which contains a reference to the WebRequest object.'
!(01:56:53] Assets\ PlattarExporter\UnityGLTF Scripts\ GLTFEditorExporter.cs(242,22): warning CS0168: The variable 'e' is declared but never used
!(01:56:53] Assets1PlattarExporter1UnityGLTF1Scripts1AssetSerializer.cs(306,10): warning CS0618: 'PrefabUtility.CreatePrefab(string, GameObject)' is obsolete: 'Use SaveAsPrefabAsset instead.'
!(01:56:53] Assets\ PlattarExporter\UnityGLTRScripts GLIFScenelmporter.cs(709,20): warning CS0618: 'UnityWebRequest.Sena is obsolete: 'Use SendWebRequest. It returns a UnityWebRequestAsyncOperation which contains a reference to the WebRequest object.'
!(01:56:53] Assets‘PlattarExporter1UnityGLTF1Scripts1GLIFScenelmporter.cs(777,19): warning CS0618: 'UnityWebRequest.Send(). is obsolete: 'Use SendWebRequest. It returns a UnityWebRequestAsyncOperation which contains a reference to the WebRequest object.'
Hey there, truly great plugin. Probably the only actually working one I could ever find and I'm using this with three.js :)
Strange thing is, I see normal maps are in somewhat red-ish color. Is this expected? I normally would expect to see the regular purple palette so I thought I should ask here.
Thanks a lot in advance. Attached is the exported folder.
Skinned MeshRenderer not support
Was surprised that this gltf exporter for unity does not support iOS.
This other one seems to work
As per title.
Now if I export an object, it creates 3+ files: the GLTF file, the BIN file and N# files per textures.
But what if I want a single file embedding all of that?
Is this possible by changing the script? Would be nice to have an option to choose between "GLTF separated" and "GLTF embedded".
Thanks a lot!
Hello, I'm encountering a problem when exporting unity materials to GLTF.
When exporting, I get this error :
An item with the same key has already been added. Key: /Users/hip/Desktop/Plattar-Exporter/1_export_gltf/Stuc_normal.jpg
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityGLTF.GLTFEditorExporter.SaveGLTFandBin (System.String path, System.String fileName) (at Assets/PlattarExporter/UnityGLTF/Scripts/GLTFEditorExporter.cs:239)
Plattar.Exporter.GenerateGLTF (UnityEngine.GameObject selectedObject) (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:243)
Plattar.Exporter.GenerateGLTFZipped (UnityEngine.GameObject selectedObject) (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:210)
Plattar.Exporter.OnGUI () (at Assets/PlattarExporter/Plattar/Editor/Exporter.cs:131)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:423)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:364)
UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:353)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:316)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:620)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:592)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:585)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:551)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:540)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:473)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:77)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:84)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:318)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:281)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:244)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:209)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:309)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:161)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:278)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:459)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.