Your welcome Game_Code_here
Thankyou Blink
Ive been trying to improve the effect so as its more just flames around the sprites edge /banner etc
and ive come up with the below solution. The problem is with it is that the edge is the same pixel several times (outlinesize)
when i need it to be the offset one. like in the previous and above results but only in the outlined area.
I hope someone can see this like janbo and point me in the right direction
+ Code Snippetuniform sampler2D texture0;
varying mediump vec2 uvVarying;
varying mediump vec4 colorVarying;
uniform vec2 agk_resolution;
uniform float time;
uniform vec2 center;
uniform float outlineSize;
uniform float Percentage;
float snoise(vec3 uv, float res)
{
const vec3 s = vec3(1e0, 1e2, 1e3);
uv *= res;
vec3 uv0 = floor(mod(uv, res))*s;
vec3 uv1 = floor(mod(uv+vec3(1.), res))*s;
vec3 f = fract(uv); f = f*f*(3.0-2.0*f);
vec4 v = vec4(uv0.x+uv0.y+uv0.z, uv1.x+uv0.y+uv0.z,
uv0.x+uv1.y+uv0.z, uv1.x+uv1.y+uv0.z);
vec4 r = fract(sin(v*1e-1)*1e3);
float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);
r = fract(sin((v + uv1.z - uv0.z)*1e-1)*1e3);
float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);
return mix(r0, r1, f.z)*2.-1.;
}
void main()
{
vec4 finalColor;
vec2 pixelSize = vec2(1.0)/agk_resolution;
vec4 pixel_color = texture2D(texture0, uvVarying);
vec2 p=vec2 (uvVarying-center);
finalColor=pixel_color;
if (pixel_color.a <= 0.75)
{
pixel_color = colorVarying;
pixel_color.a =0;
float color = 3.0 - (3.*length(2.*p));
for (float x = -ceil(outlineSize); x <= ceil(outlineSize); x++)
{
for (float y = -ceil(outlineSize); y <= ceil(outlineSize); y++)
{
//vec3 coord = vec3(atan(p.x,p.y)/6.2832+.5, length(p)*.4, .5);
if (texture2D(texture0, uvVarying + vec2(x*pixelSize.x, y*pixelSize.y)).a == 0.0 || (x==0.0 && y==0.0))
continue;
for(int i = 1; i <= 7; i++)
{
float power = pow(2.0, float(i));
vec3 coord = vec3(atan(p.x,p.y)/6.2832+.5, length(p)*.4, .5);
//float offset= (colorVarying.a / (pow(x,2.0)+pow(y,2.0) + outlineSize * 20.0)*(Percentage * 0.01));
//vec3 coord = vec3(atan(p.x+offset,p.y+offset)/6.2832+.5, length(p)*.4, .5);
pixel_color += (1.5 / power) * snoise(coord + vec3(0.,-time*.05, time*.01), power*16.);
pixel_color.a = min(pixel_color.a,1.0);
}
if (pixel_color.a > 0.75)
{
finalColor=vec4(color,pow(max(color,0.),2.)*0.4,pow(max(color,0.),3.)*0.15,1.0);
}
}
}
}
gl_FragColor = finalColor;
}
the way i use those modifications is as follows
+ Code Snippetimage=loadimage("myLogo.png")
LoadSpriteShader(sh,"flaming2.ps")
spr=createSprite(image)
SetSpritePosition(Spr, 0, -128)
SetSpriteShader(spr,sh)
SetShaderConstantByName(sh,"outlineSize",10.0,0.0,0,0)
SetShaderConstantByName(sh,"offset",1.0 / 128.0,0.0,0,0
do
Time#=Time#+8.5*getframetime()
SetShaderConstantByName(sh,"time",Timer(),0,0,0)
Print( ScreenFPS() )
Sync()
loop
if anyoneone can help so as it doesnt repeat the same colour outline size times that would be really helpfull thankyou in advance