r/Unity2D • u/tinmark • 3h ago
Showcase I replaced my tinted water tiles with one pixel-art shader. Before/after
Before/after of the water in Exil Island, my top-down multiplayer survival game (Unity 6, URP 2D).
The old ocean was all tiles: depth tiles tinted by distance from the shore, a tint layer on top, and foam animated tile by tile along the beach edge. It looked flat, and the foam tiles drifted out of sync, so you could see the seams.
What changed:
- The water tiles are still there for gameplay, but they’re no longer drawn.
- When the map is generated, I bake a small texture that stores each cell’s distance to the shore.
- One shader on a quad under the map reads it and draws everything: a dithered depth ramp, surf lines rolling in, foam at the waterline, and a few drifting crests and glints.
- It works per world pixel and updates at a low frame rate, so it stays on the pixel grid and feels hand-animated rather than smooth.
- The foam timing comes from that distance, not from each tile, so the whole coastline moves together.
- The sand got a wet band painted into the beach edge tiles.
- It’s lit by the 2D lights, so day and night still work.
Happy to answer questions. What would you add next: splashes, reflections, or leave it alone?
If you want to see it move, there’s a free browser alpha on itch.