Exactly as with the drops I set up the UVs and use a SphereMask to draw the drops. However this time I change the radius over time, again using the hash function to generate a random offset. I also got rid of the Distortion and position offset, since I wanted to utilize the entire UV square for the ripples instead of only a part, like with the drops.
Base Setup |
Having this setup, I could move on to actually making the ripples. To get the rings for the ripples I feed the result of the spheremask into a sine node and make them fade out over time.
To get multiple ripples I multiply the sine node input by a number, the higher it is, the higher the number of ripples. I again use the random value to vary this number slightly.
To make the ripple fade, whilst moving away from the center, I use the UVs to create a mask, which looks like this.
Mask |
To make things a bit clearer here is the formula for Linear Interpolate:
L = A * (1 - Alpha) + B * Alpha
That way I get these normals. I want to point out though, that they don't align with the mask anymore. You'd have to do some further maths to fix that, but since I don't need the mask I skipped that step.
This concludes the Rain Material Functions. I will still have to include them in the Master Materials. They where a fun learning experience in the realm of procedural shaders. Here is the complete Function setup plus a close up of the new parts.
MF_Rain_Ripples |
NOTE: These ended up not being visible in our level, since we decided to have relatively shallow puddles.
No comments:
Post a Comment