I would like to create a liquid dynamics. I searched a lot, created balls moving with device motion, but I don't know how to make the balls look like liquid.. I guess it's some mask but I didn't find how to do it. Could someone help me with that? Thanks.
Something looking like liquid in games usually follows the following pattern (there are many ways to do this, with filters, shaders, your own custom opengl stuff):
A lot of balls next to each other
Balls have an alpha gradient. So basically if you do a radial gradient in photoshop on the alpha channel with black color you get a very blurry ball. Or just draw a black ball in photoshop and blur it. You get the point.
You hard contrast (threshold) everything. In effect what this does is at a certain threshold it does either 1.0 alpha or 0.0 alpha. So either on or off.
The idea was clear to me. Didn't know what's the actual filter. Figured it out, the SKSpriteNode is nodeWithImage, the image is a blur ball. Physics body is a ball with a smaller body than the image (so the balls can go a little over each other and become "one piece"). The filter of threshold is set on the scene, like that:
CIFilter *filter = [CIFilter filterWithName:@"CIColorPosterize"];
[filter setValue:@(2.0) forKey:@"inputLevels"];
[scene setFilter:filter];
[scene setShouldEnableEffects:YES];
That's it, if anyone ever reads it and has a problem they're more than welcome to message me for help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With