Coordinates in the runtime go from 0 to 1, from top to bottom and from left to right of the screen.
In the Editor, though, this is from the edge of the EDITING WINDOW, not the layout, so effects get different coordinates.
That said, you are testing for an int result of a modulus
so if you were thinking integer pixels
vpos=0 -> vpos%2 = 0, darken
vpos=1 -> vpos%2 = 1, ignore
vpos=2 -> vpos%2 = 0, darken
vpos=3 -> vpos%2 = 0, ignore[/code:35mxhfk7]
but the shader is fractional
[code:35mxhfk7]
vpos=0 -> vpos%2 = 0, darken
vpos=0.3 -> vpos%2 = 0.3, ignore
vpos=0.7-> vpos%2 = 0.7, ignore
vpos=1 -> vpos%2 = 1, ignore
vpos=1.2 -> vpos%2 = 1.2, ignore
vpos=1.7 -> vpos%2 = 1.7, ignore
vpos=2 -> vpos%2 = 0, darken[/code:35mxhfk7]
As you can see, depending on the size in pixels the effect will look very different.
I recommend the following test instead
[code:35mxhfk7]if(vpos%2 > 1)[/code:35mxhfk7]
ALL THAT SAID.... yeah, the diagonal line shouldn't be there at all, and the scanlining should be regular, so yeah it looks like a bug in effect coordinates.....
MORE TESTING REVEALS that this effect only happens when there's more scanlines than physically possible (half the vertical resolution). Why? no idea, but while testing, I ended up writing a full scanlines shader, so here it is.
EDIT: Posted as addon: [url]http://www.scirra.com/forum/viewtopic.php?f=29&t=5643[/url]
you may change number of shown scanlines, scanline width and intensity of the effect. No offset, because I didn't feel like it.
Thank you very much, madster
I am mislead by "pixelHeight". I thought it was the factor, the height of one pixel in units and that coordinates would give results in units orienting at pixelHeights, so that dividing would lead to integer pixel values. Listened and learned.
I will post to the tracker, and hopefully find workarounds for the bug in transmitting the coordinates to the shader.