gotad
Member
Hey guys!
I've been trying to get my simple character shading shader working properly for my game, but I know nothing about building said shaders myself.
Here's what I'm dealing with:
The goal is to simply draw a darker portion of the character on the side of the sprite, like this:
But, here's the issue:
As you can see, some characters have trouble drawing their shader because of their outlines. The right brim of the mage hat's outline tricks the shader into not drawing fully, since it doesn't ignore the black outline.
How might I make the shader ignore the black outline when navigating the sprite? Or, simply ignore the color black entirely. Here's another example of the problem:
You can see bits near his legs that are getting clumpy thanks to this outline.
Any help would be appreciated! Thanks in advance guys
I've been trying to get my simple character shading shader working properly for my game, but I know nothing about building said shaders myself.
Here's what I'm dealing with:
GML:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec2 offset = vec2(0.005,0.0);
vec3 shade_color = vec3(0,0,0);
float mix_amount = ceil( texture2D( gm_BaseTexture, v_vTexcoord + offset ).a );
vec4 base_color = (v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ));
gl_FragColor = vec4( mix(base_color.rgb, shade_color, (1.0 - mix_amount) * 0.25), base_color.a );
}
But, here's the issue:
As you can see, some characters have trouble drawing their shader because of their outlines. The right brim of the mage hat's outline tricks the shader into not drawing fully, since it doesn't ignore the black outline.
How might I make the shader ignore the black outline when navigating the sprite? Or, simply ignore the color black entirely. Here's another example of the problem:
You can see bits near his legs that are getting clumpy thanks to this outline.
Any help would be appreciated! Thanks in advance guys
Attachments
-
2.3 KB Views: 42