## Metaballs

unixfreak
Citizen
Posts: 77
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

### Metaballs

This module creates a drawable surface with some HSL bouncing metaballs.

Maybe someone will find this useful as a starting point for something else. Code can be found here:
https://github.com/Jigoku/love2d_metaballs

Basic Usage:

Code: Select all

function love.load()
require("metaballs")
metaballs.create(8) 	-- spawn 8 metaballs
end

function love.draw()
love.graphics.draw(metaballs.surface(),0,0)
end

function love.update(dt)
metaballs.update(dt)
end

This was inspired by a coding challenge video i came across recently: https://www.youtube.com/watch?v=ccYLb7cLB1I
Attachments
metaballs.love

azoyan
Prole
Posts: 18
Joined: Wed Dec 27, 2017 5:19 pm

### Re: Metaballs

Looks great!

YoungNeer
Party member
Posts: 116
Joined: Wed May 15, 2019 7:49 am

### Re: Metaballs

Perhaps I could use this as background in my MainMenuState. Thanks a lot
My Github- your contribution is highly appreciated

grump
Party member
Posts: 595
Joined: Sat Jul 22, 2017 7:43 pm

### Re: Metaballs

Looks nice! I played around with it for a bit and made some optimizations. The calculation is now done in a shader, and the texture is not recreated every frame. It's quickly hacked in though, so the code is far from optimal and not very pretty.
Attachments
metaballs2.love

unixfreak
Citizen
Posts: 77
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

### Re: Metaballs

grump wrote:
Thu Aug 01, 2019 2:18 pm
Looks nice! I played around with it for a bit and made some optimizations. The calculation is now done in a shader, and the texture is not recreated every frame. It's quickly hacked in though, so the code is far from optimal and not very pretty.
Hey, that's cool. Yeah, runs much faster as a shader. I still haven't a clue at writing things via shader language, will have to dig into that more in the future.

### Who is online

Users browsing this forum: No registered users and 4 guests