Rendered 3d model is dark in Qt5.7

  • Hi All,

    I am a newbie in Qt, learning and exploring, I came across the assimp-cpp example in Qt5.6
    It worked well and I was able to load a model using it.

    Then, I upgraded my version to 5.7
    Tried the same sample inside its sdk.

    I see that the rendered model is somewhat dark..
    How do we add brightness to the view?
    There is this difference I see in all the examples.
    Here is the code from the sample,

    int main(int ac, char **av)
        QApplication app(ac, av);
        Qt3DExtras::Qt3DWindow view;
        // Root entity
        Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
        // Scene Camera
        Qt3DRender::QCamera *camera =;
        camera->setAspectRatio(view.width() / view.height());
        camera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
        camera->setViewCenter(QVector3D(0.0f, 1.1f, 0.0f));
        camera->setPosition(QVector3D(0.0f, 2.5f, 2.0f));
        // For camera controls
        Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
        // Scene loader
        Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
        Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
        SceneWalker sceneWalker(sceneLoader);
        QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
        QStringList args = QCoreApplication::arguments();
        QUrl sourceFileName;
        if (args.count() <= 1) {
            QWidget *container = new QWidget();
            QFileDialog dialog;
            sourceFileName = dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"));
        } else {
            sourceFileName = QUrl::fromLocalFile(args[1]);
        if (sourceFileName.isEmpty())
            return 0;
        return app.exec();

    What can I add here to add the brightness?

  • What you see is the "default" light. AFAIK you can get no pointer to the default light to change its position, color, intensity or the like. If you want to have control you will have to add your own light to the root entity which then replaces the "default" light by some internal magic.

    So you do something like this:

    m_pLight=new Qt3DRender::QPointLight();
    Qt3DCore::QEntity *pLightEntity=new Qt3DCore::QEntity(m_pRootEntity);

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.