I noticed that the results of using “gendaymtx -d” and “gendaylit | genskyvec -d” to generate the sky vector were different for the same location and moment. According to the manpage, when using the “-d” option to generate a sun-only vector, gendaymtx sets the ground patch to zero, but genskyvec does not mention this. I’m unsure if the difference in results was caused by the ground patch not being set to zero in genskyvec.
The genskyvec -d option turns off all contributions except for a few patches near the sun, so the ground patch is not responsible for the difference you are seeing.
More likely, it is due to differences in the default settings for gendaymtx versus gendaylit, which are both based on the Perez sky but are completely different implementations by different programmers. I would study the options of both and learn what you can about the various settings and defaults, in particular whether each is fed or expecting photometric vs. radiometric input quantities.
The difference comes from the sky/ground blending used in perezlum.cal, which is not part of the perez model, but does provides more realistic values near the horizon. This blending is not part of the gendaymtx implementation, which does not add this parameter to the Perez model (although with a fixed dewpoint parameter, available in gendaylit with the possibly undocumented -d option). To get a closer match, disable this term by editing line line 17 of perezlum.cal from:
skybright = wmean((Dz+1.01)^10, intersky, (Dz+1.01)^-10, A2 );
skybright = if(Dz, intersky, A2);
and then making sure this edited file is first in your RAYPATH, or giving it a different name and editing the output of gendaylit from:
... void brightfunc skyfunc 2 skybright perezlum.cal ...
... void brightfunc skyfunc 2 skybright perezlum_noblend.cal ...
Thank you! @Greg_Ward @Stephen_Wasilewski
Does sky blending at the horizon affect the result with the -d option? I’ll admit I am surprised by that.
I haven’t tested it. After I test it, I will report it here.
You are right, sky blending will not have an effect on the direct only. I got ahead of myself and forgot the context of the post.
genskyvec and gendaymtx handle the direct sun differently, gendaymtx divides the energy into 4 patches, genskyvec divides it into 3.
the other difference, which should be more obvious from the output, is gendaymtx defaults to MF=4, while genskyvec defaults to MF=1
That’s true, except reversed. The gendaymtx default is -m 1, whereas genskyvec defaults to -m 4.