Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Importing 3D object with materials in balsam
Forum Updated to NodeBB v4.3 + New Features

Importing 3D object with materials in balsam

Scheduled Pinned Locked Moved Solved QML and Qt Quick
balsamqmlqtquick3dblender
2 Posts 1 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    berk
    wrote on last edited by
    #1

    Hello everyone,

    I am currently trying to import a 3d model that I made in blender. Screenshot from 2020-07-23 14-54-02.jpg

    I export 3d models as .obj files in default settings:Screenshot from 2020-07-23 15-05-08.png

    then I use balsam to convert .obj file to qml asset:
    Screenshot from 2020-07-23 15-06-04.png

    Then I copy the meshes, maps folders and qml file to my project. When I run it it shows the meshes and the decals that I added but the metallic material that I made in blender doesn't show up.(maps folder contains the maps for on and off decals but there is no picture for metal material that I made)

    Screenshot from 2020-07-23 15-09-22.png

    Here is the qml file that balsam outputs:

    import QtQuick3D 1.15
    import QtQuick 2.15
    
    Node {
        id: switch_edited_obj
    
        Model {
            id: switch_
            source: "meshes/switch_.mesh"
    
            DefaultMaterial {
                id: node01___Default_material
                diffuseColor: "#ffcccccc"
            }
            materials: [
                node01___Default_material
            ]
        }
    
        Model {
            id: on_
            source: "meshes/on_.mesh"
    
            DefaultMaterial {
                id: on_material
                diffuseMap: Texture {
                    source: "maps/on.png"
                    tilingModeHorizontal: Texture.Repeat
                    tilingModeVertical: Texture.Repeat
                }
                opacityMap: Texture {
                    source: "maps/on.png"
                    tilingModeHorizontal: Texture.Repeat
                    tilingModeVertical: Texture.Repeat
                }        }
            materials: [
                on_material
            ]
        }
    
        Model {
            id: off
            source: "meshes/off.mesh"
    
            DefaultMaterial {
                id: off_material
                diffuseMap: Texture {
                    source: "maps/off.png"
                    tilingModeHorizontal: Texture.Repeat
                    tilingModeVertical: Texture.Repeat
                }
                opacityMap: Texture {
                    source: "maps/off.png"
                    tilingModeHorizontal: Texture.Repeat
                    tilingModeVertical: Texture.Repeat
                }        }
            materials: [
                off_material
            ]
        }
    
        Model {
            id: switch_001
            source: "meshes/switch_001.mesh"
            materials: [
                node01___Default_material
            ]
        }
    }
    

    I am new to both blender and qt quick 3d therefore I may have missed a fundamental step in the process. I appreciate your help.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      berk
      wrote on last edited by berk
      #2

      I noticed that .obj files does not contain material information in them, instead blender creates a .mtl file along with it. As far as I know balsam does not accept .mtl files along with .obj so instead I tried other formats. I tried all formats in https://doc.qt.io/qt-5/qtquick3d-tool-balsam.html#supported-3d-asset-types . GLTF2 (.gltf, .glb) format worked for me. However the other formats that blender can output did not give material information.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved