Hi Mike,

thanks for pointing me to the right direction. I tried version 5.12.0 and the problems disappeared.

Do you think it's fine to create a large number of QEffect based nodes or would it be better to reuse them?

Cheers Volker

Am 09.01.2019 um 13:40 schrieb Mike Krus:
Hi

any chance you could try a more recent version? Lots of fixes since then…


Mike

On 9 Jan 2019, at 10:59, Volker Enderlein <volker.enderl...@ifm-chemnitz.de> 
wrote:

Hi,



I am facing some rendering issues with custom effects in Qt3d. To mark some of 
the entities selected I replace the existing material effect of an entity with 
a newly created instance of a wireframe effect. When using the robustwireframe 
shaders sometimes (but not always, it does not seem to be reproducible) on some 
entities the underlying color (phong shading model) is not set properly.

I tried different shaders (also tried to set the fragment color directly) but 
the result does not change: sometimes I see those rendering issues.

And in some cases the following message is written to the console:

QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setCompositionMode: Painter not active
QPainter::end: Painter not active, aborted

So I'm guessing, setting the custom QEffect causes some issues.

My question is: Should I avoid creating many instances of a custom wireframe 
effect and reuse one instance for all selected entities or should I create a 
separate instance for every entity (material)?

<RenderingIssues.PNG>

The left part of the image shows the wrong behaviour, the right part is the 
expected rendering.

Platform specs: Windows 7 x64, Visual Studio 2015, Qt 5.10.0, Qt3D

Graphics specs: NVidia GeForce GTX 750 Ti/PCIe/SSE2, OpenGL 4.6.0 NVIDIA 391.35



The definition of the effect is as follows:



     WireFrameEffect::WireFrameEffect(Qt3DCore::QNode* parent/* = nullptr*/)
         : Qt3DRender::QEffect(parent)
     {
         addParameter(new Qt3DRender::QParameter(QStringLiteral("ka"), 
QVector4D(0.1f, 0.1f, 0.1f, 1.0f)));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("kd"), 
QVector4D(0.7f, 0.7f, 0.7f, 1.0f)));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("ks"), 
QVector4D(0.95f, 0.95f, 0.95f, 1.0f)));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("ke"), 
QVector4D(0.0f, 0.0f, 0.0f, 1.0f)));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("shininess"), 
128.0f));

         addParameter(new 
Qt3DRender::QParameter(QStringLiteral("light.position"), QVector4D(0.0f, 0.0f, 
0.0f, 1.0f)));
         addParameter(new 
Qt3DRender::QParameter(QStringLiteral("light.intensity"), QVector3D(1.0f, 1.0f, 
1.0f)));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("line.width"), 
1.0f));
         addParameter(new Qt3DRender::QParameter(QStringLiteral("line.color"), 
QVector4D(1.0f, 1.0f, 1.0f, 1.0f)));

         auto technique = new Qt3DRender::QTechnique;
         {
             auto graphicsApiFilter = technique->graphicsApiFilter();
             
graphicsApiFilter->setApi(Qt3DRender::QGraphicsApiFilter::Api::OpenGL);
             
graphicsApiFilter->setProfile(Qt3DRender::QGraphicsApiFilter::OpenGLProfile::CoreProfile);
             graphicsApiFilter->setMajorVersion(3);
             graphicsApiFilter->setMinorVersion(1);

             auto filterKey = new Qt3DRender::QFilterKey;
             filterKey->setName(QStringLiteral("renderingStyle"));
             filterKey->setValue(QStringLiteral("forward"));
             technique->addFilterKey(filterKey);

             auto renderPass = new Qt3DRender::QRenderPass;
             {
                 auto shaderProgram = new Qt3DRender::QShaderProgram;
                 
shaderProgram->setVertexShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.vert"))));
                 
shaderProgram->setGeometryShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.geom"))));
                 
shaderProgram->setFragmentShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.frag"))));
                 renderPass->setShaderProgram(shaderProgram);
             }
             technique->addRenderPass(renderPass);
         }
         addTechnique(technique);
     }


Thanks in advance,

Cheers Volker

--

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
--
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, OpenGL Experts


--

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to