Thoughts on making Cycles into a spectral renderer

Do you have an AMD cpu per chance? I’m not too knowledgeable about this but it seems relevant.

No, it’s an Intel: Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz

Considering it is 11 years old, is it possible it doesn’t have support for that particular function or something?

This commit might help you to understand and/or get it building


Here’s the exact lines https://github.com/Smilebags/blender/commit/c95fdc321565a889585c92542df8602791d995f2#diff-f83e10fca4aab050ec85a84c3806559fR439-R449 (the link expander removed the line numbers from the URL)

Thank you, that looks like the source of the problem! The processor doesn’t have AVX2 for sure. Btw. standard Blender compiles fine for me. I should switch off __KERNEL_AVX2__, I looked at the defines, but it looks they depend on __AVX2__ and others.

  1. Shouldn’t it be detected automatically?
  2. could you please give me a hint where is the master switch for AVX2?

I would have thought so.

Sorry, I have no idea. I’ve never had to touch them

My suggestion for now would just be to comment them out, clearly I’m not a C/C++ programmer :joy: I would have expected the suitable feature flags to be automatically set though.

My experience with C++ is almost 15 years ago, but I will give it a try :slight_smile: There are quite a lot of the defines. I will try to get a more detailed error log. I rather suspect that some #ifdef is missing somewhere so that __KERNEL_AVX2__ gets activated under any circumstances. I saw one such file in the tests subfolder.

Looks like _mm256_pow_ps is a function from the Intel library that comes with MSVC rather than actual instruction. Try commenting out all functions that give errors like this:

ccl_device_inline float8 exp(float8 v)
{
- #ifdef __KERNEL_AVX2__
-   return float8(_mm256_exp_ps(v.m256));
- #else
+ // #ifdef __KERNEL_AVX2__
+ //  return float8(_mm256_exp_ps(v.m256));
+ // #else
  return make_float8(
      expf(v.a), expf(v.b), expf(v.c), expf(v.d), expf(v.e), expf(v.f), expf(v.g), expf(v.h));
- #endif
+ // #endif
}

Are there any errors before that one? I’m not sure what’s the problem here, SPECTRAL_COLOR_DATA_TYPE is defined above that line. CAT macro is defined at intern\cycles\util\util_defines.h:148, I’ll rename it later.

All of the errors come from util_math_float8.h and they complain about various _mm256 functions. I will try commenting them out.

I will try to resolve the AVX2 issue and then come back to the CAT(make_ ...

UPDATE:

Are there any errors before that one?

@pembem22 No there are only errors caused by the three CAT-ed defines in that file.

Commenting out the MSVS functions did it! It would be the best to change those #ifdef that are affected (not all in the file) to

#  if defined(__KERNEL_AVX2__) && defined(MSVC)

@LazyDodo I’m a little concerned that your build process hasn’t succeeded since the 22nd, I would have expected the last few days to have run again, could you let me know if there are any new build errors? I guess for now I can get a build done from @pembem22 and we could upload it temporarily? Pretty sure people would be keen to try it out.

I re-organized some of the build bot folders around the same time you guys broke the branch, and i messed it up a tiny bit, but figured the branch must still be broken so didn’t take a closer look, i’ll get that fixed up.

Ah awesome. Thank you so much for your time on this. It has been a pleasure being able to offer GPU accelerated builds. Please let me know if there’s anything else I need to fix up.

Windows is updated, linux is still throwing a fit at the CAT issues talked about above.

Awesome, thanks for that. I’ll see if I can take a look into how to solve that CAT issue.

@kram1032 feel free to head over and download the new build, I think you might enjoy being able to create spectra ‘properly’.

@LazyDodo I found that CAT is defined as

#define CAT(a, ...) a##__VA_ARGS__

And I just found this to the topic: https://stackoverflow.com/questions/52891546/what-does-va-args-mean

Metameric colours are fascinating. These images are of the same cube with the same material, only the lighting changed, one is with a flat spectrum, the other is with a very spiky spectrum (as you can see below)

White light source
metamerism_a

Spiky spectrum
metamerism_b

The two light materials being used

Cube material

6 Likes

Oh yeah I was gonna test it asap. Today turned out to be quite busy out of nowhere so I only saw this now though