Merge the RGB components of dctimestep result (irradiance file)

Dear all,

I have created a daylight coefficients file with the command:

rfluxmtx -parameters oct_file.oct < pointsfile.pts > illumfile

Additionally, I have created a sky matrix with the folowing command:

gendaymtx -parameters weather.wea > sky

and in order to create the irradiance file I use the command:

dctimestep illumfile < sky > irrfile

to achieve the multiplication between the daylight coefficient matrix and the sky matrix.
First, I would like to ask, is this RGB multiplication implemented this way?:


Those 2 arrays contain 3 components of RGB in each element, so the irradiance file will contain 3 components of RGB in each element too.
In order to reduce the size of the result file irradiance, I merge the RGB numbers to one number with the formula (0.265*R + 0.67 G + 0.065B) at this command:
rmtxop -parameters 0.265 0.67 0.065 - < irrfile > result

Now, what I am trying to do is to merge the RGB contents of the illumfile and the skyvector before the multiplication.

But if I use the same formula (0.265*R + 0.67 G + 0.065B) to each element of the daylight coefficient and the sky vector and then I multiplicate them, I do not have the same result as previous.

Any ideas for how I can achieve the same result?
Because if I had 3 components just in the illumfile and 1 component in the sky matrix It would work.
Do I have to apply another formula for the both of the files?

Thank you in advance!

Unless your values are all gray in either the sky file (which would be typical) or the daylight coefficient file (which is less usual), the precombination of RGB prior to multiplication will yield different results.

If you are just interested in saving time, you should use the binary versions of the files. Most of the time is spent converting from binary float to ASCII text and back, not the actual vector/matrix multiplication itself.

Dear Greg_Ward,
thank you for your response.
The both files of daylight coefficients and the sky matrix are in RGB format (no gray values).
And I need to save memory, that is why I want the RGB precombination before the multiplication.

So as I understant, there is no other way to achieve it.

In my case where the 2 files are in RGB format, the matrix multiplication is implemented this way, isn’t it?

Thank you!

I recommend doing the combination after multiplication, not before. The dctimestep program only works with 3-component inputs, and rmtxop converts everything to double (which takes more memory). Best just to convert it at the end for better accuracy.