#Twist Distortion Default Shader

11 messages · Page 1 of 1 (latest)

unborn sail
#

Hi! I'm trying to use the default shader that GM includes for create a Twist Distortion in a sprite, I attach the shader.

And this is the code for the obj that I want to apply the shader:

draw event:

shader_set(sh_twirldist);
 

shader_params = shader_get_uniform(sh_twirldist, "g_DistortAngle");
shader_set_uniform_f(shader_params, 1.0);

shader_params2 = shader_get_uniform(sh_twirldist, "g_DistortRadius");
shader_set_uniform_f(shader_params2, 1.0);

shader_params3 = shader_get_uniform(sh_twirldist, "g_DistortOffset");
shader_set_uniform_f(shader_params3, 0.0, 0.0);

draw_self();

shader_reset();

What happens right now is that nothing is draw. Do you know what I'm doing wrong? I think that I'm missing something 😦

humble basin
#

does it draw without the shader applied?

unborn sail
#

yes, it does

#

this is how it looks with no shader

humble basin
#

the other thing i would try is messing with the parameters, esp angle and radius...but debugging a shader is a bit out of my wheelhouse

unborn sail
#

I tried to use higher numbers but no change :S

#

If i write in the shader something like:

g_DistortAngle = 341.0;
g_DistortRadius = 13.0;
g_DistortOffset = vec2(1.0, 0.0);
It do show the image, but it doesn't distort it

It does show the image, but it doesn't create the distortion effect

humble basin
#

try a smaller number for Radius, no offset, no angle

#

basically try to re-create the "no change" state

unborn sail
#

no change 😦

#

Little improvement: If I paste this:

uniform float g_DistortAngle;
uniform float g_DistortRadius;
uniform vec2 g_DistortOffset;

into the void main()
{
}