Qt3D custom Mesh and Texture issue

69 Views Asked by At

I am currently trying to implement a rendered Golf ball with C++ and Qt3D to an application, I am able to load the mesh, the normal map and the texture.

Unfortunately when I try to combine these 3, something goes wrong with the lightning/shading. It looks like the texture is not fully wrapped around the ball the moment the lightning is rendered.

Qt3DCore::QEntity *RootEntity = new Qt3DCore::QEntity;
Qt3DCore::QEntity *sphereEntity = new Qt3DCore::QEntity(RootEntity);
Qt3DRender::QMesh *sphereMesh = new Qt3DRender::QMesh;

Qt3DExtras::QNormalDiffuseMapMaterial *normalMaterial = new Qt3DExtras::QNormalDiffuseMapMaterial (sphereEntity);
Qt3DRender::QTextureLoader *bumploader = new Qt3DRender::QTextureLoader (sphereEntity);
Qt3DRender::QTextureLoader* titleistloader = new Qt3DRender::QTextureLoader (sphereEntity);

titleistloader->setSource( QUrl::fromLocalFile( "ball4/textures/GolfBallLogos.jpg" ) );
bumploader->setSource(QUrl::fromLocalFile( "ball4/textures/GolfBallNormal.jpg" ));
sphereMesh->setSource(QUrl::fromLocalFile("ball4/ball4.obj"));

sphereEntity->addComponent(sphereMesh);

normalMaterial->setDiffuse(titleistloader);
normalMaterial->setNormal(bumploader);
normalMaterial->setSpecular(QColor("black"));
sphereEntity->addComponent(normalMaterial); 

Result:

A rendered Golf ball

when I load the same textures back into Blender everything looks as expected.

How could I fix this issue?

0

There are 0 best solutions below