How to say Qt3D load material.lib located near obj file - c++

6.3.0 MinGW Using Qt3DRender::QMesh to load my obj file:
Qt3DRender::QMesh *planeModel = new Qt3DRender::QMesh(rootEntity);
planeModel->setSource(QUrl("qrc:/tu-154/Tu154.obj"));
rootEntity->addComponent(planeModel);
File load correct but i don't see textures:
It should be:
Using QTextureLoader says me:
Failed to load textureImage data using QImage
[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame
Qt3DRender::QMesh::Ready
What else might be right way here?
Github

Related

Hardware does not support the number of textures defined (Using VTK/PCL)

I am trying to view textures in Point Cloud Library (PCL). I have a texture data file (.obj) and corresponding wavefront meterial file (.mtl) along with 5 images.
When I load this data in Meshlab, the texture is mapped but when I load it in pcl using following code;
pcl::TextureMesh mesh7;
pcl::io::loadOBJFile("textured_mesh.obj", mesh7);
pcl::visualization::PCLVisualizer viewer_pre7("PCL Viewer_pre7");
viewer_pre7.addTextureMesh(mesh7, "texture", 0);
viewer_pre7.spin();
I get following error in vtkOutputWindow. Although I can see the mesh structure but the texture is not mapped.
ERROR: In ..\vtkOpenGLProperty.cxx, line 607
vtkOpenGLProperty (000002420C804BA0): Hardware does not support the number of textures defined.
Mesh without texture in PCL
Same file when loaded in Meshgrid
Where shall I look for solving this error? Is PCL good enough for loading and viewing textures (.obj, .mtl)?

loading textured obj with PCL c++

I am trying to load a textured .obj file using the predefined PCL (Point Cloud Library) functions like so:
pcl::TextureMesh texture_mesh;
int loaded = pcl::io::loadOBJFile(<path to obj>,texture_mesh);
boost::shared_ptr<pcl::visualization::PCLVisualizer> result_view(new pcl::visualization::PCLVisualizer("Viewer"));
result_view->addTextureMesh(texture_mesh, "texture mesh", 0);
while (!result_view->wasStopped())
{
//---{ update the viewer }
result_view->spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
However, the texture is not loaded correctly and the model remains colourless. I have tried to save the "texture_mesh" to a new .obj to see the result but it appears the texture coords are being jumbled up.
My questions are:
1) Are the files in the correct format?
2) Is the obj loading and veiwing correct?
3) Has anyone had success loading textured .obj files with PCL?
To demonstrate the issue, I have initialized a test repo here loadOBJ
paths supplied in src are relative so set cmake source=loadOBJ, build=loadOBJ/build.
Due to the relative path I had to edit the output of saving the obj with pcl, this is noted in the READMEs.
Due to issue with not knowing enough about git, I had to manually upload the .obj files haha
This is only an issue on windows machines, it has been tested on unix and runs fine.

OGRE EXCEPTION(7:InternalErrorException): Error decoding image in FreeImageCodec::decode at

I'm using Ogre 3D 1.9, and I'm trying to load a mesh contained in a folder pointed by the resource.cfg file. The folder contains sub-folders, that separate the .mesh files, .material files and textures. Here's the content of the resource.cfg file:
# Resources required by the sample browser and most samples.
[Essential]
# Resource locations to be added to the default path
[General]
FileSystem=media
FileSystem=media/materials/scripts
FileSystem=media/materials/textures
FileSystem=media/models
After this i declare and initialize the mesh, materials and textures with the following:
Ogre::ResourceGroupManager::getSingleton().declareResource("ram.mesh", "Mesh", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("char_ram_col.png", "Font", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("char_ram_nor.png", "Font", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_eyelids.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_eyes.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_horns.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Then i attach the mesh to a node:
Ogre::Entity *entity = scene->createEntity("LocalMesh_Ent", "ram.mesh");
Ogre::SceneNode *cube = node->createChildSceneNode("ram.mesh", Ogre::Vector3(x, y, z));
cube->attachObject(entity);
where cube is a SceneNode previously created.
I have problem loading the texture. The code is build without any problem, but when i run it i have the following error (in the log file):
OGRE EXCEPTION(7:InternalErrorException): Error decoding image in FreeImageCodec::decode at ..\..\..\..\OgreMain\src\OgreFreeImageCodec.cpp (line 419)
The mesh and the materials are created correctly, if for example i comment the part regarding the texture.
Does anybody know which could be the problem ?
Second question: i read that the .png file has to be declared as Font, but there's also the Texture option (which doesn't work as well). Is that correct ?
Actually i found out the problem. The file .png containing the texture, wasn't actually a real .png file. Opening it and re-saving it with Gimp solved my problem.
It took me a while to solve this problem, since the file wasn't corrupted, considering that i could open it without any problem, with the image viewer.
I don't know what it causes this kind of problem, considering that i have just downloaded a Blender model from internet, and saved as Mesh file.

Write texture mapped obj file to disk with VTK

I am using VTK to read an obj file, texture map the 3D model and transform it to another view (by applying rotateY/X/Z transforms to vtkActors) and writing it to file using vtkwindowtoImageFilter. Due to this pipeline, the rendered image is displayed on the screen before being written to file. Is there a way to do the same pipeline without the image being displayed on screen ?
If you are using VTK 5.10 or earlier, you can reander the geometry off screen.
I am not quite sure if this is what you are looking for. I am new to vtk and I found the above link looking for a way to convert a triangular surface to volume data, ie, to voxelize the surface. All profile I found on the internet is about using vtkwindowtoImageFilter to obtain a 2D section of the screen, have you worked out a way to access 3D data of the rendered window? Please tell me about that.

Ogre 3D load models created with Easy Ogre Exporter

I'm currently trying to export a .max file to .mesh and it success.
The problem is that I don't have any color on my form (it's a basic cylinder actually).
Easy Ogre Exporter gave me several more files like .scene .material .cg .program. I tried to set this .material to .mesh entity but it's still white.
Please help me, I really searched on the web but found nothing working.
Best regards,
Coucka
If Ogre encounters an issue with your materials / shaders / textures, it usually falls back to a material called "BaseWhite", which might be what you are experiencing.
First step: Check the Ogre.log file to see if the *.material file was loaded at all and if there were any error while parsing it. You should find an entry similar to this one:
23:45:10: Parsing script Test.material
If your material is also using the shader that was written into the *.cg shader file, check that it is loaded as well without any errors, plus check that a valid shader profile was used, that your hardware supports (otherwise you will find a note in the log, telling you that no supported profile was found). The supported shader profiles will also the output into the log file, like so:
23:45:10: * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0
If you are using textures on your model, make sure that the needed texture files can be found by Ogre. To do so verify that all paths from where Ogre should load resources are listed in the configuration file resources.cfg. Also for textures to work, your model of course needs to have exported UV coordinates. If the texture was successfully loaded, the following entry should appear in the log (the types and formats of course could be different):
23:45:10: Texture: Texture.jpg: Loading 1 faces(PF_R8G8B8,256x256x1) Internal format is PF_X8R8G8B8,256x256x1.