Wednesday, August 21, 2019

unity - Season Change Reveal Effect


I was watching the teaser trailer for Seasons After Fall, and I was struck by the effect they use to transition between seasons (around 21-24 seconds):


Animation showing the reveal effect


The level art, including the background and the foreground platforms, change from a sepia-coloured autumn to a lavender winter, with the effect spreading outward from the player character a bit like water soaking through paper.



It looks like more than just a palette change, as details in the leaf and bark patterns change in the transition.


How could I achieve an effect similar to this in a 2D Unity game?



Answer



One way to accomplish this would be to blend between the two backgrounds using an alpha map. A simple approach would be to render the "back" (hidden) background, and then the "front" (initially-visible) background. Use the alpha channel of the front background, or a separate alpha texture, to control the transparency of the front background as you would any transparent or translucent sprite. Where this alpha map is less than one, parts of the back background will show through.


Then it's just a matter of building that alpha map according to the effect you'd like. In the video you show off, it looks like such a map was built with a "painterly" kind of approach. This might involve randomly placing circles of zero alpha (that feather off to 1.0 alpha around their edges). Start placing these circles tightly biased around the origin of the reveal, and over time relax the bias so they spread outward. As you do this you'll probably want to expand the radius of the circles as well.


You can tweak this approach as you need it to tailor the effect to your desires; plain circles might end up looking a little too "blotchy" for example, and you might instead want to randomly stamp a randomly-selected pre-authored "brush stroke" into the mask instead. Even random placement itself might look a little too disorderly, and you might instead opt for stamping the alpha mask along some pre-authored curve or spline to highlight a particular style.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...