Convert temperature to color

On 15/02/2017 at 08:53, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:   Windows  ;   
Language(s) :     C++  ;

I want to convert a color temperature to a real color (vector).

There is an xpresso node "Color Temperature" that does precisely what I want.
However, in R16 I cannot find a C++ routine that does the same.

In R18 there is a conversion routine, but I cannot find it in R16.
const Vector rgb = ColorKelvinTemperatureToRGB(kelvin);

There is no lib_colorchooser.h file.

What can I do?


On 16/02/2017 at 01:46, xxxxxxxx wrote:

Hi Pim,

as stated in the docs this function got introduced with R18. And the new Color Chooser (which lib_colorchooser is there for) got introduced with R17, which is the reason why you can't find the header before in the SDK.
Before R18 there was no functional equivalent for ColorKelvinTemperatureToRGB(), sorry.

But using your favorite search engine, it should be easy to find a conversion algorithm in source. Don't know if it's good or not (and in no way MAXON is responsible or connected to the site or its owner), it was the simply first search hit: Tanner Helland - How to Convert Temperature (K) to RGB

On 16/02/2017 at 01:51, xxxxxxxx wrote:

Hi Andreas,

Thanks for confirming what I expected and yes, I found something on the Internet.
Thanks, Pim

On 17/02/2017 at 04:01, xxxxxxxx wrote:

Can sound like a hack. But you can add a light. Change her color temperature (you could do this also in R11 if i'm right at least in R13 you can). Update the light.
Then grab the color from light wich c4d will automaticly set the color when you update it ;)