atteneder / gltfast Goto Github PK
View Code? Open in Web Editor NEWEfficient glTF 3D import / export package for Unity
License: Other
Efficient glTF 3D import / export package for Unity
License: Other
For export, see #345
Investigate if the loading process can be moved off the main thread and spread accross multiple worker threads.
I am not incredibly well versed in how Unity's fancy new Package Manager works, but when I follow your instructions on attempting to add glTFast to my manifest.json
file, it returns the following error.
An error occurred while resolving packages:
Package com.atteneder.gltfast@https://github.com/atteneder/glTFast.git has invalid dependencies:
com.atteneder.draco: Package [[email protected]] cannot be found
support extension MSFT_texture_dds
Right now the Unity Standard Shader is utilized which has some downsides:
costly texture transformations for occlusion/roughness/metalic textures, since the channel usage differs
missing features (like double sidedness or unlit)
An optimized shader (or a derivate of the Standard Shader) could improve speed/size.
Things to consider:
(Scriptable) Render Pipeline compatibility:
Forward/Deferred, Lightweight, HQ, custom
glTF is right-handed whilst Unity uses a left-handed coordinate system. Initially glTFast simply scaled the root node by -1 in the Z-axis to fix this. Turns out this can have some negative impact on, for example, shader or physics behaviour.
TODO: convert node's transforms and meshes into Unity space
Make loading glTFs streamable, so the already received part of the content can be parsed while the rest is loading.
Related:
Do I need to use another library to convert a GLTF file into GLB in order to use :
var loadModel = new GameObject().AddComponent<GLTFast.GlbAsset>();
loadModel.url = gltf;
Test all files from the official sample repositories
https://github.com/KhronosGroup/glTF-Sample-Models
https://github.com/bghgary/glTF-Asset-Generator
on all platforms.
Apply correct texture filtering and wrapping modes provided by glTF samplers
Hi,
I downloaded the glb files in persistantPath in Android and when I try to load from this path I get an error
Unity: Cannot connect to destination host /storage/emulated/0/Android/data/com.xxx.xxxx/files/C772BCFB-B2FD-406E-8B32-05D3D5DEFAD6.glb
atm the Unity Standard shader is used, which uses the channels of the metalic/roughness textures differently. Hence the result is incorrect.
Support extension KHR_draco_mesh_compression
Take BufferView target into account when loading buffers.
See
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
Namely:
Vec3 (without alpha channel)
UInt16
Unity 2019.3 Mesh API Improvements:
https://docs.google.com/document/d/1I225X6jAxWN0cheDz_3gnhje3hWNMxTZq3FZQs5KqPc/edit#heading=h.vyksohcynwk5
glTFast could probably be optimized a bit by using this new API
feedback thread:
https://forum.unity.com/threads/feedback-wanted-mesh-scripting-api-improvements.684670/
For easier installation/usage.
Ideally an automated process.
Currently there's only support for the Built-In render pipeline via DefaultMaterialGenerator
. It implements the interface IMaterialGenerator
.
To add support for the URP, the corresponding code creating the materials has to go into a new class implementing IMaterialGenerator
.
It has to be used in the constructor of GLTFast
instead of the default one (ideally dynamically).
public GLTFast() {
materialGenerator = new DefaultMaterialGenerator();
}
See https://github.com/zeux/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
Requires #18 to be implemented first
Individual materials per primitive seem to not work atm.
Occurs when I import into fresh Unity 2018.3 project
support extension KHR_materials_pbrSpecularGlossiness
It would be interesting to get a progress (done vs pending percentage) and provide data/interfaces required for progress bars and ETA calculation.
Callbacks for major loading events, like:
Edit: Since version 4.0.1 you can retrieve warning/error messages via ICodeLogger
injection.
For images and buffers.
I tried to import a .glb from a network share and got the following error.
HTTP/1.1 502 Bad Gateway \\server\share\file.glb
UnityEngine.Debug:LogErrorFormat(String, Object[])
GLTFast.<LoadRoutine>d__6:MoveNext() (at Assets/GLTFast/GltfAsset.cs:41)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
At the moment only GLBs that contain all buffers in itself are supported.
Support meshes/rigs with skinning applied.
Follow the progress of the morph branch
support extension KHR_materials_unlit
support extension KHR_lights_punctual
Optional though. Default should be not to import lights, I guess
extensions
MSFT_packing_normalRoughnessMetallic
MSFT_packing_occlusionRoughnessMetallic
support extension KHR_texture_transform
I've just cloned the project and opened inside of Unity 2018.3.0 which is causing missing namespaces. These are:
Is this because i'm using a newer version of Unity or are these carried over from the Kronos project and i'm missed something?
Make this project a UnityPackage
The (impressive) speed of this library in the editor gets lost when building for ios. The loading duration increases by 400%. Switching from .glb to .gltf does not affect the duration.
extension KHR_texture_transform
KhronosGroup/glTF-Sample-Models#167
Test with a reasonably old version of Unity (2017.1 maybe).
Textures, Materials and Meshes stick in memory, even after being destroyed.
Easy to spot using the Unity Profiler.
I receive this error whenever the plugin tries to decode a gltf or glb compressed with draco:
'''
EntryPointNotFoundException: DecodeMeshForUnity
DracoMeshLoader+DracoJob.Execute () (at Library/PackageCache/com.atteneder.draco@b04c2d09ff4d4889e68e0cdfe6b3dc47f4a58a29/Runtime/Scripts/DracoMeshLoader.cs:64)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Managed/IJob.cs:30)
'''
I've tried files exported from Blender 2.8 as well as this sample file:
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/CesiumMilkTruck/glTF-Draco
I've also tried Unity 2019.2.3f1 on both Windows 10 and OSX with the same result.
Meshes can have a second UV set (TEXCOORD_1
) that materials can use via texCoord
.
See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#meshes
Support for regular text based glTFs
Optional camera import support. Default should be to not import cameras (or at least not activate them).
I'm getting a decoding error when trying to load draco compressed files.
Failed: Decoding error.
UnityEngine.Debug:LogError(Object)
GLTFast.PrimitiveDracoCreateContext:CreatePrimitive() (at Library/PackageCache/com.atteneder.gltfast@64f3c1b978d7139af3da6d9c48b02ae06a375d90/Runtime/Scripts/GltFast.cs:159)
GLTFast.<Prepare>d__43:MoveNext() (at Library/PackageCache/com.atteneder.gltfast@64f3c1b978d7139af3da6d9c48b02ae06a375d90/Runtime/Scripts/GltFast.cs:545)
GLTFast.<LoadContent>d__8:MoveNext() (at Library/PackageCache/com.atteneder.gltfast@64f3c1b978d7139af3da6d9c48b02ae06a375d90/Runtime/Scripts/GltfAsset.cs:77)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
I tried running with 2019.2 as well as 2019.3 on windows 10, git as well as lsf are up to date.
Packages appear to also be in order and up to date:
{
"dependencies": {
"com.atteneder.draco": "https://gitlab.com/atteneder/DracoUnity.git",
"com.atteneder.gltfast": "https://github.com/atteneder/glTFast.git",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.vscode": "1.1.2",
"com.unity.test-framework": "1.1.1",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0"
},
"testables": [
"com.atteneder.gltfast"
],
"lock": {
"com.atteneder.draco": {
"revision": "HEAD",
"hash": "b04c2d09ff4d4889e68e0cdfe6b3dc47f4a58a29"
},
"com.atteneder.gltfast": {
"revision": "HEAD",
"hash": "64f3c1b978d7139af3da6d9c48b02ae06a375d90"
}
}
}
I created the file using the fbx2gltf converter 0.9.7 using .\FBX2glTF-windows-x64.exe --input .\Y_Bot.fbx --output Y_Bot.glb --binary --draco (also tried without --binary)
I attached the file in question and would be extremly happy for any pointers where to start debugging / fixing the whole thing!
Hi, i was testing this project and i have very bad performance with "large" glb scene (40mb-100mb) (3d models with lot of objects, ~1M verts ), this was designed just for litle objects? what about performance on mobile devices? what are the limits of this library?
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.