QtQuick3D RuntimeLoader: material missing using qrc
-
Dear forum,
I use the QtQuick3D RuntimeLoader for importing custom 3D models from .obj files with .mtl files.
Strangely, this works perfectly as long as I import the model from its local file, but the material is missing if I use the qrc resource management.Means, this works:
RuntimeLoader { id: importNode source: "file:///home/someAbsolutePath/application/resource/objects/car.obj" }
While this only imports the model, but not the material:
RuntimeLoader { id: importNode source: "qrc:/objects/car.obj" }
I know that there is the option of using balsam, but I would really like to avoid using it since I have a lot of custom 3D models and don't want to preprocess them.
Any hints on how to solve this?
Thank you! -
Please drop the
qrc
prefix:RuntimeLoader { id: importNode source: ":/objects/car.obj" }
-
@Axel-Spoerl Thanks for the response, unfortunatley, this leads to the object not being rendered at all...
When I do: (without the colon)RuntimeLoader { id: importNode source: "/objects/car.obj" }
it is loaded, but still without material
-
@Axel-Spoerl Sorry, after digging a bit deeper, its actually not the material which is missing, but the texture the material file is importing (which in my case is simply a .png/.jpeg image file)
Do you have an idea how to resolve this? -
-
@Axel-Spoerl ...alll the files are included in the resource system... if you don't want to/can't help, please tell me that and don't just point me to the general documentation...
-
@feli223 This post doesn't say anything about how the resources have actually been populated. That's where it went wrong. The fact that it works without the colon means, that an in-source build finds the file somewhere in the source tree. If the application is deployed without its sources, it won't work any more. I don't know where, how, and why it went wrong, because this part of the code is missing. That means I can't help you, probably nobody can. But I do know that the resource system works seamlessly. So I pointed you to the documentation, because my feeling is that you haven't read it fully and made a small mistake..