20 comments

  • ryandrake 2 hours ago
    Awesome. I remember much earlier in my career I was working on a 3D turn-by-turn navigation software, and one of my tasks was to draw the sky in the background. The more senior guy on the team said, just draw a blue rectangle during the day and a dark gray one at night and call it job done. Of course, I had to do it the hard way, so I looked up the relevant literature on sky rendering based on the environment, latitude, longitude, time of day and so on, which at the time was Preetham[1] ("A Practical Analytic Model for Daylight"), and built a fully realistic sky model for the software. I even added prominent stars based on a hard-coded ephemeris table. It was quite fast, too.

    Well, the higher ups of course hated it, they were confused as to why the horizon would get hazy, yellowish, and so on. "Our competitors' skies are blue!" They didn't like "Use your eyes and look outside" as an answer.

    Eventually, I was told to scrap it and just draw a blue rectangle :(

    All that to say, nice job on the site!

    1: https://courses.cs.duke.edu/cps124/fall01/resources/p91-pree...

    • darknavi 1 hour ago
      A past coworker who worked on Cobalt[1] told me that they spent entirely too much time implementing stars in the sky of the game with some amount of real(ish) star system physics behind them.

      I can understand people removing polish things like that if there are usability concerns, but those small things add up to a lot in an end product and are a joy to find and explore.

      1: https://en.wikipedia.org/wiki/Cobalt_(video_game)

    • jbverschoor 17 minutes ago
      Whipping down the innovator with the stupidity whip. Great management
    • zarzavat 39 minutes ago
      You should have added a duck.
    • netsharc 1 hour ago
      Not even as an easter egg?

      You could've sold it with telling them Vincent Van Gogh's paintings had the location of stars accurately, you were inspired by those paintings to reproduce the sky color accurately.

    • j_bum 2 hours ago
      Fun (but not fun) story :)
  • throwanem 2 hours ago
    > the little-known meta http-equiv="Refresh" HTML tag

    Oh, don't mind me, I'll just be over here in the corner laughing ruefully as my bones crumble to dust: back when I started, if you wanted a page to refresh on its own, this was the only way.

    Beautiful work! A splendid example of formal minimalism at its best.

    • dlazaro 2 hours ago
      Thank you! And umm, not to make you feel ancient, but I think I wasn't even alive yet when `setTimeout(() => location.reload(), ...)` first became widely available.
      • throwanem 27 minutes ago
        Oh, don't worry about it at all, and I don't just mean in my own case. Every generation learns to age graciously or otherwise, partly through experience, and for me it's a regular source of joy to see you young 'uns independently rediscover things I long since quit bothering to remember.
  • cosmicgadget 6 minutes ago
    That is awesome but now I want to check what my SF bros see when they look up.
  • nhinck3 2 hours ago
    Opened this up and sat there for a good 20 seconds waiting for something to happen... only to remember it's midnight here.
    • dlazaro 1 hour ago
      Maybe someone smarter than me could add stars to the night sky, so it's not just black.
  • esafak 1 hour ago
    More sophisticated than I expected. It relies on a research paper: https://github.com/ebruneton/precomputed_atmospheric_scatter...
  • nisten 2 hours ago
    i put my laptop next to the window and it was spot on wtf

    what got me the most is opening chrome dev tools and seeing nothing there

  • mushufasa 29 minutes ago
    would love this to be a desktop background -- linux or macOS
  • xattt 58 minutes ago
    This would be an awesome background for a smart home dash!
  • 101008 59 minutes ago
    Put my phone against the window and I had to call over my wife to come to check it: it matches 100% (clear sky right now). It's amazing, congratulations
  • ianbicking 2 hours ago
    I'm around so much wildfire smoke lately that my sky expectations have changed...

    I wonder what it would take to account for weather?

    • craftkiller 1 hour ago
      That'd be a pretty large introduction of a dependency. The sky can be calculated with just lat/lon and the current date+time. Adding in weather would mean querying some external weather service.
  • djoldman 1 hour ago
    @dlazaro, I believe that style={{backgroundColor: bottom}} is not needed in:

        <body style={{backgroundColor: bottom}}> </body>
    
    is not needed.
  • gdubs 1 hour ago
    Well, that's delightful. Works really well here in the Pacific Northwest :)
  • DonHopkins 21 minutes ago
    Why doesn't it respect dark mode??? ;)
  • i_love_retros 1 hour ago
    Curious why a celebration of HTML needed a full stack javascript framework?
    • dlazaro 1 hour ago
      A server is needed to calculate the sun's position from latitude + longitude + time, and then render the gradient. I could use HTML templating in some other language/framework, but I used Astro because that's what I'm familiar with and it's very easy to deploy to Cloudflare Pages.
      • nnnnico 17 minutes ago
        it's beautiful. btw, could this be all done in client side js? didnt look at the implementation, probably server is used to resolve location?
  • stephenlf 2 hours ago
    Fantastic. I’ve always wondered why the sky wasn’t blue around the horizon. Fascinating stuff.
    • verandaguy 2 hours ago
      There's two main reasons for this:

      - First and most impactful: as the earth curves down and away from the observer's horizon, your line of sight goes through a thicker slice of the atmosphere.

      Looking straight up you might have 100km of atmosphere until space (the distance is made up here, but I'm using the Kármán line as an arbitrary ruler), but looking out towards the horizon (assuming a perfectly spherical Earth), it's much, much more than that 100km, so the light will scatter off of (and/or be filtered by, depending on angle and time of day) more particles in the atmosphere, affecting the colour of the sky.

      - The compounding factor here is if there are environmental factors that boost the particle count in the air, and especially particles that'd stay in lower layers of the atmosphere. Where I am, we've been dealing with wildfire smoke of varying strengths for a few weeks. Today's gentle enough, but it's bad enough that my gradient goes from rgb(115, 160, 207) at the top of the sky to rgb(227, 230, 227) at the horizon (which is shockingly accurate).

  • mlhpdx 2 hours ago
    Which direction am I looking? Deeper blue to the north.
    • dlazaro 1 hour ago
      It's always facing the sun (although it doesn't include the sun itself).
  • nnnnico 2 hours ago
    incredible <3 not much else to say
  • jhardy54 1 hour ago
    Super neat. Looking forward to checking out your implementation and learning about this!
  • hoppp 2 hours ago
    Seems to work :)
  • siva7 2 hours ago
    how i missed this small hn posts. thanks