Glare analysis


I need some help with a script I am developing. I am using Ladybug to run a glare analysis to assess the percentage of the time that my building is creating glare in the surrounding buildings. I am using ‘Ladybug_bounce from surface’ and ‘Ladybug sunpath’ to simulate the sunrays. I want to create colored meshes over the facades of the surrounding building showing the percentage of the time that my building generates glare on them.

So far, there are two things that I do not sure how to solve:

  • How do I check when the rays hit the cells of the meshes? I tried ‘Mesh inclusion’ But even though the points are located within the cells of the mesh I only get ‘False’ in the output.

  • If I use ‘Ladybug_analysis period’ I get all the rays simulated at the same time. However, I want half-hourly simulations to be run one by one so in the end I can calculate for each cell of the meshes the percentage of the simulations when they were reached by a ray. How can I do this?

I attach the file of the script.

Thanks in advance!


Sample model.3dm (102 KB)
Glare script (65.1 KB)

Hi Alejandro,

Glare is a tough thing to quantify as it really depends on whether someone is looking at your area of high contrast (in this case, I guess it would be looking at the sun bouncing off of your fully glazed building). Once a person looks away from the glazed building, they no longer experience glare. If you know the view that someone will have looking at your building, Honeybee has a large number of tools that will give you real and reliable numbers for glare.

I know that you are planning to use a different method here but I point out the above just to be clear that you are not necessarily sure that people will experience glare if you are just looking at the times of the year when direct sun will be bouncing off of the glass building onto another building. However, I can see this as a good starting point to assess the hours where there is a risk of glare in the building where light is being bounced to.

With that preamble out of the way, I can say that you are using a version of Ladybug that is 6 months old and I have updated your file for you. To update your components and to be sure that the file below works correctly, you should re-download the user objects from the main Ladybug page and drag them onto your canvas.

If you want to look at sunrays for a whole year, I would keep your number of test points low by increasing your grid size (I think 5 should suit your purposes). Also, you should only set the number of bounces to 1 as you are only really concerned about the one bounce off of the glass building. With these two things done, you can then hook up an analysis period and have it do bounces for every sun-up hour of the period an not take for ever to calculate on your machine. Perhaps an easier way to do this would be to take a sun-up hour for every month instead of a full analysis period, as I have done in your attached file.

Finally, you need to make the last bounce length long enough to intersect the neighboring building (I increased it to 15 meters). Then you can use the native grasshopper components to count the number of intersections.

You can see this all in this file:

Hi Chris,

Thanks for you answer, it has been very useful. I want to do exactly what you show in your script but applied to a meshed surface instead of a simple surface. This way I can apply a color to the different cells in the mesh and show the distribution of the percentage of time with glare over the whole facade, i.e. what parts of the facade are more affected by glare.

I have been trying to apply your script to a mesh without success so far. I attach the new script here.



Sample model.3dm (102 KB) (81.1 KB)

Hi Alejandro,

You just need to interpret the results from the mesh intersect component correctly. Also, I would use the Ladybug recolor mesh component to color based on your results. This way, you can get a legend and title. You can see this in the attached file.

-Chris (91.1 KB)

Sorry Guys for my ignorance but what is a sun-up hour and how can we get that in LB to be automatized.

As I need to evaluate something similar to what Alejandro was trying to do.

Thank you

Hi Claudio,

A sun-up hour is just an hour in the daytime or, to be more specific, it is an hour when the sun is above the horizon. You can use the Ladybug_Sunpath to get all of the sun-up/daytime hours of the year by plugging in an analysis period for the full year into the component (hopefully, this answers your request for having something automated).

You could use every sun-up/daytime hour of the year with the method that Alejandro was using but the analysis could take a very long time like this so I just suggested that he use a list of average sun-up hours for each month (as you see in the GH file that I posted).

Let me know if things are still unclear,