News for hackers. Stuff that matters.
Re:Ask HN: What are you working on? by tppiotrowski on Thursday January 14, 2021 @09:18PM (#25786144)
Mapping shadows across the earth in real time based on location and time of day.

https://shademap.app/

Things I learned along the way:

- How slippy maps work and Leaflet.js

- Most elevation maps use data collected back in 2000! [1]

- You can perform calculation on the GPU without knowing GLSL [2]

[1] https://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Missi...

[2] https://gpu.rocks/

Re:Ask HN: What are you working on? by pheelicks on Friday January 15, 2021 @01:36AM (#25787730)
Really nice, any plans on showing this on a 3D map? You might be interested in my project, Procedural GL JS: a mobile-first 3D mapping engine with emphasis on user experience. Live demo here: https://felixpalmer.github.io/procedural-gl-js/ (I've also posted separately in this thread).
Re:Ask HN: What are you working on? by tppiotrowski on Friday January 15, 2021 @11:54AM (#25792948)
Wow! This is beautiful and fast. You should be proud of yourself.

There is another project (https://shadowmap.org) that casts shadows in 3D. You might want to reach out to them. For me, I use ray-tracing per pixel because I want more control/information on a per-pixel basis. For example, when will the sun hit the particular location.

Re:Ask HN: What are you working on? by simply_sam on Friday January 15, 2021 @01:56AM (#25787818)
I love this. For years I had been thinking about creating a map where you can spot first and last sun in an area. Now that I’m actually tackling bigger and complexer projects I forgot all about that idea. Great job!
Re:Ask HN: What are you working on? by DavidPeiffer on Friday January 15, 2021 @06:37AM (#25789679)
Neat project!

I've been trying to figure out a smart home automated system to determine if shades should be open or closed to optimize for energy efficiency, accounting for sun intensity, time of day, and orientation of the window. I suppose I could throw something like this on rather than relying on generic sunrise and sunset times.

Did you have a lot of wrangling with coordinate systems and the location of the sun changing throughout the year?

Re:Ask HN: What are you working on? by tppiotrowski on Friday January 15, 2021 @11:47AM (#25792854)
Suncalc [1] is the library I use to calculate the position of the sun. Mapzen [2] host public elevation tile data. This blog post [3] is a good overview of the calculations involved.

[1] https://github.com/mourner/suncalc

[2] https://www.mapzen.com/blog/terrain-tile-service/

[3] http://www.liedman.net/2014/06/25/sunshine/

Re:Ask HN: What are you working on? by abyrvalgg on Thursday January 14, 2021 @11:25PM (#25786992)
Wow, the shadow takes into account the relief of Earth. Looks very interesting!
Re:Ask HN: What are you working on? by tppiotrowski on Friday January 15, 2021 @12:00PM (#25793037)
I especially like the shadows cast by these sand dunes

https://shademap.app/#25.89382,12.57935,8z,1610728080000t

Re:Ask HN: What are you working on? by amackera on Friday January 15, 2021 @02:10AM (#25787919)
This is super cool, well done
Re:Ask HN: What are you working on? by tsjq on Thursday January 14, 2021 @11:25PM (#25786996)
This is mighty interesting !
Re:Ask HN: What are you working on? by tppiotrowski on Friday January 15, 2021 @12:41AM (#25787421)
Thank you. Curious: is it of any practical value to you or just art?

I was thinking maybe using it to give actual sunrise/sunset times for any position on earth. For example, Denver sunset time is 5PM but the mountains will cast shadow on Denver at 4:40PM [2]

[1] https://www.timeanddate.com/sun/usa/denver

[2] https://shademap.app/#39.70243,-104.99153,10z,1610667780000t

Re:Ask HN: What are you working on? by tsjq on Friday January 15, 2021 @03:34AM (#25788406)
Actual sunrise sunset timings, yes. And then : might be useful for non-commercial planning of solar panels. I am assuming your shadow tracking takes into account the buildings' heights , sun angle over the months, etc factors also.
Re:Ask HN: What are you working on? by elsurudo on Friday January 15, 2021 @06:33PM (#25798091)
I used this when buying an apartment. Judging the lighting at different times of the day.