Export GLTF from Blender

First, Blender is set up to have a working area and a rendered preview available. To split the window, click and drag the small rectangle in the upper left corner of the viewport.

Then, one of the windows needs to be changed to the node editor. In the node editor the PBR Materials will be set up.

Link the custom node with Blender. Go to File a Link and select the Node from the Blender Library. (found in folder \_installation).

Now switch the Renderer to “Cycles Render”.

Import your geometry into the scene. In this particular case the \glTF_testexport\fbx\geo_box.fbx is used.

Check if the object has proper UV coordinates.

Standard, there is a default material assigned to this object. It can be changed and edited in the material panel on the right side. Screenshot below shows how to add the previously imported glTF MetallicvRoughness Node so it can be used as a material. It is important to check the “Use Nodes” box in order to preview it. In the next step, a rendered preview is created and environment lighting is assigned to the scene.

It is recommended to split the view again and set the viewport shading to “Rendered”.  Then set an environment texture as a light source for the scene

 

For this step go to the “World” panel on the right side and set an “Environment Texture” as the “Color” of the environment and also as a light source for the scene.

You can use the \glTF_testexport\textures\san_giuseppe_bridge_4k.hdr. In the next step the textures need to be applied to the material. For this go to “Add”à”Texture”à”Image Texture”. Now a new “Image Texture” node appears in the node editor. Plug the texture into the “Base Color” input and select the desired texture (or use the provided textures in \glTF_testexport\textures).
Also, connect the output of the“gltf Metallic Roughness” node to the “Surface” input of the “Material Output” node so the textures can be previewed on the model.

The glTF File Format uses PBR Textures in a slightly different way than other Blender materials. Ambient Occlusion, Roughness, and Metallic textures need to be combined into the RGB Channels of one single texture.

Plug the other textures (\glTF_testexport\textures) into the according channels

Also, switch the Matallic Roughness and Normal Texture Nodes to “Non-Color-Data”
The object should now look like in the picture below.

Export the asset as a “.glb” file.

It can be tested in the Babylon JS Sandbox viewer. http://sandbox.babylonjs.com/

Close Menu
Close Panel