Niconi Solid Chan (Alicia Solid)
While looking for a 3D model to use for learning Qt3D, I found a very promising one.
Niconi Solid Chan Special Site - Niconi Solid
We are releasing the 3D model ‘Alicia Solid’, which can be used for free without attribution in various situations such as video productions, self-made games, technical demos, and doujin activities.
It’s a very user-friendly license, allowing free use and secondary processing.
The 3D model is distributed in the following three formats:
- FBX
- MMD
- Unity Package
This time, I will use the FBX format from these options.
MMD can be used in Blender by adding an add-on, but it has drawbacks for future use, such as Japanese characters in object names, so I won’t use it this time.
Unity Package is exclusive to Unity, so I won’t use this either.
Loading with Qt3D (FBX Edition)
First, I tried loading the fbx like this:
Entity {
components: [
SceneLoader {
source: "/FBX/Alicia_solid_MMD.FBX"
},
Transform {
translation: Qt.vector3d(0, 0, 0)
}
]
}
As a result, nothing was displayed on the screen, and it seems fbx cannot be loaded.
(Upon closer inspection, it was just taking too long, and loading was actually happening. However, the raw downloaded fbx encountered texture loading errors and ultimately wasn’t displayed.)
Loading with Blender
Next, since loading it directly in Qt3D didn’t work, I tried processing it first by loading it into Blender.
Then…
ASCII FBX files are not supported.
Hmm, are there different types of FBX?
Research revealed that FBX has ASCII and binary types.
(I had never paid attention to that before.)
FBX Conversion
Since I wanted to read FBX in Blender, I found that Autodesk provides an FBX converter. Besides converting from ASCII to binary format, it seems you can also choose whether resource files like textures are external or embedded.
FBX Converter Archives | Autodesk Developer Network

Usage is simple: add the target file, set FBX Save Mode to Binary, and press Convert.
Loading with Blender (Attempt 2)
Importing the FBX converted to binary format completed without errors this time.

Exporting in a Format Loadable by Qt3D
I tried exporting in obj format, which I have previously successfully loaded in Qt3D.
As expected, there seemed to be errors loading textures. Texture information for obj files is apparently written in the mtl file. Looking inside the mtl, I found two patterns for image file references: *.tga and *.psd.
Looking at the Qt documentation (http://doc.qt.io/qt-5/qtimageformats-index.html), it seems tga files are supported, so I imagined psd couldn’t be read and replaced *.psd with *.tga.
(This isn’t a fundamental solution, but since there were the same number of *.tga and *.psd files, it was a temporary measure.)
After applying this change and running it in Qt:

It displayed!! But the overall display is rough, and there’s something on the forehead area.
Compared to the original FBX (Binary) file size of 6MB, the obj (text) file is 2.7MB, significantly smaller, so the roughness of the display might be unavoidable. Is the thing on the forehead perhaps due to changing the psd file to tga?
As a temporary measure, I deleted the forehead part in Blender and exported the obj file again. The something on the forehead disappeared.

Embedding the 3D Model in QML
Exporting the obj file from Blender allowed loading in Qt3D, but the rendering quality decreased (probably due to reduced vertex count?).
Also, loading models using SceneLoader seems to happen dynamically after the application starts, so it takes a little time for the model to appear.
(This is why I initially thought the text-format fbx wasn’t loading.)
Amidst this, I found a page published by KDAB:
Exporting 3D content for Qt 3D with Blender - KDAB
The article mentions that using the Blender Exporter Addon described here allows saving the model in binary format and using it without parsing time.
I tried it immediately.
Copy the files from this repository, paste them into Blender’s addons directory, and enable the addon in Blender’s settings to make qml export available.

Exporting using this generated a complete set of Qt project files.
Launching the exported project and displaying it:

The shape is cleaner than the previously loaded obj format.
There’s almost no difference from how it looks in Blender.
Also, there’s almost no delay between the window appearing and the 3D model being displayed.
The effect of binary embedding seems significant.
However, as you can see at a glance, it’s not colored.
Looking at Blender’s qml export script (which is Python inside), the information for materials using textures was not exported.
I found that the material information in the exported project is written in MaterialCollection.qml, so I decided to manually redefine the materials using textures (*.tga) here.
Original Material Definition
readonly property Material wearPsd: PhongMaterial {
ambient: Qt.rgba(0.2, 0.2, 0.2, 1.0)
diffuse: Qt.rgba(1.0, 1.0, 1.0, 1.0)
specular: Qt.rgba(1.0, 1.0, 1.0, 1.0)
}
Modified Material Definition
readonly property Material wearPsd: NormalDiffuseSpecularMapMaterial {
ambient: "white"
diffuse: TextureLoader { source: "matarial/Alicia_wear.tga"}
normal: TextureLoader { source : "matarial/Alicia_wear.tga" }
specular: TextureLoader { source: "matarial/Alicia_wear.tga" }
shininess: 1.0
textureScale: 1.0
}
Since the property type is Material both before and after the change, I hoped modifying this would make everything work. Figuring out which texture to assign to which material was inferable from the property names, so it wasn’t too much trouble.
After implementing this change and launching again:

It got colored properly!!
However, because I used TextureLoader for texture loading, the image file loading occurs dynamically, causing a slight delay after startup. To resolve this, I think the textures also need to be embedded in binary (RGB format?) like the 3D model.
Summary
It’s not perfect yet, and challenges remain, but I was able to use Alicia-chan’s 3D model in Qt3D.
However, this time I only displayed it, so it’s not moving.
The FBX file also defines bones and motions using them, so next I want to investigate if motion animation can be done from Qt3D.
The complete project set with Alicia-chan’s information embedded is published in the following repository:
Bonus
Since it’s 3D, I tried rotating it for now.
やっとQt3D上にアリシアちゃんを降臨させる事ができた。#AliciaForQt3D pic.twitter.com/ungDBLLqBj
— ayuma (@ayuma_x) September 16, 2018