Hello,
I have just started my adventure with Unity so my question may seem silly to experienced users but anyway I’ll give it a try. If you could just give me couple of keywords I could search for in order to solve my problem I would be very grateful.
As a sample project I wanted to create 2D pixel platformer, something like Contra. All went well up to the moment when I wanted to add some blood dripping from my enemies. I got stuck on generating the blood particles and simulating them painting over the ground. The effect I want to achieve looks like this: (live example: http://jsfiddle.net/0pg0LpL1/4/embedded/result/ , animated gif: Imgur: The magic of the Internet)
I am wondering what is the best approach to achieve such effect. I thought about generating the texture of blood stains on the fly and placing it before camera. It would look like this: scene < blood texture < camera. The blood texture would be generated from lines drawn by “flying” blood particles masked by the ground/platforms texture:
- Blood particle traces:
Imgur: The magic of the Internet - Ground mask: Imgur: The magic of the Internet
- Masked traces (what I call blood
texture): Imgur: The magic of the Internet
What is the best approach to achieve such effect? I know that generating texture with Texture2D.SetPixels on each frame is not optimal. I also see challenge in having a blood texture large enough to span over entire level to keep memory of all the blood spilled. Also the solution with one blood texture will not work if I wanted to have moving platforms that should also be painted.
Thanks in advance for any suggestions.