GithubHelp home page GithubHelp logo

metaballs's People

Contributors

dario-zubovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metaballs's Issues

There's a ridiculous amount of CPU usage and overhead

I've downloaded the project and I noticed that it wasn't actually running any faster than the CPU metaballs I had before - because of the use of Lists (as opposed to arrays) and calling GetComponentsInChildren() every single update, the script's execution time is about 110ms.
I've successfully switched my local copy to cache the MetaBall components in an Awake() function instead, and switched the CubeGrid vertices to an array (needs an arbitrary maximum e.g. 300,000, but it's easy enough to track how many vertices actually get added so we can trim the array down to size before setting mesh.vertices to it in the container script).

Here's the updated files, credit would be appreciated if you use them anywhere else <3 God bless ye!
CubeGrid.txt
Container.txt

Questions before using this

First off, let me say that this looks absolutely awesome. I wanted to use metaballs in my game a couple of months ago but could not because honestly the complexity and mathematics used here go far over my head. I had to resort to looking online but all I could found was the horrible metaballs monobehaviour script on the Unity community wikis. It worked but it was all done on the CPU and, by association, was very inefficient. It also had some severe restrictions in that the metaballs seemed to be bound within a single box, and all of the metaballs themselves had to be managed by that single script; You could not just add a single metaball at the start of the game, then later add another far back and gradually move it over and see them connect.

Before I use these, I'd like to know

  • Does it have any of the restrictions above, or anything else I should know about?
  • I am understanding that this runs on the GPU, but how are the performances looking on this? The game I'm making is fairly low poly so I won't have the resolution very high. How many metaballs can I expect to be able to move around before it becomes a problem on an average computer? I will use it mainly for particle effects and stuff like that, where each ball will not have a very long lifespan. It will not run on mobile devices also, so this is out of the equation.
  • Could there be compatibility issues with older cards or will it run on most computers nowadays?
  • Can I use this in a commercial game without any licensing or legal fears. (I would however tip you some money if the game generated any revenue at all, for letting me use this great asset)

Thanks

Mesh normals smoothing

Is there any way for this code to generate smoothed normals?

From my understanding, because the vertices/indices are not shared but each face is in fact entirely composed of different vertices, then RecalculateNormals can't apply smoothing.

This is a major issue as metaballs usually need to appear smooth, and in this implementation they appear extremely blocky.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.