Tuesday, 10 June 2014

Interesting Advanced Particle Tutorial Unity


We gonna make motion of underwater bubbles using Unity Shuriken particles system.

This tutorial is based on our current game Anoxemia:
http://kostiantyn-dvornik.blogspot.com/2014/02/game-prototype-aqualung.html

I dont care about anything here. Just give me prefab :) -
Download: https://drive.google.com/file/d/0BxgYUKP-c4dJcXVZSldhYk43VzQ/edit?usp=sharing

Common and the most important part of tutorial.

Philosophy( skip it dude, anyway people never learn on others mistakes )

So why do they move that's way ? The reason is Physics. It is simple and complicated part of all tasks. The problem that designers never study physics so they do everything just like they see it and use wrong instruments as results, but anyway get quite acceptable but not accurate results. Even programmers often don't know anything about physics but I was lucky and sadly at same time studding at Physics department.

Theory

1. Bubbles is a big couple of air placed into water that trying to take spherical form.
2. Arhimed power is applied on a bubble so it moves up and increasing velocity
3. Bubbles become bigger because water pressure depend on depth. The deeper object the bigger pressure applied on it so they small.
4. Bubbles change it shape because of anisotropic of water and forces like colliding etc.
5. Bubbles movement looks like sin function with some randoms because of colliding each other.

Practice

1. Create Shuricen particle system
2. Main section of PS
   Start speed set to 0 because we have no start speed on bubbles
   (Your taste) Start Size set to 0.01 it is 1cm middle size of bubbles under water
   (Your taste) Start life time to 1 how long our bubble is alive
   Simulation Space set to world because we want our PS react on movement
   
3. Emmision
   (Your taste ) Emission set to rate at about 20 and Time

4. Uncheck Shape because particles often emitted from one point like hole of oxygen balloon

5. Uncheck velocity over life time because we dont need to control velocity if we control force

6. Check force over life time and set to random between two curves and setup curves as described here


By Y constant force and sin forces by XZ plan to give sin movement and set to world simulation space because we dont want to have troubles when we attach out PS to some object.

7. Set size over lifetime to growing because of bubbles growing


8. Need some artist help. My girlfriend helped me a lot, thanks Julia Maylina, love you. Draw 4 types of bubbles in a row for a bubbles deformation and setup sheet animation as follow.




Texture should looks like this:




Thats how we minimized a lot of components of Shuriken particles and improve perfomance by the way. But just a little bit :)