Jump to content

Recommended Posts

Recently, the moonstorm has inspired me into researching and creating shaders but I can't wrap my head around them...

Currently I've managed to cobble together this basic PixelShader

#ifdef GL_ES
precision mediump float;
#endif

uniform sampler2D SAMPLER[1];
varying vec2 PS_TEXCOORD;
varying vec4 PS_COLOUR;

uniform vec2 ALPHA_RANGE;
uniform vec4 IMAGE_PARAMS;

////PARAMETERS

#define TIME		IMAGE_PARAMS.x  
#define OSCILLATION	IMAGE_PARAMS.y //How much our wave dips and rises
#define FREQUENCY	IMAGE_PARAMS.z //How often we wave
#define VELOCITY	IMAGE_PARAMS.w //How quickly we wave
 
void main()
{
    float SineTest = (sin(FREQUENCY*PS_TEXCOORD.y - TIME*VELOCITY)) * OSCILLATION;
    vec2 Test = vec2(PS_TEXCOORD.x, PS_TEXCOORD.y + SineTest);
    vec4 colour = texture2D( SAMPLER[0], Test);
    colour.rgba *= PS_COLOUR.rgba;

	gl_FragColor = colour;
}

Which results in a lovely wave effect from the top down on the widget I'm using it on! Its also not what I need for a future idea... I've looked at the moonstorm shader to figure out how it scrolls its dust textures across the screen / creates the circle you can see the player in, but I can't seem to figure it out. Any ideas?

Link to comment
https://forums.kleientertainment.com/forums/topic/145839-custom-shader-help/
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...