12
2013
Water Particles
Converted this javascript demo to Unity C#: Aqualibrium by Gerard Ferrandez
Info:
– Had to make some modifications since all those javascript [this] that.x variables were quite complicated..but seems to work 🙂
– Screenshot shows 500 spheres with debug.drawlines to each neighbour particle (added gravity on by default)
Current version:
– Got distance calculation bit faster (mainloop went from: 192ms for 1500 particles, to: 104ms for 1500 particles) (debug.linedraw is on): using this sphere Distance Between 2 points
– If I use default sphere as prefab for the particle, it doesnt get batched, but default cube does ..Oo?
TODO:
– 3D version?
– Add Blobmesh = water?
– Optimize..if can..
– Different fluidish materials? (mass, friction, break-ability?)
– Sand simulation? (ground digging with excavator..or maybe better using the eulerian water sim grid?)
– Test threading? http://unitygems.com/threads/
Webplayer:
http://unitycoder.com/upload/demos/WaterParticles1/ (500 particles)
http://unitycoder.com/upload/demos/WaterParticles2/ (additive particle shader)
Download source:
waterParticles.unitypackage
—
Image#2: Testing threading with 1500 cubes.. its fast & kind of works, but some particles wont slown down at all..
(click for full size)
—
Image#3: Nice idea here..but it would pretty much need unity pro: http://www.patrickmatte.com/stuff/physicsLiquid/
Tried with additive particle shader instead:
(click for full size)
—
Image#4: Scaling particles based on neighbour count (would be also interesting to stretch them based on speed..)
(click for full size)
Related Posts
17 Comments + Add Comment
Leave a comment
Recent posts
- LudumDare59 : Signal
- Unity Editor: Tree Generator
- Leaf/Foliage Generator Tools (Runs in Browser)
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
- Convert LAS/LAZ/PLY pointclouds to GLTF (GLB) Point Meshes (standalone converter)
Recent Comments
- on Mesh Exploder (sources)
- on Sprite Sheet Flip Book Shader
- on Sprite Sheet Flip Book Shader
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by













Do you have the source code posted?
Do you…? D=
Its coming up in next couple weeks.. need to fix/clean it up after it went broken with all the threading tests etc 🙂
This is seriously epic.. Very genius. 😀 Hope your SC is flexible, as in allowing for particles to be attracted rather than pushed..
Very cool result!
Can you share the source code with us?
Tks 😀
Source added.
[…] Water Particles « UnityCoder – Unity3D […]
2D dynamic fluid simulation (webplayer demo)
http://forum.unity3d.com/threads/205291-2D-dynamic-fluid-simulation
First of all, thanks for this! Really appreciate it!
What mesh do I use with this? I opened the file and the SphereParticle did not have a mesh attached with it, so when I clicked play, it did not show anything.
I’ve tried it with a Sphere particle which doesn’t look right enough and has 700 draw calls because of the routine in the for loop that creates the 700 particles. However when I tried it with the Quad mesh, it resulted in 1 draw call but that doesn’t look enough like water either.
So what mesh do we use? The mesh options that comes with Unity Free version don’t seem to make it look correctly like the water in the demo web player. What did you use?
hmm, might had been a custom quad mesh (from http://wiki.unity3d.com/index.php/CreatePlane ) ** yes, it was: custom mesh from createplane “Plane1x1W1L1HC”
(and transform scale was 32)
Awesome! That worked mgear! Thank You.
I noticed you showed a better version of water particle based simulation on the Unity forums. I was wondering if you can guide me on what I can do to achieve what you showed on the Unity forums. I don’t need the full source but some guidance on what could be adjusted, the direction and such should be enough.
you have the link to that topic?, cant remember what was it..
The link is here: http://forum.unity3d.com/threads/205291-2D-dynamic-fluid-simulation
What did you change specifically to make it more realistic and better colors? A different shader?
The link is here: http://forum.unity3d.com/threads/205291-2D-dynamic-fluid-simulation
What did you change specifically to make it more realistic and better colors? A different shader?
actually that is not mine 🙂 i saw that while ago also, looks very nice! (but needs unity pro for render textures, readpixels could work but slower..), to me it looks like using this idea or similar: http://www.patrickmatte.com/stuff/physicsLiquid/
Ahh nvm. It seems you were able to achieve scaling particles based on neighbour count in Image #4. How did you implement that? Did it change the performance in a bad way?
I think it didnt change it much, as it was only doing this:
// scale by neighbour count
// float s = Mathf.Clamp(ncount*0.5f, 0.5f,32.0f);
// this.obj.localScale = new Vector3(s,s,s);