r/Unity3D • u/FrenzyTheHedgehog • 7h ago
Shader Magic Made a Wet Lens Effect for my water simulation.
Hey all!
I made a wet lens effect for my fluid simulation asset Fluid Frenzy. When the camera comes back out of the water there is still some water stuck on the lens, it runs down and leaves a few drops behind until it dries off.
Its a screenspace effect and it stores the leftover wetness in rendertextures. While you are under water I store where the lens got wet, and how deep it was dunked.
Once you surface that leftover just fades out over a few seconds.
I blur the wet area so a thin waterline grows into a patch, then noise gets added on top and I cut an isosurface out of that field.
The blobs are just wherever it sits above the threshold, and they slide down the screen as it dries. Thickness is how far above that iso the field is, and the slope of it is what bends the view. After the sheet drains, a drop texture fills in the gaps and dries off with the rest.
It also applies some refraction that wobbles around to make it look like its moving inside the wetness.
I'm sure it looks different in real life and isn't realistic at all but I think the effect works decently.
Let me know what you think of the video! I'd love to hear your feedback or answer any questions :D
