WebGL createPostProcessingShader returns null

  • Hey All,

    I'm new to KRPano so bear with me, i have looked on the forum to find a similar question or maybe even an example but haven't found anything so here we go :)

    My goals is to use a blur Filter for the content in the KRPano viewer.

    What i've done so far:

    1. Created fragment shader in a script tag (https://github.com/mattdesl/lwjgl…fragment-shader ). And retrieved it using a simple

    this._shader = document.getElementById('shader').text;

    The `vTexCoord` and `u_texture` are renamed to `tx` and `sm` as described here https://krpano.com/docu/pluginint…rocessingShader

    2. Got the WebGLContext by loading a custom plugin.

    3. I'm able to call the function to add the Post Processing Shader:

    this._panoWebGLLayer.webGL.createPostProcessingShader(this._shader, 'sm, resolution, radius, dir');

    But it still returns null, but without any errors. Has anyone else experienced anything similar and if so, how can i solve this?

    Thanks in Advance,


  • Hi Klaus!

    I tried to realize the effect of blurring based on the above link - https://github.com/mattdesl/lwjgl…fragment-shader
    but I get strange stripes.

    Here is my code:

    krpano.webGL.context.uniform2f(shader.dir, 1, 0);
    krpano.webGL.context.uniform1f(shader.resolution, 1024);
    krpano.webGL.context.uniform1f(shader.radius, 20);
    shader = krpano.webGL.createPostProcessingShader( get_shader_src(), "sharpen_factor,sz,dir,resolution,radius");

    Could you tell me what I'm doing wrong?
    Thank you!

    Edited 2 times, last by nosferatu (April 6, 2017 at 9:09 AM).

  • I fixed some bugs in the code and edited my post above.
    Yet I do not get the desired result.

    Once I write the variable "vColor", I get a black screen:

    gl_FragColor = vColor * vec4(sum.rgb, 1.0);

    Without this variable I get a strange effect:

    gl_FragColor = vec4(sum.rgb, 1.0);

    Help me please.

  • Hi,

    Could you tell me what I'm doing wrong?

    A lot of things are wrong there: *wink*

    • your shader code is from a two-pass shader example, so one pass can't be enough
    • the 'resolution' of the framebuffer is not 1024x1024, it's the current krpano rendering buffer size - krpano provides that size via the 'sz' uniform
    • not sure what you want todo with your 'vColor' variable...

    I will quickly made a plugin based on your core shader code and then post it here.

    Best regards,

  • I am brand new to krpano and made my first 360 video pano with it - works well.
    Now I want to try to add a sharpening filter to the running video.
    I used the sharpening filter from this forum.

    I added to the xml file

    <plugin name="sharpen"
    xml_sharpen = "10.0"


    But now what? - how can I sharpen the pano video that's running.
    I am curious to see if there is enough processing power, and what the effect the sharpening has on a running video.
    Thanks for your help.

  • I just realized my mistake.

    I changed to sharpen = "10.0"
    I also tried sharpen = "2.0"

    I can see the effect on the video.

    BUT - this does not seem to sharpen the video

    Thanks for your help

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!