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
Posts: 8
Joined: Sun Nov 11, 2018 9:45 pm

Help with shaders

Post by ITISTHEBKID » Mon Apr 22, 2019 10:13 pm

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
Party member
Posts: 2307
Joined: Sun Oct 18, 2015 2:58 pm

Re: Help with shaders

Post by pgimeno » Mon Apr 22, 2019 10:46 pm

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
Posts: 93
Joined: Wed Jan 02, 2019 8:44 pm

Re: Help with shaders

Post by 4vZEROv » Mon Apr 22, 2019 11:42 pm

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

Post Reply

Who is online

Users browsing this forum: pgimeno and 30 guests