• Isadora
  • Get it
  • Forum
  • Help
  • ADD-ONS
  • Newsletter
  • Impressum
  • Dsgvo
  • Impressum
Forum
    • Categories
    • Recent
    • Popular
    • Tags
    • Register
    • Login

    GLSL Shader Actor - mat2 input

    How To... ?
    3
    4
    1.1k
    Loading More Posts
    • 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.
    • markM
      mark
      last edited by

      Dear All,

      A user sent me a GLSL Shader actor that wasn't working.... the code that caused it to fail is below.

      // ISADORA_FLOAT_PARAM(complexity, complex, 9.0, 900.0, 10.0, "veraendere dichtheit");

      uniform mat2 complexity;

      Note that while they have specified a floating point input, the actual uniform variable declared by complexity is a **mat2** – that's not a single float, but actually four floats! (You can learn more about GLSL types [on this page](https://www.opengl.org/wiki/Data_Type_(GLSL)).)
      To provide like input to a **mat2**, you'd need to define four separate inputs

      // ISADORA_FLOAT_PARAM(complexity00, cp00, 9.0, 900.0, 10.0, "veraendere dichtheit");

      // ISADORA_FLOAT_PARAM(complexity01, cp01, 9.0, 900.0, 10.0, "veraendere dichtheit");

      // ISADORA_FLOAT_PARAM(complexity10, cp10, 9.0, 900.0, 10.0, "veraendere dichtheit");

      // ISADORA_FLOAT_PARAM(complexity11, cp11, 9.0, 900.0, 10.0, "veraendere dichtheit");

      uniform float complexity00;

      uniform float complexity01;

      uniform float complexity10;

      uniform float complexity11;

      and then somewhere within your code, you'd need this to initialize a **mat2**called complexity as follows:

      mat2 complexity;

      complexity[0][0] = complexity00;

      complexity[0][1] = complexity01;

      complexity[1][0] = complexity10;

      complexity[1][1] = complexity11;

       

      I tested this and it works. Hopefully that will help one of you down the road.

       

      Best Wishes,

      Mark

      Media Artist & Creator of Isadora
      Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

      1 Reply Last reply Reply Quote 1
      • fubbiF
        fubbi
        last edited by

        nice

        Mac M2 Ultra, 64gb — Berlin

        1 Reply Last reply Reply Quote 0
        • DusXD
          DusX Tech Staff
          last edited by

          This should be added to a Knowledge base article on GLSL usage.

          Troikatronix Technical Support

          • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
          • Isadora Add-ons: https://troikatronix.com/add-ons/
          • My Add-ons: https://troikatronix.com/add-ons/?u=dusx

          Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

          1 Reply Last reply Reply Quote 0
          • markM
            mark
            last edited by

            Dear @DusX,

            Added the mat2 stuff to the tutorial as an addendum.
            Best,
            Mark

            Media Artist & Creator of Isadora
            Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

            1 Reply Last reply Reply Quote 0
            • First post
              Last post