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

    [ANSWERED] GLSL BLUR Shader

    How To... ?
    4
    11
    486
    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.
    • DusXD
      DusX Tech Staff @gapworks
      last edited by

      @gapworks I took a stab at it, but I dont' have much glsl experience... and I got stuck trying to dynamically set mSize.
      It seems to want a Const to define an array.

      So, do you need smooth translation of the blur?
      You could have a few copies of the GLSL, where you set 'const int mSize = ??;'  to different amounts, say, 10, 20, 30, 40 or what ever, and use a Router to switch the feed between them, allowing some control over the level?

      regarding the extra parameters, you can hid them easily enough (setting them to zero, appears to setup the GLSL to affect the whole image), by right clicking the actor and selecting Show/Hide Properties.. and hiding the options you don't need.

      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
      • bonemapB
        bonemap Izzy Guru @gapworks
        last edited by bonemap

        @gapworks

        Hi,

        Here is a modification of your GLSL code that might be useful:


        // ISADORA_FLOAT_PARAM(blurA, inti, .1, 10, .1, "No help available.")
        uniform float blurA;
        #ifdef GL_ES
        precision mediump float;
        #endif
        float normpdf(in float x, in float blurA)
        {
        return 0.39894*exp(-0.01*x*x/(blurA*blurA))/blurA;
        }
        void mainImage( out vec4 fragColor, in vec2 fragCoord )
        {
        vec3 c = texture(iChannel0, fragCoord.xy / iResolution.xy).rgb;
        //if (fragCoord.x < iMouse.x)
        //{
        //fragColor = vec4(c, 1.0);
        //} else 
        {
        //declare stuff
        const int mSize = 11;
        const int kSize = (mSize-1)/2;
        float kernel[mSize];
        vec3 final_colour = vec3(0.0);
        //create the 1-D kernel
        float sigma = blurA;
        float Z = 0.0;
        for (int j = 0; j <= kSize; ++j)
        {
        kernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), sigma);
        }
        //get the normalization factor (as the gaussian has been clamped)
        for (int j = 0; j < mSize; ++j)
        {
        Z += kernel[j];
        }
        //read out the texels
        for (int i=-kSize; i <= kSize; ++i)
        {
        for (int j=-kSize; j <= kSize; ++j)
        {
        final_colour += kernel[kSize+j]*kernel[kSize+i]*texture(iChannel0, (fragCoord.xy+vec2(float(i),float(j))) / iResolution.xy).rgb;
        }
        }
        fragColor = vec4(final_colour/(Z*Z), 1.0);
        }
        }

        http://bonemap.com | Australia
        Izzy STD/USB 3.2.6 | + Beta 3.x.x
        MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.1.2 Sonoma
        Mac Studio 2023 M2 Ultra 128GB | OSX 14.1.2 Sonoma
        A range of deployable older Macs

        1 Reply Last reply Reply Quote 0
        • gapworksG
          gapworks
          last edited by

          @bonemap  

          thanks both of u for ur support. the one thing left ist the blur amount  which is to little. how and where can i change this

          Running MBP2017 / Osx 10.14.5 / 16 GB 2133 MHz LPDDR3 / Intel HD Graphics 630 1536 MB / Latest Isadora Version / www.gapworks.at / located in Vienna Austria

          bonemapB 2 Replies Last reply Reply Quote 1
          • bonemapB
            bonemap Izzy Guru @gapworks
            last edited by

            @gapworks


            hi,

            I did have a look at the blur amount, but it was not possible to increase that without the shader over heating.

            I tried a couple of things, including daisy-chaining three or four instances of the actor - that is worth a try. However, the pre-loaded Gaussian Blur actor that comes as a standard actor in Isadora might be a viable option?

            Best wishes

            Russell

            http://bonemap.com | Australia
            Izzy STD/USB 3.2.6 | + Beta 3.x.x
            MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.1.2 Sonoma
            Mac Studio 2023 M2 Ultra 128GB | OSX 14.1.2 Sonoma
            A range of deployable older Macs

            1 Reply Last reply Reply Quote 0
            • bonemapB
              bonemap Izzy Guru @gapworks
              last edited by

              @gapworks

              I had another thought about it because I did notice that the resolution of the shader affects the amount of blur apparent in the image. So I made this user actor that scales the shader resolution as it applies the blur effectively increasing the appearance of blur across the image:

              blurry.iua3

              http://bonemap.com | Australia
              Izzy STD/USB 3.2.6 | + Beta 3.x.x
              MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.1.2 Sonoma
              Mac Studio 2023 M2 Ultra 128GB | OSX 14.1.2 Sonoma
              A range of deployable older Macs

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

                @gapworks

                I have attached a 2 GLSL shader based approach. Its fast and from my initial tests looks pretty good. 
                It does a horizontal blur, followed by a vertical blur. 

                glsl_blur.izz

                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.

                bonemapB gapworksG WolandW 3 Replies Last reply Reply Quote 2
                • bonemapB
                  bonemap Izzy Guru @DusX
                  last edited by

                  @dusx said:

                  I have attached a 2 GLSL shader based approach. Its fast and from my initial tests looks pretty good. It does a horizontal blur, followed by a vertical blur.

                   Hi,

                  This works great!

                  Beat Wishes

                  Russell

                  http://bonemap.com | Australia
                  Izzy STD/USB 3.2.6 | + Beta 3.x.x
                  MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.1.2 Sonoma
                  Mac Studio 2023 M2 Ultra 128GB | OSX 14.1.2 Sonoma
                  A range of deployable older Macs

                  1 Reply Last reply Reply Quote 1
                  • gapworksG
                    gapworks @DusX
                    last edited by

                    @dusx


                    Brilliant! Thank all of you so much

                    Running MBP2017 / Osx 10.14.5 / 16 GB 2133 MHz LPDDR3 / Intel HD Graphics 630 1536 MB / Latest Isadora Version / www.gapworks.at / located in Vienna Austria

                    1 Reply Last reply Reply Quote 0
                    • WolandW
                      Woland Tech Staff @DusX
                      last edited by

                      @dusx said:

                      I have attached a 2 GLSL shader based approach. Its fast and from my initial tests looks pretty good. It does a horizontal blur, followed by a vertical blur. 

                      It'd be great if you could upload these to the Add-Ons Page (if you haven't already).

                      Best wishes,

                      Woland

                      TroikaTronix Technical Support
                      New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
                      TroikaTronix Support Policy: https://support.troikatronix.com/support/solutions/articles/13000064762
                      TroikaTronix Add-Ons Page: https://troikatronix.com/add-ons/

                      | Isadora 3.2.6 | Mac Pro (Late 2013), macOS 10.14.6, 3.5GHz 6-core, 1TB SSD, 64GB RAM, Dual AMD FirePro D700s |

                      gapworksG 1 Reply Last reply Reply Quote 0
                      • gapworksG
                        gapworks @Woland
                        last edited by

                        @woland

                        i , thanx to the help of all of you i managed to finalise my eos  fixture  and the corresponding izzy  patch. works like charm. than again.izzyeos.zipin  the zip file you will find the patch, the eos fixture file and the blur qua

                        best  

                        peter

                        Running MBP2017 / Osx 10.14.5 / 16 GB 2133 MHz LPDDR3 / Intel HD Graphics 630 1536 MB / Latest Isadora Version / www.gapworks.at / located in Vienna Austria

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