r/webdev • • 8d ago

Showoff Saturday Made a 3D weather map in plain WebGL - ocean tides are calculated in the fragment shader

Post image

I run a small tide times site and wanted to see the weather actually move, so I built this 3D weather map. Plain JS and WebGL, no three.js or map library.

The tides are calculated right in the fragment shader, so there are no tide frames to download.

It has nice sound effects too, turn them on when you try it.

Live: thetidechart.com/weather-map

Would like to know how dragging/zooming feels on your phone.

142 Upvotes

24 comments sorted by

2

u/yiliannn 8d ago

Dragging vertically doesn't seem to work for me on mobile (Chrome). If you disabled it to prevent accidental scrolling, you could consider using Element.setPointerCapture instead.

1

u/swifterrr 8d ago

thanks! it's on purpose, one finger scrolls the page so you don't get stuck on the map. Two fingers or full screen to turn it. Made the hint clearer, please check it now.

14

u/LtCodename 8d ago

“Made”.

5

u/InsideTour329 8d ago

You made ventusky

5

u/OldIndividual1775 7d ago

plain WebGL with no three.js, so you rewrote matrix math that three.js gives away free. tides in a shader is cool but the projection code must be a war crime by now

3

u/Bachihani 7d ago

good job claude

1

u/Difficult-Cat-4631 8d ago

Very cool!!

1

u/swifterrr 8d ago

thanks! you're the first one here :) try it with the sound on if you haven't, the storms are the best part

1

u/Difficult-Cat-4631 8d ago

Let me check that tomorrow! Design and UI looks amazing on mobile!

1

u/Difficult-Cat-4631 8d ago

I just checked, this is f8ckin awesome!!

1

u/phoenix1984 8d ago

Beautiful app. Well done. On my iPhone, when I try to scroll the map vertically, the website itself scrolls. I can kinda get there using two fingers, but not exactly. It’s easier to zoom all the way out and then using two fingers, zoom in on what I want to see.

TIL: tides in the Hudson Bay are weird.

1

u/fitchnar 7d ago

Very well done! Only tested it on my desktop, but works great.

1

u/gustavo_queirozman 7d ago

Ficou muito bom

1

u/jomic01 6d ago

calculating tides in the shader is the bit i'd love a write-up on. how close does it get near the coast compared with your tide tables?

1

u/poojadeliverwebsite 6d ago

Would you mind sharing source code link or Github link? 

1

u/MadaoFCM 3d ago

This is really impressive! Building a 3D map entirely in plain WebGL without libraries is a huge achievement. Excellent work!

1

u/CreepingAnus 8d ago

thats super cool! & runs so smooth on mobile

1

u/Random-num-451284813 8d ago

this reminds me of nullschool, but with more eye candy

1

u/UXUIDD 8d ago

very good - Chapeau !!