Jump to content

Shader woes


Alienhead
 Share

Recommended Posts

Hoping someone might spot instantly what I cant find wrong with my shader.. it won't run under LE.   Thanks for your time.

 

SHADER version 1
@OpenGL2.Vertex
#version 400
#define MAX_INSTANCES 256

@OpenGL4.Fragment
#version 400
#define BFN_ENABLED 1

out vec4 fragData0;
uniform float currenttime;
float time = currenttime/1000;
uniform vec2 buffersize;

uniform sampler2D texture1;
uniform bool isbackbuffer;

float range = 0.05;
float noiseQuality = 250.0;
float noiseIntensity = 0.0088;
float offsetIntensity = 0.02;
float colorOffsetIntensity = 1.3;

float rand(vec2 coord)
{
    return fract(sin(dot(coord.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

float verticalBar(float pos, float uvY, float offset)
{
    float edge0 = (pos - range);
    float edge1 = (pos + range);

    float x = smoothstep(edge0, pos, uvY) * offset;
    x -= smoothstep(pos, edge1, uvY) * offset;
    return x;
}

void main(void)
{
	vec2 uv = gl_FragCoord.xy / buffersize.xy;
	if (isbackbuffer) uv.y = 1.0 - uv.y;

    for (float i = 0.0; i < 0.71; i += 0.1313)
    {
        float d = mod(time * i, 1.7);
        float o = sin(1.0 - tan(time * 0.24 * i));
    	o *= offsetIntensity;
        uv.x += verticalBar(d, uv.y, o);
    }
    
    float uvY = uv.y;
    uvY *= noiseQuality;
    uvY = float(int(uvY)) * (1.0 / noiseQuality);
    float noise = rand(vec2(time * 0.00001, uvY));
    uv.x += noise * noiseIntensity;

    vec2 offsetR = vec2(0.006 * sin(time), 0.0) * colorOffsetIntensity;
    vec2 offsetG = vec2(0.0073 * (cos(time * 0.97)), 0.0) * colorOffsetIntensity;
    
    float r = texture(texture1, uv + offsetR).r;
    float g = texture(texture1, uv + offsetG).g;
    float b = texture(texture1, uv).b;

    fragData0 = vec4(r, g, b, 1.0);
}

 

  • Like 1

    www.abinary.life
sign.png.9d988dae25b9fc33bbd2032e0d36d28d.png

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...