Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to convert dae Model to gltf in Cesium

Shulou Source: shulou.com Published: 2022-06-01 03:41:20 10月22日 Update

This article is about how to convert dae model to gltf in Cesium. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

A single model in Cesium can be added in gltf, glb, etc. In the process of development, models in other formats need to be converted to the above format. On github, there is an open source tool that can convert COLLADA (.dae) files into glTF files, program source URL:

Https://github.com/KhronosGroup/COLLADA2GLTF

DAE is a 3D model, 3Dmax and maya need to install the dae output plug-in to export to a file with the suffix .dae, which can be exported directly by sketchup.

Github provides compiled runnable programs, available in linux and windows versions, and can be downloaded from https://github.com/KhronosGroup/COLLADA2GLTF/releases

Detailed parameter settings are available on github:

How to use it on windows:

Extract the downloaded executable package, open the cmd command line window under windows, and enter a typical usage:

COLLADA2GLTF-bin.exe-I source file path (.dae)-v version number-output path of t-o .gltf file

When the input is complete, click enter to run it. A gltf file will be generated when you succeed, and an error message will be displayed if you fail.

In the case of a large number of dae files, you can write a simple program using C # to convert the dae files in a folder into gltf model in batches. The detailed development code is as follows:

String [] _ fileLst = Directory.GetFiles (@ "folder path")

Foreach (string _ files in _ fileLst)

{

FileInfo _ fileInfo = new FileInfo (_ files)

/ / get the dae file

If (_ fileInfo.Extension = = ".dae")

{

ProcessStartInfo startInfo = new ProcessStartInfo (string.Format (@ "convert software path\ COLLADA2GLTF-bin.exe"), string.Format (@ "- I {0}-v 1.0-t-o output file path\ {1} .gltf", _ fileInfo.FullName, _ fileInfo.Name.Replace (".dae", string.Empty)

/ / execute some parameter settings of the command line program and search specifically

StartInfo.CreateNoWindow = true

StartInfo.UseShellExecute = false

StartInfo.RedirectStandardOutput = true

/ / run the program

Process p = new Process ()

P.StartInfo = startInfo

P.Start ()

}

}

Thank you for reading! On "how to achieve dae model in Cesium to gltf" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: File model program path output format version run content parameter command folder method more article URL development input good practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno vpn MariaDB Linux