- I have fixed what I believe was a copy-paste mistake in the subtract texture:
https://github.com/LuxCoreRender/LuxCor ... 396ea99f28
I noticed that the subtract and add textures are declared OPENCL_FORCE_INLINE, while the scale texture is declared OPENCL_FORCE_NOT_INLINE. Why is that? Aren't they all doing the same thing, just with different operators? Is there something I'm not seeing? - It seems like the OpenCL code clamps some colors implicitly, for example the matte material "kd". This creates a difference between CPU renders and OpenCL renders because this clamping does not happen in C++ code. See attached example image. Why the inconsistency?
OpenCL
OpenCL
Some questions:
Re: OpenCL
It is the work around to NVIDIA OpenCL compiler problems. It is more the result of Voodoo magic than some rational action. I would use OPENCL_FORCE_NOT_INLINE also for subtract and add (i.e. better safe than sorry).B.Y.O.B. wrote: ↑Thu Oct 11, 2018 9:17 pm Some questions:
- I have fixed what I believe was a copy-paste mistake in the subtract texture:
https://github.com/LuxCoreRender/LuxCor ... 396ea99f28
I noticed that the subtract and add textures are declared OPENCL_FORCE_INLINE, while the scale texture is declared OPENCL_FORCE_NOT_INLINE. Why is that? Aren't they all doing the same thing, just with different operators? Is there something I'm not seeing?
Colors are clamped both in C++ and OpenCL. The problem arise from the different default values of Spectrum::Clamp(min, max), it is [0.f, 1.f] in OpenCL and [0.f, INFINITY] in C++. The C++ version is quite misleading but it comes from when the same code was used inside old Lux. I should have fixed all C++ Clamp() call now.B.Y.O.B. wrote: ↑Thu Oct 11, 2018 9:17 pm
- It seems like the OpenCL code clamps some colors implicitly, for example the matte material "kd". This creates a difference between CPU renders and OpenCL renders because this clamping does not happen in C++ code. See attached example image. Why the inconsistency?
Re: OpenCL
Ok, should we implement this in the master branch or in my new_math_textures branch?
My plan was to implement OpenCL support for the Remap texture and the ObjectID textures, then apply for first merge of the new_math_textures branch into master. (More math textures can be implemented later)
If I do this in the next days, do you think we can include it in v2.1?