dario-zubovic / metaballs Goto Github PK
View Code? Open in Web Editor NEWUnity 3D implementation of metaballs and marching cubes algorithm
License: MIT License
Unity 3D implementation of metaballs and marching cubes algorithm
License: MIT License
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
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.
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
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.