Removing Qt3D's default point light



  • By default, qt3d adds a point light to your scene.

    When i add at least one light in a scene, it renders fine:
    scenewithlight.png

    However, when i remove all lights, qt3d adds one in the middle of the scene.
    defaultlight.png

    Is there any way that i can remove this light?

    Thanks in advance.



  • Qt3D add a light is the list of ligth is empty:

                    if (activeLightSources.isEmpty()) {
                        setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[0], QVector3D(10.0f, 10.0f, 0.0f));
                        setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight));
                        setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[0], QVector3D(1.0f, 1.0f, 1.0f));
                        setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[0], 0.5f);
                    }
    

    http://code.qt.io/cgit/qt/qt3d.git/tree/src/render/backend/renderview.cpp (line ~900).

    But, you can add a light with an intensity of zero to override the default light.



  • I was trying to avoid doing that, but if it's the only way then i guess i'll just have to.

    Thanks.



  • We can discuss removing the default point light. I think the reason it was added was that you would still have some light effect even if you forget to set a light. Obviously that may not be what everyone wants.


Log in to reply
 

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