microsoft / gltf-toolkit Goto Github PK
View Code? Open in Web Editor NEWA collection of tools for modifying and optimizing glTF assets
License: MIT License
A collection of tools for modifying and optimizing glTF assets
License: MIT License
When using the 'Release' target, the glTF-Toolkit will throw an error "No Direct3D hardware device found" on trying to compress textures. In 'Debug' mode, a software fallback is used instead.
Hello,
I am trying to use the MSFT_LOD extension for LOD with gltf files and came to this toolkit. I've downloaded the WindowsMRAssetConverter.exe. On running the command I'm getting the following output:
WindowsMRAssetConverter T2H.glb -o T2.glb -lod T2L.glb T1L.glb -screen-coverage 0.5 0.2 0.01
This will generate an asset compatible with Desktop (version 1709+)
Loading input document: T2H.glb...
Could not parse accessor 0
The member bufferView was not found
I had a look at this documentation (https://docs.microsoft.com/en-us/windows/mixed-reality/creating-3d-models-for-use-in-the-windows-mixed-reality-home) but couldn't figure out the issue.
Is it possible to run the converter from some non-Windows system as well and is there a documentation for it? If not, I could help in creating one with a little guidance.
I have tried to follow the great post here:
https://mtaulty.com/2018/06/19/placing-3d-models-in-the-mixed-reality-home/
I also used the same tortoise model but even after conversion, the hololens is unable to place the model - even with the platform set to holographic.
LOD merge causes the tangents from the highest LOD to be used where it really should use the tangents from the appropriate LOD instead.
I think all that's needed is a line in GLTFLODUtils.cpp::AddGLTFNodeLOD:
...
AddIndexOffset(primitive.tangentsAccessorId, accessorOffset);
...
Incorrect results are being produced from the NRM packing. The current algorithm does a simple value copy but to maintain comparative visual equality we need to renormalize the normal values and also compute roughness from normal variance.
Repro steps:
Input Normal texture:
Tests should use a mock of DirectXTex to return compressed textures immediately instead of slowly compressing them on the test machines. As a stopgap, we should disable slow tests on AppVeyor / CI.
For example, if you're packing ORM and the Occlusion and MetallicRoughness textures have different sizes.
Hi,
Do you have any documentation on how to create a gltf/glb mesh with more than 1 triangle and probably how to convert an existing mesh (I have mine in STL format) with facets and nodes correspondences.
Thanks!
Block compression expects textures to be multiples of 4 to compress correctly. Adding a step to resize textures automatically and toggle this behavior on and off in the converter would provide a fallback when assets aren't authored with this requirement in mind.
After conversion for the holographic plattform with the following command without any options:
I get the aboved error, any sugesstion is appreciated!
(Btw, beofore conversion the error is "Sorry, this model is not optimized for Windows Mixed Reality")
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
The project does not build in Visual Studio 2019. I added the /Wv:18 option to the compiler command line and replaced all instances of "std::experimental::filesystem" with "std::filesystem" and that eliminated some errors but more remain and I am giving up.
Hello,
I want to use the gltf-Toolkit in my projekt to convert gltf-Files to glb-Files for the Mixed Reality Viewer.
First I tried directly to use
var converted = await WindowsMRConversion.ConvertAssetForWindowsMR(tempGltfFile, outputFolder, 512, TexturePacking.OcclusionRoughnessMetallic);
but the result is always a empty ( 0 byte) glb file (without the "_converted" extention on the filename).
next I tried to first serialize the gltf-File to glb an then use the Conversion Methode.
StorageFile sourceGlbFile = await GLTFSerialization.PackGLTFAsync(gltfFile, ApplicationData.Current.LocalFolder, glbfileName);
Here I got direct an exeption "System.Runtime.InteropServices.COMException" in System.Private.CoreLib.ni.dll"
For my tests I use the BoomBox.gltf and Avocado.gltf from the Khronos Repod
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/sourceModels
Here my full Methode
` public async Task GLBConvertToWindowsMR()
{
const string gltfFileName = "Avocado.gltf";
// Pack the gltf back into a glb file
var gltfFile = await StorageFile.GetFileFromPathAsync(Path.Combine(ApplicationData.Current.LocalFolder.Path, gltfFileName));
var glbfileName = Path.ChangeExtension(gltfFileName, ".glb");
StorageFile sourceGlbFile = await GLTFSerialization.PackGLTFAsync(gltfFile, ApplicationData.Current.LocalFolder, glbfileName);
StorageFile tempGlbFile = await CopyFileToTempFolderAsync(sourceGlbFile.Path);
StorageFolder outputFolder = await CreateTemporaryOutputFolderAsync("Out_" + Path.GetFileNameWithoutExtension(gltfFileName));
var converted = await WindowsMRConversion.ConvertAssetForWindowsMR(tempGlbFile, outputFolder, 512, TexturePacking.OcclusionRoughnessMetallic);
}`
Hello,
With threejs, we use https://github.com/takahirox/three-gltf-extensions to successfully load GLTF models that already include MSFT_LOD.
(working GLTF model : https://github.com/takahirox/three-gltf-extensions/tree/main/examples/assets/gltf/Torus/glTF-lod)
But when we try making our own with WindowsMRAssetConverter, no luck doing so, with multiple scenarios:
case 1 : multiple levels are active at the same time and with wild scales
(red and green are 2 separate LODs)
Command used on Windows : .\scripts\WindowsMRAssetConverter.exe ./src/models/LOD0Arbre2.gltf -o ./dist/models/arbre.glb -lod ./src/models/LOD1Arbre2.gltf ./src/models/LOD2Arbre2.gltf ./src/models/LOD3Arbre2.gltf ./src/models/LOD4Arbre2.gltf -screen-coverage 0.5 0.45 0.25 0.05 0.001
Can you help us ?
I can share the assets if needed for testing.
The link provided to documentation is no longer valid
When enabled the -replace-textures flag should remove all original textures and references from the optimized file leaving only DDS textures in the final .glb. The flag currently no-ops resulting in bloated files.
Hi,
I've been trying to use the toolkit with the gltf-SDK to generate a .glb file with Draco mesh compression. (without the file being saved by the SDK first.)
I keep getting the error Buffer.uri was not specified
If I try the .gltf file there is heap corruption at
This is what buffer.data()
prints for a buffer of any size :
DRACO☻☻☺☺
Any help would be appreciated, thanks!
Hi,
Shouldn't NDEBUG be set for Release builds?
We're getting artifacts in our output when running in software mode otherwise (there seem to be some issues using a WARP device)
I noticed that after the conversion of the spec gloss textures to metal rough that they still are present in the output
Here's the sheets compared between 1.5.0 and 1.6.0 when running glTF-Toolkit/glTF-Toolkit.Test/Resources/gltf/WaterBottle/WaterBottle.gltf
. The spec gloss textures are still present in the textures/images arrays in 1.6.0 (indices: 0, 1, 5, 6).
When converting an asset with the -replace-textures flag set the converter silently fails during the compression step. Removing the flag causes the same asset to convert successfully.
The files "glTF-Toolkit/glTF-Toolkit.Test/Resources/gltf/CubeAsset3D.gltf" and "glTF-Toolkit/glTF-Toolkit.Test/Resources/gltf/CubeWithLOD.gltf" fail to load in both Windows explorer preview pane and the Windows 10 3D Viewer program by Microsoft.
Given a set of gltf input LODs that have the same materials for each LOD:
Some possible solutions:
Using the tool this am. I thought it was broken, but it I just had a typo on the file name that I was entering. Would it be possible to report file not file not found or similar text.
Hi! Awesome toolkit you've started here, thanks for doing this. 🙂 Wanted to share some ideas on things that could make this more useful to WebVR devs, and so, (apologies in advance for all the feature requests!) here are some thoughts. In no particular order:
Best,
Don
Crash on GLTFDocument document = DeserializeJson(*stream);
Unhandled exception at 0x76A308F2 in WindowsMRAssetConverter.exe: Microsoft C++ exception: Microsoft::glTF::InvalidGLTFException at memory location 0x00AFC2F4. occurred
This when loading a gltf file
Trying to compress the file attached, I'm getting the "Cannot read the magic number" message and no results.
Thorus.zip
Does it mean compression is applicable only on gltf files?
Also, can I create Draco compressed glb with MSFT_lods extension?
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.