Blog

Home Forums Beginners GLSL conversion tutorial

This topic contains 4 replies, has 3 voices, and was last updated by  Mpono 1 year, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4738

    Mpono
    Member

    Hello!

    I recently purchased BAZIK when my external HD containing all my VJ clips was dropped and I was left day-of-show without my clip library. 
    I am happy to report Bazik saved the show and gave me a wonderful fun toy to port through VDMX which I used to add filters and clips. 
    My question is, 
    Would you consider doing a simple step by step tutorial of a real-world conversion of a shader hosted from somewhere like shadertoy into a .frag?  For someone completely new to code, a visual guide to steps involved with publishing controls would be GREAT. 
    Other forum entries stop short of this. 
    I realize user-created shaders vary so examples can vary as well. A tutorial of an actual shader conversion instead of the test shader would be greatly appreciated. 
    Mahalo!
    -Pono
    #5031

    marg8
    Member

    +1

    #5032

    Maxime
    Participant

    Yes i can understand that. 

    In fact, convert a ShaderToy source to a Bazik file is really easy if you have some skills in code.
    GLSL langage in a “unfriendly” langage, so newby can’t use it quickly. That’s why we never publish a step-by-step tutorial…
    If you’re able to create or understand a GLSL file, put it in Bazik is simple 🙂 
    The hard part is to learn the GLSL langage.
    #5033

    Maxime
    Participant

    Example :

    Shader Toy Source
    /////////////////////////////////////////////////////
    void mainImage( out vec4 fragColor, in vec2 fragCoord )
    {
    vec2 uv = (2.0*fragCoord.xy – iResolution.xy) / iResolution.yy;
    uv *= 1.1;

    float w = 2.0*fwidth(uv.x);
    float t = 0.02;
    float r = 1.0;

    float s;
    if (mod(iTime, 2.0) < 1.0) {
    s = smoothstep(-w/2.0, w/2.0, length(uv) – r);
    } else {
    s = smoothstep(-w/2.0, w/2.0, abs(length(uv) – r) – t/2.0);
    }

    fragColor = vec4(s, s, s, 1.0);
    }

    Bazik file

    /////////////////////////////////////////////////////
    void main( void )
    {
    vec2 uv = (2.0*gl_FragCoord.xy – resolution.xy) / resolution.yy;
    uv *= 1.1;

    float w = 2.0*fwidth(uv.x);
    float t = 0.02;
    float r = 1.0;

    float s;
    if (mod(time, 2.0) < 1.0) {
    s = smoothstep(-w/2.0, w/2.0, length(uv) – r);
    } else {
    s = smoothstep(-w/2.0, w/2.0, abs(length(uv) – r) – t/2.0);
    }

    gl_FragColor = vec4(s, s, s, 1.0);
    }

    #5034

    Mpono
    Member

    Thank you very very much! 

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.