Griffel Studio

glTF Exporter+API

glTF Exporter API .NET library export projects to the universal glTF file format which lots of 3D software can handle. If you don't need API to implement glTF export in your app use the glTF Exporter instead.

Download sample files
*or ask for a special quote sending us an e-mail.

Ray Trace view of the model in Revit.

Exported and opened in default Windows 10 application.

Using glTF Exporter API in Visual Studio.

Options

Options

  • Choose a file format between glTF and packed glb.
  • Choose either to export materials or not.
  • Select the geometry level of detail.
  • Bake meshes by element or by material.
  • Compress meshes using Draco compression.
  • Export a model with multiple LODs combined into one file.
  • Export file in glTF format via API with some statistics and validation results.
Settings explained

How does it work?

Connect the project to the code

Then:

1. Add .dll

Reference GS.Revit.GltfExporterAPI.dll from your Revit add-in development C# project (use the library from the corresponding folder for your targeted Revit version).

2. Validate the license

You need to pass your personal User ID to validate the license before starting the export (you can grab it once and keep in the settings of the add-in): Validate. License(developerId)

3. Create settings

Add the following code after the license validation to run the export:

var outputPath = @"C:\ExportResult.glb";
var settings = new GltfExportSettings(outputPath);
var exporter = new GltfExportSettings(settings);
exporter.Export(document, view);

Copy

4. Do the export

Resolve compilation errors using GS.Revit.GltfExporterAPI; execute the command from a 3D view and see results.

Or export a file from Revit

How our solution helps clients

The add-in helps HoloLens and other Mixed Reality developers to get fast tiny files with LODs and all the materials right from Revit - no need to convert a Revit project using numerous software and tools to get the file AR compatible devices can handle. It will take you only a few lines of code to get things done!

glTF Exporter API library features embedded IntelliSense XML documentation and provides flexible export options. Except for those described on settings explained page they include:

  • export materials as doublesided;
  • limit vertices count for a single mesh;
  • either export normals or not;
  • format output json file and more.

Settings Explained

Group meshes

  • Group meshes by element or by material option influences output file size, 3D model performance and file structure.
  • Elements have their Revit Ids and are broken down by Revit category so  the output file has nice structure.
  • When grouping by material there are as many nodes in the file tree as materials in Revit project.

Model on the left has meshes grouped by element.

Model on the right has meshes grouped by material.

Large projects grouped by element may have less FPS rate. Number of draw calls for this model is 6494.

Gain more FPS grouping by material — only 55 draw calls — the same as number of materials. Though file size for the model has been increased from 18MB to 29MB.

Level of detail

Level of detail determines how many polygons 3D model has. It relates mostly to rounded objects and may dramatically impact the file size.


The same model of torus exported with LOD 1, LOD 3 and LOD 15 (5KB, 15KB and 396KB corresponding). LOD values ​​from 5 to 7 are generally sufficient.

Export materials

glTF Exporter maps Revit materials to PBR materials (and to KHR if you choose export with merged LODs option) so you can get beautifully looking 3D model.


But if you what to experiment or get some statistics you can skip materials and export geometry just by disabling Export materials checkbox. This might be useful for some geometry analysis.

Output format

Output format option determines files you get. The best choice for projects which are going to be send by the Internet is glb format — there will be a single file you can immediately email to a client, for instance.

If you are planning to edit textures or want to see the file structure — choose glTF format. You can open glTF file with any text editor and edit materials from Textures folder.

Draco compression

Draco compression minimizes file size as much as possible. It’s extremely useful for large projects, but remember that not every third party software can handle compressed files. Projects exported with this option can be saved only as glb files. Difference in file size can be seen from the following export results:

Create merged LODs model

Create merged LODs model option improves the quality of detailed Revit models handling. With this checkbox enabled glTF Exporter creates three files: one with specified LOD and two other with degrading LOD, and merges them into single file. This might be specifically useful for Windows Mixed Reality developers.