Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Load .3ds or .obj file with Qt3D



  • Hello,
    Nowadays i'm learning qt3d and all I want to do as a start is to integrate the 3ds file over qt and see the model in viewer.I searched all forum for implementation, but unfortunately they were really high level for me.

    Basically, I followed this video for 3d integration but unfortunately he was using past libraries of Qt.

    However, I tried to use new qt3d 2.0 libraries like 3dcore, 3dinput, 3dcore and so on.But unfortunately it didn't work either.

    Here is my simple implementation:

    My Pro file is :

    QT += quick qml 3dcore 3drender 3dinput 3dlogic 3dextras 3danimation
    CONFIG += c++11
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
        ```
    

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import Qt3D.Core 2.0
    import Qt3D.Render 2.0
    import Qt3D.Input 2.0
    import Qt3D.Logic 2.0

    Entity {
            Mesh{
                id:carMesh
                source:"file:///D:/Projeler/Tutorials/Qt-Tutorials/3dExamples/step1/bla.obj"
            }
    }
    

    It does not show any errors but shows nothing on the screen.(I mean, it does not show implemented .obj or .3ds model on the screen)

    Could you please write me an example or tell me what is missing according to above implementations.

    Note: Is there any tool that i missed?

    Thank you by now.



  • Hi ,
    Yes I'm also facing the exactly same issue in my case and haven't found any way to do the same. Please let know if anyone have some idea on this. Currently I'm trying to implement the 3d project in qt using .3ds/.obj file in Qt5.12, but not succeed in doing so.



  • @esconda

    So far .3ds files shouldn't be supported to load as mesh: https://doc.qt.io/qt-5/qt3drender-qmesh.html#details

    Years ago I had some problems loading my own Wavefront .obj file too, and still don't know where the problem was.

    I would start to load the .obj from the examples . So you can ensure, thats not a problem of your file.


Log in to reply