Important: Please read the Qt Code of Conduct -

Qt3D to load scenes

  • Hi,

    I'm trying to use Qt3D to load some scene files that I need to work with, but I'm not sure how to do this.

    I dont need graphics support, I just need to load the scenes and modify some data for some other purposes. I have tried to create a simple Qt3D scene which contains a QSceneLoader object. I've also created an engine and Input and Render aspects but nothing happens.

    Here is some code:

    FracturablePart *JesusIOFile::fromFile(const QString &filename)
        if (filename.endsWith(".obj"))
            Qt3DCore::QAspectEngine *engine = new Qt3DCore::QAspectEngine;
            Qt3DInput::QInputAspect *inputAspect = new Qt3DInput::QInputAspect;
            Qt3DRender::QRenderAspect *renderAspect = new Qt3DRender::QRenderAspect;
            Qt3DRender::QSceneLoader *loader = new Qt3DRender::QSceneLoader;
            Qt3DCore::QEntity *loaderEntity = new Qt3DCore::QEntity;
            connect(loader, &Qt3DRender::QSceneLoader::statusChanged,
                    this, &JesusIOFile::onSceneLoaderStatusChanged);
            engine->startTimer(0, Qt::TimerType::CoarseTimer);
        return nullptr;
    void JesusIOFile::onSceneLoaderStatusChanged(Qt3DRender::QSceneLoader::Status status)
        std::cout << "Status :" << status << std::endl;

    Any ideas if this is even possible in Qt3D?

  • Hi,
    have you tried loader->setSource(QUrl::fromLocalFile(fileName))?
    Maybe place the connect before the setSource. Did you add a QPhongMaterial somewhere else?

  • QPhongMaterial? What for?

  • Hi,
    when I read Qt3D I always think of 3D-surfaces to visualize.

  • That's what I want to know, if there is anyway to use Qt3D for batch manipulation of 3D scenes. If they are going to add physical simulation, AI and all that stuff, there should be a way to run it in batch...

  • 3D-surface - for me - means, I need a shader i.e. a phong material. "physical simulation, AI and all that stuff" is not part of the current Qt3D, at least AFAIK.

  • I just need the geometry data in the scene, meshes, vertex and triangles, no visualization. What I want to do is not even important for the question...

    Anyway, I have tried to use a Qt3DWindow to get the normal behavior and the QSceneLoader is giving an error and I don't know why...

Log in to reply