Help with shaders

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ITISTHEBKID
Prole
Posts: 8
Joined: Sun Nov 11, 2018 9:45 pm

Help with shaders

Post by ITISTHEBKID »

I currently have this code:

Code: Select all

[[
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
		vec4 pixel = Texel(texture, screen_coords);
		vec2 coords = vec2(texture_coords.x,screen_coords.y+1);
		vec4 Upixel = Texel(texture,coords);
		if (Upixel.a < pixel.a){
			float average = (Upixel.a+pixel.a)/2;
			Upixel.a = average;
			pixel.a = average;
		} 
}
]]
The problem is when I draw a circle, the shader does not rise at all(I'm creating a smoke shader), and cannot seem to get the alpha of pixels from outside the circle
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Help with shaders

Post by pgimeno »

The texture_coords of a circle or rectangle or line are always vec2(0,0), because the texture is just one white pixel (or at least it behaves as if it is). I can't look into your shader in enough detail now but maybe that info helps.
User avatar
4vZEROv
Party member
Posts: 126
Joined: Wed Jan 02, 2019 8:44 pm

Re: Help with shaders

Post by 4vZEROv »

Draw your circle on a canvas and then use the shader on the canvas
Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests