Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

quick 3d shader and custom geometry



  • [this topic is also post at QML and Qt Quick subcategory: https://forum.qt.io/topic/121711/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.


Log in to reply