We are migrating from an older 3D engine to Qt 3D. In order to compare the older 3D engine with Qt3D I'm writing a small app, that compares both renderings side to side.
In order to make an automatic comparision more suitable I'm in need to deactive anti aliasing in Qt3D.
I think, that I have to modify the frame graph, but I have no idea, what is necessary to do this.
The following example app shows a simple Qt3D Scene with a sphere. Does anyone know how to perform the necessary changes in the default frame graph?
#include <QApplication>
#include <QVBoxLayout>
#include <QFrame>
#include <Qt3DRender/QCamera.h>
#include <Qt3DExtras/QSphereMesh>
#include <Qt3DExtras/QDiffuseSpecularMaterial>
#include <Qt3DExtras/qforwardrenderer.h>
#include <Qt3DExtras/Qt3DWindow.h>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
auto view = new Qt3DExtras::Qt3DWindow();
auto frameGraph = view->defaultFrameGraph();
frameGraph->setClearColor(QColor(255,255,255));
// Disable Anti-Aliasing
// What is necessary here!
// ---------------------
auto rootEntity = new Qt3DCore::QEntity();
view->setRootEntity(rootEntity);
auto cameraEntity = view->camera();
cameraEntity->lens()->setPerspectiveProjection(45.0f, 1., 0.1f, 10000.0f);
cameraEntity->setPosition(QVector3D(5, 5, 5));
cameraEntity->setUpVector(QVector3D(0, 1, 0));
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
auto mesh = new Qt3DExtras::QSphereMesh();
mesh->setRadius(1.);
auto meshMaterial = new Qt3DExtras::QDiffuseSpecularMaterial();
meshMaterial->setAlphaBlendingEnabled(true);
meshMaterial->setDiffuse(QColor(50, 50, 50));
meshMaterial->setAmbient(QColor(255, 255, 255));
meshMaterial->setSpecular(QColor(255,255,255));
meshMaterial->setShininess(100);
auto meshEntity = new Qt3DCore::QEntity(rootEntity);
meshEntity->addComponent(mesh);
meshEntity->addComponent(meshMaterial);
meshEntity->setEnabled(true);
auto container = QWidget::createWindowContainer(view);
QFrame frame;
frame.setLayout(new QVBoxLayout);
frame.layout()->addWidget(container);
frame.setFixedSize(500, 500);
frame.show();
return a.exec();
}