TheLeerName / ShadertoyToFlixel

node.js script which converts shaders from shadertoy to flixel (openfl). Web version exists too!
https://theleername.github.io/ShadertoyToFlixel/
Apache License 2.0
14 stars 2 forks source link

its broken #5

Open daveandbambifan1234 opened 1 month ago

daveandbambifan1234 commented 1 month ago

when I put another Shader in it does the same exact Shader as the first one I put in

daveandbambifan1234 commented 1 month ago

image image the Shader converting is very broken

daveandbambifan1234 commented 1 month ago

image

TheLeerName commented 1 month ago

use this https://www.shadertoy.com/view/WlXcDr its not using static image

daveandbambifan1234 commented 3 weeks ago

I tried it and it did not work

JonnycatMeow commented 3 weeks ago

try this shader code

#pragma header
uniform float iTime; 
// RGB glitch
// by wj
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

float rand(vec2 co)
{
    float a = 12.9898;
    float b = 78.233;
    float c = 43758.5453;
    float dt= dot(co.xy ,vec2(a,b));
    float sn= mod(dt,3.14);
    return fract(sin(sn) * c);
}

// Simplex Noise (http://en.wikipedia.org/wiki/Simplex_noise), a type of gradient noise
// that uses N+1 vertices for random gradient interpolation instead of 2^N as in regular
// latice based Gradient Noise.
// The MIT License
// Copyright © 2013 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vec2 hash( vec2 p ) // replace this by something better
{
    p = vec2( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)) );
    return -1.0 + 2.0*fract(sin(p)*43758.5453123);
}

float snoise( in vec2 p )
{
    const float K1 = 0.366025404; // (sqrt(3)-1)/2;
    const float K2 = 0.211324865; // (3-sqrt(3))/6;

    vec2  i = floor( p + (p.x+p.y)*K1 );
    vec2  a = p - i + (i.x+i.y)*K2;
    float m = step(a.y,a.x); 
    vec2  o = vec2(m,1.0-m);
    vec2  b = a - o + K2;
    vec2  c = a - 1.0 + 2.0*K2;
    vec3  h = max( 0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );
    vec3  n = h*h*h*h*vec3( dot(a,hash(i+0.0)), dot(b,hash(i+o)), dot(c,hash(i+1.0)));
    return dot( n, vec3(70.0) );
}

void main()
{
    vec2 uv = openfl_TextureCoordv.xy;    

    // create an RGB color displacement glitch
    float d= 0.0;
    if (uv.y > rand(vec2(iTime,iTime))) {
        // displacement amount
        d= snoise(vec2(iTime*3.0, uv.y * 0.2));
        d = max(0.0, d - 0.1);  // crop wave for burst
        d =  d * d * 0.5;       // amplify 
    } else {
        // create discontinuity/edge
    }

    // displace RGB color components  
    gl_FragColor =   texture2D(bitmap, vec2(uv.x        , uv.y));
    gl_FragColor.g = texture2D(bitmap, vec2(uv.x - d*0.5, uv.y)).g;
    gl_FragColor.b = texture2D(bitmap, vec2(uv.x - d    , uv.y)).b;

    // add fake raster lines to glitch
    if (floor(mod(gl_FragCoord.y * 0.333, 2.0)) == 0.0) {
        gl_FragColor.rgb *= 1.0 - (0.8 * d);
    }

}

its this shader https://www.shadertoy.com/view/WlXcDr the alternative one @TheLeerName mention if it complains about the gl_FragCoord then please let me know

TheLeerName commented 2 weeks ago

so its like makes error cuz © symbol, i fixed that in 6162e90 let me know if it not work again 😉

and @JonnycatMeow read about markdown syntax highlighting 😅

JonnycatMeow commented 2 weeks ago

thank you man i appreciate the guide i didn't know how to do it lol