VRayColor - Fix please

Hi Guys

One of the previous iterations, worked great. As it stands now with Next (1.1), it’s not great

Can we please get any of these:

1) Enable VRayColor to be displayd in viewport
2) Add another swatch, that shows the corrected colour (so we can pick it)
3) Bring back the previous functionality like it was in 3.6.04. Typically we would stick in a 2.2 gamma to adjust colors that was picked in PS. Then we would simply copy and paste the swatch to diffuse to get the correct display in viewport

Hm, interesting - I was under the impression that nobody used the gamma rollout. The parameters are still there and accessible from MaxScript, just the UI is hidden, will think about whether we should show it or do something else.

Best regards,
Vlado

Btw 3ds Max would automatically correct colors that you pick with the color picker. I usually use File > View image file… to open the image and pick the color from there.

Best regards,
Vlado

You can actually pick any color on the screen with the color picker, even if its outside of Max. Great hidden feature!

If you pick a color outside of Max you won’t get the right color (as I remember). I always needed to import the image as a bitmap in 3ds max to pick it correctly.

Could you guys explain how to pick a colour outside max please, using max?
Typically we would be viewing either a website or a pdf. Saving that out to a jpg, then opening in max, sounds like lot of PT.
Typically we would screengrab what we need, then paste in PS and pick color in PS, then stick that into a VRayColor and adjust gamma.

When the colorpicker window appears, just click and hold on the color palette, then drag your mouse to the window where the image or whatever is you need to pick the color from. Works in a lot of applications like that.

That works, thanks

It works perfectly fine with me: in the render below one lightMtl has the color, input as the RAL values in the color picker, and with gamma set to 2.2, while the other vrayLightMtl has the map you provided.
Try it with a more recent nightly, perhaps?

EDIT notice both the map and the vray color differ a bit when gammaed (i used a max bitmap in this case.), because the max bitmap loader uses the sRGB gamma curve (and can only use that.) while the vrayColor uses a pure 2.2 gamma curve.
When gamma is set to 1.0, the results match to the third decimal place (third image).
When using a vrayHDRI loader, and the gamma is set to a pure 2.2 curve in the color space dropdown (actually an inverse gamma of 0.4545), results again match to the last decimal place (minus the fact the bitmap has a Blue of 34, instead of 35. last image).




Can you show me how it used to work?

We use VrayColor heavily and have huge issues with it in Vray Next.

I have finally managed to take a spreadsheet and attempted to see what’s going on.

We have two ways we could input a color into VrayColor : float values and color swatch.
Each input updates the other.
In the end, we want to input gamma 2.2 corrected RGB values (from let’s say Photoshop) and let Vray translate them to its linear space (please correct me if my understanding is wrong).

There comes the interesting part. When I input a float value of 0.5 in a channel, in linear space it equals to 128 but in RGB corrected space it should output ((128/255)^(1/2.2))*255 = 186. So when I do that and check the color swatch (defaults values and fresh install of vray and 3ds max), my output is 186 and everything’s fine.

However, if I move the value in the color picker, my float value updates to 0.866 for the same RGB value of 186 !
And the weird thing is that’s exactly what should happen if VrayColor applied the SAME gamma correction also in that way, and that should obviously not happen :smile:. So let’s check it out : (186/255)^(1/2.2) = 0.866

If I understand it correctly, it’s a bug, as VrayColor should take the gamma corrected swatch value and UNcorrect it, not apply a new gamma correction on top of the first one !
If so, could it be quickly fixed please ?

Thanks !

EDIT : maybe should I post it in the Issues forum ?


You could set the “color gamma” of the VRayColor parameter to 2.2 and you will get the results that you want, but in general it looks like you are looking for a color picker that allows you to enter sRGB-corrected colors and will uncorrect them automatically. The 3ds Max color picker doesn’t have this option; the Corona one does and we’ve been thinking about including it with V-Ray as well. That advanced color picker has a “sRGB” checkbox that allows you to do exactly what you want.

Best regards,
Vlado

one vote for that!

Hi Vlado, thanks for you really quick answer. However I’m still confused, because setting “color gamma” to 2.2 does not give the result I want, as it then applies a triple correction, it doesn’t make sense.

In fact, I persist, there is something weird in the way the conversion is made between the color picker and VrayColor values.
As I pointed out, changing the float values for each channel gives the correct conversion in the color swatch, but not the other way around, as the SAME calculation is done both ways, which shouldn’t happen.

Even if the color picker allowed only linear values and not srgb-corrected (so what does it mean if I check “Affect color selectors” in Gamma and LUT settings?), it should then translate a value of 128 to 0.5, which is not the case.
But still, assuming the color picker is not corrected and expect linear values, why, when I input 0.5 in float values in VrayColor then click on the swatch, is the value displayed as 186? As if each way there was the same gamma correction applied? If I then change 186 to 185 and back to 186, the float value is updated to 0.866 (it was 0.5 at the beginning of the process).

Let’s make it clear with an example :
1 - My input is Red : 0.5, Blue Green : 1.0 in float values. Then I check the swatch and it displays as 186/255/255 (VrayColor is doing a Gamma correction)
2 - The SAME swatch is still opened, I only move the red value then back to 186 to update it. Then I check the float value : 0.866 (because the original value is now weirdly ALSO GAMMA CORRECTED by VrayColor, but it already was ?)
3 - Now, if I follow what you’re saying, I should put a 2.2 value in gamma to obtain the logical same color as the first one. But it’s not the case. Which is understandable if we look at what operations are made between the swatch and float values (we now have a triple correction : First input as float value (linear) > RGB (gamma corrected) > Float value (gamma corrected again) > Gamma corrected for rendering)

EDIT : of course it would be great if the color picker made the operation seamless with an option for SRGB or not and built-in conversion to gamma corrected values, but I guess it’s a different issue. Here we have a wrong behavior between two types of color inputs and VrayColor IS gamma correcting BOTH WAYS. So there’s no way to input RGB values easily, as one should do the calculation by hand, linear or not.
The color swatch/picker is simply useless in that state, and I still firmly believe it’s a bug, as a conversion can’t have the exact same formula both ways !

EDIT 2 : I’m still thinking about what you have suggested, but for it to work, we should assume that :

- the color swatch input is purely linear (it isn’t by default, as 3ds max is gamma corrected and the color swatch displays the exact same color as Photoshop, but well, maybe it’s the case behind the scenes ?)
- the color input from photoshop is then wrong for the color picker and has to be uncorrected at some point
- the value after conversion from the swatch to the VrayColor float values is simply RGB/255 so the “raw” value is read by VrayColor (and that’s not the case as demonstrated, the formula used is (RGB/255)^(1/2.2) instead)

And only then could we have those “wrong” SRGB values from Photoshop, just scaled between 0 and 1, that need the Color Gamma parameter to tell VRay that these values are, in fact, gamma corrected and to apply the operation RGB^2.2 at rendertime.

In the meantime I’m sharing a little script I made earlier today, it appears in the VRay category in toolbars.
It creates a VrayColor with the correct float values from a color swatch (operation : (RGB/255)^2.2, so it removes the gamma correction) and puts it in the (opened) Slate Material Editor at [0,0] coordinates (no way to find how to center it in the current view). Feel free to use and modify it if anyone finds it useful.
VrayColorEasyGammav0.1.ms.zip (750 Bytes)

heh. it was indeed used.

Yes, same issue - Vraycolor does not work as before (version 3.6) - gamma correction swatch are gone (newer versions) and setting the gamma value to 2.2 also results in a lighter color.
My workaround: Apply a inverse gamma of .454 in the color correction map on top of the vraycolor (set to 2.2 gamma vraycolor)

Painful…