I have a script that reads ass files and writes the user data nodes into an XML file such that UI can be easily and quickly generated. It seems to be working well, but the value from AiNodeGetRGB() does not seem to reflect the values in the shader network. When read back, the Color User Data generated reflects the values in the XML, not those in the shader. It seems that there is a gamma applied, maybe?
I've extracted the rgb values using:
default = AiNodeGetRGB( node, "default" )
default_r = str(default.r)
default_g = str(default.g)
default_b = str(default.b)
default = "{" + default_r + "," + default_g + "," + default_b + "}"
Solved! Go to Solution.
Solved by peter.horvath6V6K3. Go to Solution.
I think it is a gamma correction judging by the values I remember. I'll give that a try tomorrow.... Is this a C4D thing??
The color widget in C4D is in sRGB color space by default, while Arnold needs them in linear color space. A simple gamma correction is a good approximation, or you can use the ColorProfileConverter class from the C4D SDK.
Cool thanks. That works just fine. I couldn't immediately figure out how to use ColorProfileConvert (still trying to wrap my head around the C4D API), but I was able to convert to sRGB using some code I found.