- Qt 3D Studio
- Best Practices
- Exporting from Blender
- Qt 3D Studio 2.8 Manual

# Exporting from Blender

It is possible to export meshes, lights, cameras, transform animations (scale/rotation/location), UV layouts, pivot points, object hierarchy and material slots from Blender to Qt 3D Studio.

## Exporting Models

### Create Material Slots

Material slots needs to be created and assigned in Blender before the export. If this is not done, one default material slot will be used for the object in Qt 3D Studio.

Note: Only material slots that has a material and that are assign to a mesh on the exported object, will be imported in Qt 3D Studio.

To create material slots, follow the steps below.

1. In the properties panel, select the material tab.
2. Press the + to add a new material slots.
3. Press the New button.

4. Repeat steps 2 to 4 for each material slot to create.

By default, the first material slot will be assigned to the object

To assign a different material slot to the object, or to assign several material slots to the same object, follow the steps below.

1. In edit mode, select the desired faces. (Shift + Right Mouse Click to multi select, A to select all faces).
2. In the properties panel, select the material tab.
3. In the material slots list, select the desired material slot.
4. Press the Assign button to assign the selected material slot to selected faces.

In Studio, you will see all materials in the scene graph.

### UV Unwrap Models

UV unwrapping your model will create a UV layout. Without a UV layout you will not be able to render any textures on your model in Qt 3D Studio.

There are many different ways and techniques to unwrap 3D meshes. The most basic way to do it in Blender is described below.

1. In edit mode, press A to select the whole mesh.
2. Press U, then select Unwrap from the context menu.

### Triangulate

1. In object mode, select the object.
2. In the properties panel, select the modifiers tab.
3. In the drop down list, select Triangulate.

4. Press Apply.

Note: When exporting as COLLADA, it is possible to do the triangulation in the actual export step.

### Bake Actions for Animations

Note: This step is necessary only if you are exporting animations that are using custom curves or object constraints to control the animation.

Actions are data-blocks containing animation data. If you are exporting animations you need to bake actions.

1. Press space bar.
2. Type bake actions.
3. Press Enter.

### Apply Location, Rotation and Scale

Note: This should not be done when exporting animations.

Applying transform values will reset the object's location, rotation and scale values. Location and rotation values will change to 0 while scale values will change to 1. The object itself will not visually change.

1. In object mode, select the object.
2. Press Ctrl + A.
3. Select Location.
4. From the check box in the panel, check also Rotation and Scale.

Note: Applying Location will also reset the object's origin (pivot point).

## Exporting Lights

You can export lights of any light type from Blender to use in Qt 3D Studio.

The following properties will be imported into Qt 3D Studio:

- Position, rotation, scale
- Brightness
- Light color
- Cast shadows

Light type will be imported (and converted if needed).

Light type in Blender | Will import to Qt 3D Studio as...
--- | ---
Point | Point
Area | Area
Sun | Directional
Spot | Directional
Hemi | Directional

## Exporting Cameras

You can export perspective and orthographic cameras from Blender to use in Qt 3D Studio.

The following properties will be imported into Qt 3D Studio:

- Position, rotation, scale
- Clipping start/end
- Focal Length (perspective camera only).

## Exporting COLLADA from Blender

1. From the file menu, select File > Export > Collada (.dae).
2. Ensure that Triangulation is checked on, unless you already have triangulated all meshes.
3. Press the Export COLLADA button.

## Exporting FBX from Blender

In order to export as FBX, you will need to have an FBX export add-on installed and enabled in Blender. With the default installation of Blender, the `Import-Export: FBX format` should be installed. If you do not have the option to export as FBX avaialble, ensure that the add-on is enabled by following the steps below:

1. From the file menu, select File > User Preferences.
2. Select Add-ons from the top menu bar.
3. Search for fbx.
4. The add-on should now be visible, enable it by clicking the check box next to its name.

Next, to export as FBX, follow the steps below:

1. From the file menu, select File > Export > FBX (.fbx).
2. Under the Main tab, set Forward to `Y Forward` and Up to `Z Up`.

3. For animations, ensure that Baked Animation under the Animation tab is checked on.

4. Press the Export FBX button.