huperephanos
Member
Hello, all. I've been using the GMS2-Spine integration for a while now, even reported a couple of bugs that have since been confirmed and fixed by YYG. It's generally a decent tool, until I get to shaders.
Trying to combine shaders that are more complex than "absurdly simple" with Spine Sprites results in very, very frustrating coding sessions for me. I've reported specific issues in the past either on the Discord or on Reddit to no avail, but I let them go because I had feasible workarounds in mind. However, the deeper I get into serious projects, the harder it is to accept such workarounds, and the harder it is to come up with creative solutions that don't use shaders - mainly when you consider those solutions use CPU rather than GPU.
Having said that, how would one deal with v_vTexcoord properly on a spine sprite? Shaders that depend on it behave oddly during animations, even more so when the animation changes slot images.
Here is the shader:
Here is the result:
Drawing to a surface and applying the shader to the surface is not an acceptable solution in this case. Besides, it is hardly a solution, it's much more of a workaround.
Trying to combine shaders that are more complex than "absurdly simple" with Spine Sprites results in very, very frustrating coding sessions for me. I've reported specific issues in the past either on the Discord or on Reddit to no avail, but I let them go because I had feasible workarounds in mind. However, the deeper I get into serious projects, the harder it is to accept such workarounds, and the harder it is to come up with creative solutions that don't use shaders - mainly when you consider those solutions use CPU rather than GPU.
Having said that, how would one deal with v_vTexcoord properly on a spine sprite? Shaders that depend on it behave oddly during animations, even more so when the animation changes slot images.
Here is the shader:
GML:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float iTime;
void main() {
gl_FragColor = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec4 fragColor = gl_FragColor;
vec2 uv = v_vTexcoord;
float speed = 2.0;
float linewidth = 0.05;
float grad = 5.0;
vec4 col1 = vec4(0.2, 0.2, 0.4, fragColor.a);
vec4 col2 = vec4(0.4, 0.2, 0.6, fragColor.a);
// Plot line...
vec2 linepos = uv;
linepos.x = linepos.x - mod(iTime*speed, 0.55)/15.0 - 0.45;
float y = linepos.x * grad;
float s = smoothstep(y - linewidth, y, linepos.y) - smoothstep( y, y + linewidth, linepos.y);
// Merge texture + Glint
fragColor = fragColor + (((s * col1) + (s * col2)));
gl_FragColor = fragColor;
}
Drawing to a surface and applying the shader to the surface is not an acceptable solution in this case. Besides, it is hardly a solution, it's much more of a workaround.