Share a Shader!

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.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Share a Shader!

Post by Ranguna259 »

Once you do please PM me, I'm thinking on combining that shader with a the bloom one to make some awesome effects ;)
(zero gravity physics world with a glowing circle moving around a leaving a motion blur effect, how cool is that :P )

Built this:

Code: Select all

[[
		extern number intensity;
		extern number aspeed;
		vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) {
			vec2 speed = vec2(aspeed, 0.0);
			vec2 offset = intensity * speed;
			vec4 c = vec4(0.);
			number inc = 0.1;
			number weight = 0.;
			for (number i = 0.; i <= .3; i += inc)
			{
				c += Texel(texture, texture_coords + i * offset).rgba;
				weight += 1.;
			}
			c /= weight;
			return c;
		}
	]]
(aspeed should be the speed of the object and I usually set intensity to .1)
Out of the source from this link, it's not really what I wanted but it'll do for now the thing is it's only made for horizontal movement, can someone make this work for vertiacal and diagonal movement ? I still don't undestand a single thing of GLSL :?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Share a Shader!

Post by Ranguna259 »

How awesome is this gif:
Image

EDIT: Does anyone have a polar to cartesian and cartesian to polar shader ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Share a Shader!

Post by xXxMoNkEyMaNxXx »

Cartesian to polar is super easy just use r,theta=sqrt(x^2+y^2),atan2(y,x) for cartesian to polar and use x,y=r*cos(theta),r*sin(theta) for polar to cartesian!
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: Share a Shader!

Post by chezrom »

Hello,

I have modifed my shader that display voronoi's diagram of moving point, working now with löve 0.9.0

It can now display voronoi using three different distances :
  • the euclidian distance (the standard one)
  • the "manhattan distance" (addition of absolute value of x difference and y difference)
  • the "Chebyshev distance" (max of absolute value of x difference and y difference)
You can see a defintion about this distance here : https://en.wikipedia.org/wiki/Distance# ... dean_space

Keys :
  • a point follow the mouse
  • Mouse Left to change colors
  • Mouse right to change movement of other points
  • ESC to quit
  • TAB to change the distance used for computing the diagram
  • any other key to toggle on/off the drawing of the point
EDIT : Thank you Roland, I correct for 'Chebyshev'
Attachments
voronoi.love
(1.39 KiB) Downloaded 511 times
Last edited by chezrom on Tue Feb 04, 2014 10:22 pm, edited 1 time in total.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Share a Shader!

Post by Roland_Yonaba »

It's Chebyshev. Tchebytchev is the French spelling.
Your demo is awesome.
User avatar
CaptainMaelstrom
Party member
Posts: 161
Joined: Sat Jan 05, 2013 10:38 pm

Re: Share a Shader!

Post by CaptainMaelstrom »

qwook wrote:Left 4 Dead style glow
I tried to implement your shader qwook, the glow effect looks really cool in your picture. Unfortunately, I'm not doing something right, as my pig doesn't glow like I think it should:
pigtest.png
pigtest.png (41.22 KiB) Viewed 6238 times
I've attached my .love, I'd appreciate it if you could point out my mistake or explain what's going on in the pixel shader code a bit.
Attachments
glowtest.love
(25.7 KiB) Downloaded 384 times
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: Share a Shader!

Post by chezrom »

CaptainMaelstrom wrote:I tried to implement your shader qwook, the glow effect looks really cool in your picture. Unfortunately, I'm not doing something right, as my pig doesn't glow like I think it should:
In fact the code is a code for bluring not for glowing.
What I undestand of glowing, you want your picture surrounded by an halo.
I draw this halo on transparent zone of the image (with alpha=0).
In this case, try the attached love file.
Of course, the glowing effect is truncated by the border of your image.
The glowing color is the color you have setted by love.graphics.setColor.
Attachments
glowingpig.love
(25.66 KiB) Downloaded 530 times
User avatar
CaptainMaelstrom
Party member
Posts: 161
Joined: Sat Jan 05, 2013 10:38 pm

Re: Share a Shader!

Post by CaptainMaelstrom »

Thanks chezrom.

I figured something out but your implementation is more flexible/accurate.
Palmar
Prole
Posts: 23
Joined: Thu Dec 13, 2012 3:54 pm

Re: Share a Shader!

Post by Palmar »

I am totally confused of Love2D Shader GLSL structure. Could sombody post color inverse shader? Thanks in advance.
Palmar
Prole
Posts: 23
Joined: Thu Dec 13, 2012 3:54 pm

Re: Share a Shader!

Post by Palmar »

Bump.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 7 guests