#Forum to help Lint because i'm stupid
97 messages · Page 1 of 1 (latest)
if its not tearing on the gui but does on the app surface then its possible your app surface is too small
like doesnt have enough resolution
what does the original texture look like and what texture settings are you using
you are drawing the app surface on the app surface, I am wondering if maybe that tearing is showing under the drawn surface?
I tossed that Shader on a rectangular sprite and it the waving did not fully fill the rectangle space.
try drawing like a black rectangle under it to see
@dreamy sequoia
other than that the shader worked fine for be, maybe try applying it to sprites or a bg later instead of the app surface
maybe draw it to a surface and draw that surface
instead of using the app surface
make a surface, draw the looping tiles to the surface, and then draw the surface with the shader applied to it
oh the tiling would explain it yeah
cause of the way gm tiles things
drawing it tile to a surface and then doing the shader on the surface would be best, like bitebox said
//create
surface = -1;
//draw
if (surface_exists(surface) == false) {
surface = surface_create(width, height);
surface_set_target(surface) {
draw_clear_alpha(c_black, 0.0); //do this is the sprite has transparency
draw_sprite_stretched(sprite, 0, 0, 0, width, height); //activate 9 slicing and set everything to repeat
surface_reset_target();
}
}
shader_set(shader) {
draw_surface(surface, 0, 0);
shader_reset();
}```
use a surface
did you apply the shader to the surface or to the sprite on the surface?
yeah in my example, the shader is applied to the surface not the drawn sprite on the surface
send me the sprite
no like
the actual sprite
the one u use in the game
are you sending it time
it needs time to work
are you sending it time
and using time in the shader
show me your gml and your shader now
//create
surface = -1;
//draw
if (surface_exists(surface) == false) {
surface = surface_create(640, 360);
surface_set_target(surface) {
draw_sprite_tiled(sprite, 0, 0, 0);
surface_reset_target();
}
}
shader_set(wave) {
shader_set_uniform_f(
shader_get_uniform(wave, "time"),
current_time
);
draw_surface(surface, 0, 0);
shader_reset();
}
//fragment shader
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time;
const float speed = 0.004;
const float Xfrequency = 10.0;
const float Xsize = 0.02;
void main()
{
vec2 wavey = vec2(v_vTexcoord.x + sin(time * speed + v_vTexcoord.y * Xfrequency) * (Xsize * v_vTexcoord.x), v_vTexcoord.y);
vec4 color = texture2D(gm_BaseTexture, wavey);
gl_FragColor = color;
}```
how are you trying to do that?
well, regardless, since youre moving them on the surface you have to change up how you draw to the surface
//create
surface = -1;
//draw
if (surface_exists(surface) == false) {
surface = surface_create(640, 360);
}
surface_set_target(surface) {
draw_clear_alpha(c_black, 0.0);
draw_sprite_tiled(sprite, 0, PUT X HERE, PUT Y HERE);
surface_reset_target();
}
shader_set(wave) {
shader_set_uniform_f(
shader_get_uniform(wave, "time"),
current_time
);
draw_surface(surface, 0, 0);
shader_reset();
}```
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time;
const float speed = 0.004;
const float Xfrequency = 10.0;
const float Xsize = 0.02;
void main()
{
vec2 wavey = vec2(v_vTexcoord.x, v_vTexcoord.y + sin(time * speed + v_vTexcoord.x * Xfrequency) * (Xsize * v_vTexcoord.y));
vec4 color = texture2D(gm_BaseTexture, wavey);
gl_FragColor = color;
}
```this would make it work on y instead of x @dreamy sequoia
wait then what was the actual ask
do you have a video of the effect youre trying to get, like an example?
yeah thats a little more complex than a simple sine wave heh
that looks more like a gershner wave
you can just swap the coords like i did last night
like if flipping doesnt work
then you need a better shader for the effect
what values are you using for those multipliers
i think using all 1s for this breaks the shader
lemme plug it into the one we worked out last night
hmm. this is what your code does now
can you share the shader youre using now
this code produces the same result as the video i showed you
so if youre using this code but trying to invert it to get the effect on y, this would explain why it doesnt work
i literally just copy pasted your code, i was gunna ask you that
but even, this is a weird sine wave
youre not adding the wave to x you've put x in the wave
yeah not sure how this code is supposed to do that. you're not adding to X here so the wave produces what is as close to nothing as you can get heh
it is just arrange differently
i used 1 line instead of two
but its literally the exact same code and numbers
so yeah not sure how its working for you: either its not the code youre actually using or you havent tested it yet. seems like you rearranged the shader we worked out last night
but for a slinky or wave to work you need to be adding to the uvs
not including them
right, what im saying, is it seems like you just took what we did last night and changed it a bit
last night you asked about a vertical wave and i gave you this version of it:gml vec2 wave vec2(v_vTexcoord.x, v_vTexcoord.y + sin(time * speed + v_vTexcoord.x * Xfrequency) * (Xsize * v_vTexcoord.y));see how we're adding to the texture coordinate on the y axis instead of including it
if you rewrote the code you showed me today, to work, it just produces the same result as the shader last night
if it worked to make horizontal slinky, then flipping the axis if the wave would work to make it vertically slinky
but getting it working horizontally is just a regular sine wave
yes
all youre doing is changing your variables by multiplying them by something, youre not actually changing the wave behavior
just the frequency and amplitude of the sine wave
so what you need is a wave that moves back and forth
which is a gershner wave
for that we want something more like this
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time;
const float twopi = 3.14*2.0;
const float amplitude = (1.0 / 128.0);
const float wavelength = 1.3;
const float speed = 0.0001;
void main()
{
float phase = twopi / wavelength;
float frequency = (v_vTexcoord.y - speed * time);
vec2 uv = vec2(v_vTexcoord. x, v_vTexcoord.y * sin(phase * frequency));
vec4 color = texture2D(gm_BaseTexture, uv);
gl_FragColor = color;
}```
this is what the shader does just like, by itself without any change. just like the earthbound video you sent
in this video with scary lookin james, it looks like youre doing other stuff
oh you also need to turn texture repeating on
no, in code
like this
//create
surface = -1;
//draw
if (surface_exists(surface) == false) {
surface = surface_create(128, 128);
surface_set_target(surface) {
draw_sprite_tiled(sprite, 0, 0, 0);
surface_reset_target();
}
}
shader_set(wave) {
shader_set_uniform_f(
shader_get_uniform(wave, "time"),
current_time
);
gpu_set_texrepeat(true);
draw_surface(surface, 0, 0);
gpu_set_texrepeat(false);
shader_reset();
}```
also this line in the shader:
const float amplitude = (1.0 / 128.0);```
needs to be 1 / whatever the height of your surface is
are you combining this with a different shader? did you implement this in a weird way, etc?
show me your shader and gml
is your application surface only 180 pixels tall?
doubt its right
are you using it with a different shader
it is not possible for this shader to do the blurring on the sides
in your screenshot
okay so really the problem is that you dont like the shader's effect then haha
that little edge break there is caused by the sprite not tiling properly
this is how you make tiling work
one sec, sprucing this shader up
this is the look u want right
okay here is your new shader
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time;
const float twopi = 3.14*2.0;
const float amplitude = (1.0 / 128.0) * 24.0;
const float wavelength = 4.0;
const float speed = 0.001;
void main()
{
float phase = twopi / wavelength;
float frequency = (v_vTexcoord.y - speed * time);
vec2 uv = vec2(v_vTexcoord.x, v_vTexcoord.y + (amplitude * sin(phase * frequency)));
vec4 color = texture2D(gm_BaseTexture, uv);
gl_FragColor = color;
}```
remember to change that 128 to 180
and here is your new sprite
no actually you dont even need to split this one
this is your new old sprite