Creating Custom Gradient to Mimic Rhino Sun "Date and Time" Gradient

Hello Grasshopper and Ladybug Community,

I’m currently working on a project where I want to create a custom gradient in Grasshopper using Ladybug data that mimics the Rhino Sun “Date and Time” gradient.
Screenshot 2024-01-03 at 06.34.59
The goal is to have a gradient that changes according to the specified date, reflecting variations similar to sunrise, midday, and sunset lighting conditions as seen in Rhino’s sun path tool.

While I have some experience in creating custom gradients using tools like Ambrosinus Toolkit (Ambrosinus Toolkit | Food4Rhino), I’m struggling to figure out how to integrate specific solar data such as sunrise/sunset times and the sun’s brightness throughout the day into my gradient.

Here’s what I need help with:

  1. How to retrieve accurate solar data (like sunrise and sunset times, sun intensity) for a given date and location in Grasshopper Ladybug.
  2. Methods to dynamically adjust the gradient’s colors and intensity based on the sun’s position and brightness throughout the day.
  3. Any existing scripts or components within Grasshopper Ladybug that could facilitate this process.

Thanks in advance for your help and insights!

Hi @crz_06,

Looking at the ladybug primer I couldn’t spot a component that would simply give you what you’re after.

If you’re happy doing a bit of python coding the ladybug SDK should be able to do all you’re looking to achieve.

https://www.ladybug.tools/ladybug/docs/ladybug.sunpath.html#ladybug.sunpath.Sun

  1. The Sunpath class and its calculate sunrise sunset method I expect would be a good start.

  2. Beyond that I’d hazard a guess that the altitude is the main driving factor for the daily variation in colour shown by the Rhino render scale, and then annually is likely based on length of day.
    Edit: thinking some more on it, I think using calculate_sun inputting each hour of the year would probably be more useful, then you can access the altitude property out the output sun, and that would be the property on which to colour your gradient, setting all negative altitudes to 0 and working up through the gradient from there.

All of the ladybug python code is accessible in ghpython.

Cheers,
Charlie

1 Like