I am trying to make a fragment shader for a 2d art style im working on. But to make that work i must make a texture able to overlap itself multiple times.
result i want and the 2 current results:
Edit1: in my art style i have 1 texture per plane. to make the illusion of each plane having thickness i need it to draw it self 2 times, with one pixel distance.
illustration:
if it was drawn a green plane then a blue plane, yes i would like to replace the green area with blue where it overlaps.
I have attempted to subtract the next texture location to nullify texture blending, but resulted in also adding negative values at empty area.
```
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float shxx;
uniform float shyy;
void main()
{
vec2 Coord1 = v_vTexcoord + vec2(0,0);
vec2 Coord2 = v_vTexcoord + vec2(shxx,shyy);
vec2 Coord3 = v_vTexcoord + vec2(shxx+shxx,shyy+shyy);
vec2 Coord4 = v_vTexcoord + vec2(+shxx+shxx+shxx,+shyy+shyy+shyy);
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, Coord1)
- v_vColour * texture2D( gm_BaseTexture, Coord2)
+ v_vColour * texture2D( gm_BaseTexture, Coord2)
- v_vColour * texture2D( gm_BaseTexture, Coord3)
+ v_vColour * texture2D( gm_BaseTexture, Coord3)
- v_vColour * texture2D( gm_BaseTexture, Coord4)
+ v_vColour * texture2D( gm_BaseTexture, Coord4);
}
```