Gensky solar brighness less than 10 degree

Hello guys,

I noticed that gensky returns constant brightness for sun altitude less than ~9 degree.
Looking at the gensky.c at line 276 suggest the same thing:

solarbr = 1.5e9/SUNEFFICACY * (1.147 - .147/(sundir[2]>.16?sundir[2]: .16));

Is there any reason for using a constant value for sun altitudes below a certain degree?
I can see that without doing this the formula gives negative values below a certain degree.
This discontinuity shows itself more when doing annual direct solar calculation where you would get
weird artifacts on the falsecolor image.

I tried the gendaylit command (with params for cie clear sky) and it doesn’t behave same as gensky.

Yes, gensky implements the CIE standard clear and overcast skies, but there is no model for solar radiation in that standard. The code uses an estimate taken from a handbook that only suggests values at altitudes between zenith and 9° above the horizon, which is why gensky returns a constant value below that. Gendaylit probably has a much better model of solar radiation.

You can of course override the solar radiation value in gensky with whatever you like with the -r or -R option.

What weird artifacts are you seeing with falsecolor?

Hi Greg,

Thank you for the reply,

Both images below show the annual direct sun radiance weighted by the cosine of angle between sun position and the view dir(here is straight south 0,-1,0). My apology that the images aren’t rendered in Radiance. However I have used gensky program to get solar brightness values for each sun position.
There is a mushroom like effect at both sides near the horizon on the left image.

The left image uses the original formula:
solarbr = 1.5e9/SUNEFFICACY * (1.147 - .147/(sundir[2]>.16?sundir[2]: .16));

and the right image I have used sundir[2] and clamp the negative values to zero:
solarbr = max(0, 1.5e9/SUNEFFICACY * (1.147 - .147/sundir[2]))

Somehow I don’t get the same effect as in the left image if I only do falsecolor just for sun brightness(that is without weighting it by the cosine term).


Hi Ali,

I understand that what you see on the left plot doesn’t look “clean” to you, but that doesn’t mean that it is a mistake. The formula you substituted causes the solar radiance to drop to zero around 7° above the horizon, rather than becoming constant below 13° as in the original formula.

So, while I freely admit that the original formula is not the best, I’m not sure your replacement is really an improvement.

I checked the code for gendaylit, which I did not write, and it seems they don’t estimate solar radiance at all, but derive it from the solare irradiance or illuminance given on the command line. For the same output from gensky, you should therefore specify the solar intensity with the -r or -R option, as I suggested earlier, rather than relying on the existing approximation.

Thank you Greg for the explanation. And sorry for confusion, I merely added the right image for comparison otherwise you are right that isn’t right either.