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. quick 3d shader and custom geometry

quick 3d shader and custom geometry

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 1.1k Views 2 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.
  • L Offline
    L Offline
    LeonZJU
    wrote on last edited by LeonZJU
    #1

    [this topic is also post at Qt6 subcategory: https://forum.qt.io/topic/121710/quick-3d-shader-and-custom-geometry]

    Hi, I am using custom shaders and custom geometry in Quick3d of Qt6. I now have 2 questions:

    1. How to pass a VARYING variable of int type from vertex shader to fragment shader. I need it to be "flat", which is not interpolated.
      ec9871b3-0c47-413e-9a3c-0f34df83b78c-image.png
      When I using int type as the above image, I have this shader compiling errors:
      1f30b400-d4f4-44bb-8220-3b925cfac888-image.png
      I have also tried to add "flat" or "flat in" to the declaration of the "VARYING int patten" and I just couldn't get it right. Can you please give a example of how to use a "VARYING variable" of int type?

    2.When I use custom geometry, it seems that I can add custom Semantic to the vertex data, is this right? While I can use "VERTEX" in vertex shader to access the PositionSemantic vetex data, if I can add custom Semantic, then how can I access the custom Semantic data in vertex shader?
    6339ce7d-b157-423c-95f7-88dfb79e1540-image.png
    If we can't add custom Semantic now, will it be possible to do so in the future version of Qt6?

    Thanks.

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2

      Could this be a simple spelling mistake of the word 'pattern', as your spelling is missing an 'r' (patten) ??

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      L 1 Reply Last reply
      1
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        Is this the issue with the int?

        C++ is a perfectly valid school of magic.

        L 1 Reply Last reply
        0
        • MarkkyboyM Markkyboy

          Could this be a simple spelling mistake of the word 'pattern', as your spelling is missing an 'r' (patten) ??

          L Offline
          L Offline
          LeonZJU
          wrote on last edited by
          #4

          @Markkyboy Yes, the name of this variable should be "pattern", but it is just the name. Changing it to "pattern" will lead to the same error.

          1 Reply Last reply
          0
          • fcarneyF fcarney

            Is this the issue with the int?

            L Offline
            L Offline
            LeonZJU
            wrote on last edited by
            #5

            @fcarney When using normal OpenGL, I know how to pass int variable between vs and ps, just like you mentioned in this the issue . But when it comes to shaders in QtQuick 3D, this isn't right. If I changed the code to the following, I get errors too(see below).
            2913bdfd-3a0b-4bf8-97a6-a9504070ebe6-image.png
            cf59e6c4-0d62-4db6-a69f-55616c5bd649-image.png

            I know that we can definitely pass int type variables from vs to ps, I just don't know how to do that in QtQuick 3D shaders.

            1 Reply Last reply
            0

            • Login

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