Search Unity

In depth: Procedural water paint stains

Discussion in 'Made With Unity' started by ErwinTerpstra, Apr 4, 2018.

  1. ErwinTerpstra

    ErwinTerpstra

    Joined:
    Sep 29, 2015
    Posts:
    4
    Hi everyone! For our latest serious game I've worked on a neat little water paint stain generator. It generates the following results:



    I'm quite happy with how it turned out! If you want to know more about how I've done this exactly, I've posted an article on our company website detailing the process :)

    You can read the article here: http://www.grendel-games.com/depth-procedural-water-paint-stains/?lang=en
     
    Circool likes this.
  2. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Interesting article, thanks. I read somewhere that GetPixel And SetPixel are relatively slow functions and it is faster to operate on arrays of pixels with GetPixels And SetPixels function. Maybe that was a bottleneck in
    "BlitDrop" function on Android?
     
  3. ErwinTerpstra

    ErwinTerpstra

    Joined:
    Sep 29, 2015
    Posts:
    4
    I didn't go much in-depth about the optimization but we did indeed use the array functions. One other issue that still remained was that we called GetPixels on the drop sprite each time a drop was selected to blit (which is sometimes 10 times per frame).

    GetPixels allocates a new array every time it is called. But since the drop sprites never change, they could easily be cached.

    Glad you liked our article!
     
    Circool likes this.