Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtQuick3D RuntimeLoader: material missing using qrc
Forum Updated to NodeBB v4.3 + New Features

QtQuick3D RuntimeLoader: material missing using qrc

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 2 Posters 511 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    feli223
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Please drop the qrc prefix:

      RuntimeLoader {
                  id: importNode
                  source: ":/objects/car.obj"
       }
      

      Software Engineer
      The Qt Company, Oslo

      F 2 Replies Last reply
      0
      • Axel SpoerlA Axel Spoerl

        Please drop the qrc prefix:

        RuntimeLoader {
                    id: importNode
                    source: ":/objects/car.obj"
         }
        
        F Offline
        F Offline
        feli223
        wrote on last edited by feli223
        #3

        @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

        1 Reply Last reply
        0
        • Axel SpoerlA Axel Spoerl

          Please drop the qrc prefix:

          RuntimeLoader {
                      id: importNode
                      source: ":/objects/car.obj"
           }
          
          F Offline
          F Offline
          feli223
          wrote on last edited by
          #4

          @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?

          1 Reply Last reply
          0
          • Axel SpoerlA Offline
            Axel SpoerlA Offline
            Axel Spoerl
            Moderators
            wrote on last edited by
            #5

            Here is the documentation to resource file management.

            Software Engineer
            The Qt Company, Oslo

            F 1 Reply Last reply
            0
            • Axel SpoerlA Axel Spoerl

              Here is the documentation to resource file management.

              F Offline
              F Offline
              feli223
              wrote on last edited by
              #6

              @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...

              1 Reply Last reply
              0
              • Axel SpoerlA Offline
                Axel SpoerlA Offline
                Axel Spoerl
                Moderators
                wrote on last edited by
                #7

                @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..

                Software Engineer
                The Qt Company, Oslo

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved