Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader problem #14734

Open
JHAM25 opened this issue May 25, 2024 · 0 comments
Open

Shader problem #14734

JHAM25 opened this issue May 25, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@JHAM25
Copy link

JHAM25 commented May 25, 2024

Describe your problem here.

When I put this shader in the game it doesn't seem to work. I've tried others and they work. Does anyone know why it doesn't work?
#pragma header
uniform float iTime;
uniform vec2 WaveCentre;
uniform float enabled;
uniform vec2 iResolution;

void main()
{

float offset = (iTime- floor(iTime))/iTime;
float CurrentTime = (iTime)*(offset);    

vec3 WaveParams = vec3(12.0, 1.0, 0.1 ); 

float ratio = iResolution.y/iResolution.x;

   
//vec2 WaveCentre = vec2(0.5, 0.5);

// WaveCentre.y *= ratio;

vec2 texCoord =  openfl_TextureCoordv;      
float Dist = distance(vec2(texCoord.x, texCoord.y*ratio), vec2(WaveCentre.x, WaveCentre.y*ratio));

vec4 Color = flixel_texture2D(bitmap,texCoord);

if ((Dist <= ((CurrentTime) + (WaveParams.z))) &&
(Dist >= ((CurrentTime) - (WaveParams.z))))
{

	float Diff = (Dist - CurrentTime); 
	float ScaleDiff = (1.0 - pow(abs(Diff * WaveParams.x), WaveParams.y)); 
	float DiffTime = (Diff  * ScaleDiff);
    

	vec2 DiffTexCoord = normalize(texCoord - WaveCentre);         
    

	texCoord += ((DiffTexCoord * DiffTime) / (CurrentTime * Dist * 40.0));
	Color = flixel_texture2D(bitmap,texCoord);
    
  
	Color += (Color * ScaleDiff) / (CurrentTime * Dist * 40.0);
} 

if (enabled == 1.0)
{   
    gl_FragColor = Color; 
}
else
{
    gl_FragColor = flixel_texture2D(bitmap,openfl_TextureCoordv);
}

}

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

No

@JHAM25 JHAM25 added the help wanted Extra attention is needed label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant