Luke Peña
Member
I am making a pixel art game and I want to be able to edge-light clouds from any direction. Here is the effect I'm after:
I want to be able to:
I honestly have NO idea how to work with shaders, so here is what I have so far:
Here is how that turns out:
So right now I can only color it from above. And I don't know how to get an exact color, I only know how to flat change it to black. Plus since it is just displacing its alpha to get the color, it can leave odd spots like the "oops" in the image that don't work.
If anybody is awesome with shaders and could help out, I'd really appreciate it!
I want to be able to:
- supply a direction
- supply a thickness
- supply a color
I honestly have NO idea how to work with shaders, so here is what I have so far:
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float pixelH;
uniform float pixelW;
uniform float set_r;
uniform float set_g;
uniform float set_b;
void main()
{
vec2 offsetx;
offsetx.x = pixelW;
vec2 offsety;
offsety.y = pixelH;
float rr = set_r;
float gg = set_g;
float bb = set_b;
gl_FragColor = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord );
gl_FragColor.r *= ceil( texture2D( gm_BaseTexture, v_vTexcoord + offsety).a);
gl_FragColor.g *= ceil( texture2D( gm_BaseTexture, v_vTexcoord + offsety).a);
gl_FragColor.b *= ceil( texture2D( gm_BaseTexture, v_vTexcoord + offsety).a);
}
Here is how that turns out:
So right now I can only color it from above. And I don't know how to get an exact color, I only know how to flat change it to black. Plus since it is just displacing its alpha to get the color, it can leave odd spots like the "oops" in the image that don't work.
If anybody is awesome with shaders and could help out, I'd really appreciate it!