Page 14 of 32

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 5:27 pm
by lacilaci
Dade wrote: Sun Feb 03, 2019 5:19 pm
acasta69 wrote: Sun Feb 03, 2019 4:59 pm Intel Oidn.
Anyone else always read "Odin" instead of "Oidn" ? :lol:
Yes, all the time. Sounds much better than OIDN.

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 5:28 pm
by Sharlybg
Anyone else always read "Odin" instead of "Oidn" ? :lol:
Anyway Odin is better to read than OIDN :mrgreen:

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 5:30 pm
by Sharlybg
Yes, all the time. Sounds much better than OIDN.
Hey your are fast :) The F1 season have not yet start :lol:

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 5:44 pm
by lacilaci
Sharlybg wrote: Sun Feb 03, 2019 5:30 pm
Yes, all the time. Sounds much better than OIDN.
Hey your are fast :) The F1 season have not yet start :lol:
lol, yes...

So, how long until this is usable in blendluxcore?

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 8:42 pm
by Dade
If you can convince B.Y.O.B. to add the support to BlendLuxCore, I guess one week for alpha0. PhotonGI is highly unfinished but it doesn't matter: some test can be already done.

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 9:08 pm
by alpistinho
Hey,

I was hoping you could me help understand better these data structures.

I see that every Film object has several GenericFrameBuffer pointer that represent the multiple supported framebuffers. This class is templated to support multiple channels and multiple weight channels of type T.

To get the HDR output for the denoiser I've used the method described in the tutorial

Code: Select all

Spectrum *pixels = (Spectrum *)film.channel_IMAGEPIPELINEs[index]->GetPixels();
Since the channel_IMAGEPIPELINEs attribute vector of GenericFrameBuffer pointers, I assume it points to the several possible framebuffers that might exist in a given Film.
To get the pixels, the GetPixels method is called, that returns a reference to the internal GenericFrameBuffer object pixels

Code: Select all

const T *GetPixels() const { return &pixels[0]; }
T *GetPixels() { return &pixels[0]; }
...
std::vector<T> pixels;
As seen, this is a vector of the same type as instantiated by the Film class, usually a float.

When I've used this to get the HDR pixels it somehow works to cast this reference to a std::vector<float> to Spectrum*. Isn't Spectrum a completely different struct? Does it take advantage of the memory layout similarity between RGBColor and vector?

The ALBEDO and AVG_SHADING_NORMAL are both GenericFrameBuffers defined as:

Code: Select all

GenericFrameBuffer<4, 1, float>
I've tried to get the colors by copying the entire pixels vector while discarding every fourth value, that should be the weigth. But it is not working.
What am I missing?

Thanks for the help,

Daniel

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 9:11 pm
by Sharlybg
PhotonGI is highly unfinished but it doesn't matter:
If we don't put Opencl in the box what kind of things are left for PGI cache ?

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 10:52 pm
by Dade
Sharlybg wrote: Sun Feb 03, 2019 9:11 pm
PhotonGI is highly unfinished but it doesn't matter:
If we don't put Opencl in the box what kind of things are left for PGI cache ?
Volumes, transmission materials, tuning, optimization, etc.

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 11:01 pm
by Dade
alpistinho wrote: Sun Feb 03, 2019 9:08 pm The ALBEDO and AVG_SHADING_NORMAL are both GenericFrameBuffers defined as:

Code: Select all

GenericFrameBuffer<4, 1, float>
I've tried to get the colors by copying the entire pixels vector while discarding every fourth value, that should be the weigth. But it is not working.
What am I missing?
Each pixel in ALBEDO is an RGB color with [0.0, 1.0] values, each "pixel" AVG_SHADING_NORMAL is a FLOAT3 vector with values [-1.0, 1.0]. To get a pixel value (with all the weigh magic already done) just use GenericFrameBuffer::GetWeightedPixel(const u_int x, const u_int y, T *dst): https://github.com/LuxCoreRender/LuxCor ... fer.h#L266

You can set "dst" to the address of the pixel in the temporary vector<float> you are going to pass than to Oidn: something like "&albedo[pixelIndex * 3]"

P.S. if you want, just fill a GitHub pull request for LuxCore with your patch, I can add the ALBEDO/AVG_SHADING_NORMAL related stuff.

Re: OpenImageDenoise

Posted: Sun Feb 03, 2019 11:12 pm
by alpistinho
Dade wrote: Sun Feb 03, 2019 11:01 pm P.S. if you want, just fill a GitHub pull request for LuxCore with your patch, I can add the ALBEDO/AVG_SHADING_NORMAL related stuff.
Thanks for the explanation.

I have opened the PR since I will have little time to look into this during the week and don't want to delay you for so little