Sketchfab Importer

Table of Contents
Searching for cats on Sketchfab
Searching for cats on Sketchfab
Searching for cats on Sketchfab

You can search and import models from Sketchfab inside the Castle Game Engine editor.

1. How to use

  • Open any project.

  • Use the menu item "Data → Import from Sketchfab…​".

  • Search for any query, like cat, tree…​ Your imagination is your only limit, Sketchfab has an incredible number of models. There’s a checkbox to limit the results to contain "Only Animated" models.

  • Pick the model you want to download. You can view the models using a list (with license, description, face count) or using a grid view (with thumbnail). You can also open the corresponding model in the Sketchfab website viewer.

  • Press "Download" to download the glTF version of the model from Sketchfab.

    Make sure to fill the "API token" field first — find your token on the Sketchfab "Password & API" page. You need a (completely free) Sketchfab account for this.

    The downloaded model is placed inside the data subdirectory of your project, in a file like data/sketchfab/<name>-<id>/scene.gltf. There are accompanying files with textures, license, we also leave the downloaded zip.

  • If you have some design open, with some viewport selected, then you can even "Download and Add To Viewport". This is just a shortcut to download and drag-and-drop the glTF model into the viewport, instantiating [cgeref id=TCastleScene] pointing to the proper glTF model.

Enjoy!

2. License

The models' licenses are clearly specified (in the search dialog and in downloaded license.txt files). They use various versions of the Creative Commons licenses or Public Domain.

Following Sketchfab docs: Sketchfab provides a library of over 1 million free models, available under Creative Commons licenses. Most models allow commercial use. Read the model licensing for more details.

Note
Be wary of using Non-Commercial or Non-Derivatives variants of the Creative Commons licenses. They are incompatible with general open-source definition, which has been stated explicitly e.g. by Debian (DFSG) and FSF. See Creative Commons at Wikipedia for more information. So works including these models cannot be distributed as freely as most open-source software. Other CC variants are cool.

3. Caveats

  1. Sketchfab export to glTF is not perfect.

    1. Some models have too dark materials. E.g. this dungeon has very dark unlit materials in glTF. It looks dark when viewed in Castle Game Engine and other glTF viewers.

      TODO: New material components will allow you to easily override faulty materials.

    2. Sometimes the exported glTF says to use blending when it actually should not. For example this chunky knight has rendering issues, in Castle Game Engine and other glTF viewers, due to using blending when it should not.

      This likely follows Sketchfab docs saying that they don’t export Refraction, Dithered, and Additive transparency (will be converted to Blending).

      The solution is just to disable blending in CGE for these models, setting MyScene.RenderOptions.Blending to false.

  2. A minority of Sketchfab models use a "specular glossiness" PBR workflow through a deprecated (by Khronos) KHR_materials_pbrSpecularGlossiness. We support it in CGE only partially — some models may look dark or too contrasting, like this knight.

    As KHR_materials_pbrSpecularGlossiness is deprecated, superseded by KHR_materials_specular, we are reluctant to put effort to support this way of rendering perfectly in CGE.

    Possibly Sketchfab can switch to the new approach in the future. In the meantime you can ask Sketchfab authors to use metallic-roughness PBR workflow. See:

  3. Some models expose just one big animation like Take 001, which is an artifact how some 3D software exports them.

    You can follow examples/animations/split_long_animation to split such long animation into multiple "sub animations" in CGE.


To improve this documentation just edit this page and create a pull request to cge-www repository.