Unity editor wizard that exports to glTF Format
Clone or download
Pull request Compare This branch is 129 commits ahead, 89 commits behind alvani:master.
AurL Updates exporter version to 2.2.1
Small UI update: animation is in beta
6
Latest commit c3551c3 Dec 1, 2017
Permalink
Failed to load latest commit information.
Dependancies [#D3D-2461] Adds texture conversion to JPG Nov 22, 2016
Resources Updates readme for v2.0 Feb 24, 2017
.gitignore [#D3D-2461] Updates exporter for Sketchfab Nov 21, 2016
ExporterHeader.png [#D3D-2461] Updates Sketchfab exporter with oauth2 Nov 21, 2016
ExporterSKFB.cs [#D3D-3764] Adds beta to 'Export animation' toggle Dec 1, 2017
GlTF_Accessor.cs [#D3D-3616] Fixes skinning animation export Nov 10, 2017
GlTF_AmbientLight.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_AnimSampler.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Animation.cs [#D3D-3616] Fixes validator warnings for animation Oct 25, 2017
GlTF_Attributes.cs [#D3D-3616] Fixes skinning animation export Nov 10, 2017
GlTF_BufferView.cs [#D3D-3616] Fixes skinning animation export Nov 10, 2017
GlTF_Camera.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Channel.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_ColorOrTexture.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_ColorRGB.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_ColorRGBA.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_DirectionalLight.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_ExporterWindow.cs [#D3D-3070] Fixes errors from GetString() calls in scripts Apr 6, 2017
GlTF_FloatArray.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_FloatArray4.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Image.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Light.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Material.cs [#D3D-2966] Cleans useless/dead code Mar 15, 2017
GlTF_MaterialColor.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_MaterialTexture.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Matrix.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Mesh.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Node.cs [#D3D-2966] Updates skin serialization (2.0) Jun 20, 2017
GlTF_Orthographic.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Perspective.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_PointLight.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Primitive.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Program.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Rotation.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Sampler.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Scale.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Shader.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Skin.cs [#D3D-3616] Fixes skinning animation export Nov 10, 2017
GlTF_SpotLight.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Target.cs [#D3D-2966] Replaces target.id by target.node Mar 15, 2017
GlTF_Technique.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Texture.cs Fixes glTF export (glTf 2.0 validator warnings) Jul 7, 2017
GlTF_Translation.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Vector3.cs [#D3D-2981] Fixes compilation issue when building unity project Mar 15, 2017
GlTF_Writer.cs Updates exporter version to 2.2.1 Dec 1, 2017
LICENSE Restores licenses deleted by error Oct 23, 2017
Preset.cs Removes trailling spaces in scripts Nov 21, 2016
README.md Updates README Nov 10, 2017
SceneToGlTFWiz.cs Removes bump map export for compliancy Nov 10, 2017
SimpleJSON.cs [#D3D-2461] Updates Sketchfab exporter with oauth2 Nov 21, 2016

README.md

Unity to Sketchfab exporter

Unity editor wizard that exports Unity object to Sketchfab using glTF 2.0 format.

Plugin based on Unity-glTF-Exporter from https://github.com/tparisi/Unity-glTF-Exporter

How to use it

Find the plugin

Once the plugin is imported (from the Unity package provided in the last release here, or after having checked out this repo), a new item should appear in the Tools menu. You can access the exporter by going through Tools/Publish to Sketchfab as shown in the following screenshot:

alt tag

Authentication

The exporter uses OAuth authentication with username/password workflow. You need to log in with your Sketchfab account before continuing. If you don't have a Sketchfab account, you can click on the helpers to be redirected to the sign up page. When successfuly logged in, you will be able to use the exporter.

Export your selection

Select the objects you want to export, fill the forms with model info and then click the upload button. The exporter will pack up everything and upload it on Sketchfab. You will be redirected to the model page when it's done.

Supported features

Supported Unity objects and features so far:

  • Scene objects such as transforms and meshes
  • PBR materials (both Standard and Standard (Specular setup) for metal/smoothness and specular/smoothness respectively). Other materials may also be exported but not with all their channels.
  • Solid and skinning animation

Report an issue

If you have any issue, please use the Report an issue link to be redirected to the support form.

PBR materials

glTF 2.0 core specification includes metal/roughness PBR material declaration. Specular/glossiness workflow is also available under an extension.

Link to the glTF 2.0 specification: https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0

Note: Bump maps (normal maps generated from grayscale) are not exported, as glTF materials don't provide them and since the export doesn"t handle the conversion.

The following example describes a Metallic-Roughness material with transparency:

    "materials": [
        {
            "pbrMetallicRoughness": {
                "baseColorFactor": [1, 1, 1, 1],
                "baseColorTexture" : {
                    "index" : 0,
                    "texCoord" : 0
                },
                "roughnessFactor": 1,
                "metallicFactor": 1,
                "metallicRoughnessTexture" : {
                    "index" : 1,
                    "texCoord" : 0
                }
            },
            "doubleSided": false,
            "alphaMode": "BLEND",
            "alphaCutoff": 0.5,
            "normalTexture" : {
                "index" : 2,
                "texCoord" : 0,
                "scale" : 1
            },
            "occlusionTexture" : {
                "index" : 3,
                "texCoord" : 0,
                "strength" : 0.13
            },
            "emissiveFactor": [1, 1, 1],
            "emissiveTexture" : {
                "index" : 4,
                "texCoord" : 0
            },
            "name": "metallicPlane"
        }
    ],

It's composed of a set of PBR textures, under pbrMetallicRoughness, and a set of additionnal maps. For specular/glossiness workflow, it's still kept under an extension.

The following example describes an opaque Specular-Glossiness material:

{
    "materials": [
        {
            "extensions": {
                "KHR_materials_pbrSpecularGlossiness": {
                    "diffuseFactor": [1, 1, 1, 1],
                    "diffuseTexture" : {
                        "index" : 0,
                        "texCoord" : 0
                    },
                    "glossinessFactor": 0.358,
                    "specularFactor": [0.2, 0.2, 0.2, 1],
                    "specularGlossinessTexture" : {
                        "index" : 1,
                        "texCoord" : 0
                    }               }

            },
            "doubleSided": false,
            "normalTexture" : {
                "index" : 2,
                "texCoord" : 0
            },
            "emissiveFactor": [0, 0, 0],
            "name": "specularPlane"
        }
    ],

Texture conversion

Textures are processed to be compliant with glTF 2.0 specification. It includes:

  • flipping images along Y axis: FLIP_Y is enabled in Unity but disabled in glTF.(more details about Flip Y flag in glTF and in WebGL).
  • packing occlusion(R)/metalness(G)/roughness(B) for PBR metallicRoughness and specular(RGB)/glossiness(A) for specularGlossiness, including inversion to convert smothness to roughness

Samples

Some samples exported using this plugin are available (and downloadable) on Sketchfab https://sketchfab.com/features/gltf. They will be kept up-to-date while the glTF 2.0 specification is being developped.

Unsupported features

Materials

  • emission color values are clamped in [0.0, 1.0] as glTF doesn"t allow HDR values for this channel yet. (see this github issue)
  • bump maps or normal map generated from grayscale are ignored
  • tiling/offset parameters not exported (see current github pull request)
  • secondary maps and all other following material settings

Animation

  • all animations that are not Generic or Legacy (like Humanoid)
  • animation from MonoBehaviour scripts or custom tools

Scene objects

  • camera
  • lights
  • custom scripts/shaders/postprocesses