View Full Version : RGB values and clamping ?
dlanier
October 2nd, 2006, 15:46
Hi,
I am developing a material and an ouput shaders.
I have a question which is probably silly :-)
I have in my material shader the resulting miColor with values such as :
R = 1.2 B = 1 G = 0
And if I clamp them in the range [0,1] I don't get the same result in my render.
I thought mental ray was clamping these values.
Moreover in an output shader the RGB values (1.2, 1, 0) are transformed into R=1 G = 0.8 and B = 0.9
What is this transformation ? Has it something to deal with internal color spaces ?
I thought at first, there were some transform to change the whole image pixels as in HDR but the strange thing is that colors that are not over the range [0,1] remain the same in the ouput shader.
Anybody knows what is this transform ?
Thank you.
Regards,
bart
October 2nd, 2006, 18:06
A material shader deals with samples using floating point. Between the material shader and the output shader, there may be some conversion as it generates pixels from samples after filtering and applying whatever is necessary depending on your primary framebuffer specification.
What kind of primary color framebuffer are you using?
Most significantly float or int components?
Then, how is your color pipeline set up?
color clip = ?
desaturate = ?
The Color Calculations section of the Programming mental ray book introduces these concepts. Also, there is a diagram of the color pipeline in the first book, Rendering with mental ray. This diagram shows the clipping, desaturation, pre-multiplication, gamma and quantization steps.
dlanier
October 2nd, 2006, 21:30
Hi Bart and thanks for your answer.
I am using a RGBA 8 bits primary frame buffer and raw clipping (so no clipping ?), I 've tried to set clip or desaturate but it has no effect at all...
Is it a Maya related problem (Maya 7 - Win32) ?
And is there a way to calculate the final pixel value because I need to compare my pixel to a white pixel in HSV color space ...
I have the programming mental ray handbook and will give it a look !
Thank you.
Regards,
bart
October 4th, 2006, 18:58
Make sure desaturation is off. Here's the doc from the ray command line section:
-desaturate on|off
If a rendered sample returns an RGBA color whose components are outside the legal range, mental ray will clip the color into this legal range. This option determines how the clipping of R, G, and B is performed. If desaturation is turned off, which is the default, the components are clipped individually. If turned on, then if any of R, G, and B exceed the allowed range, the color is shifted towards the grayscale axis of the color cube in order to try to maintain the perceived brightness of that color, effectively bleaching out the color. The valid range of RGBA is controlled by the colorclip option.
And while we're at it the doc on color clipping:
-colorclip rgb|alpha|raw
This option controls the rules used to clip an RGBA color before quantization to an 8-bit or 16-bit frame buffer [20]. The rgb mode states that RGB are first to be clipped to the range [0,1] before A is clipped to . This is the default mode. The alpha mode lets A first be clipped to [0,1] before RGB is clipped to [0,A]. Both of these modes ensure that all channels are within [0,1] and that A is no less than any of R, G, and B, which is is the valid domain of premultiplied colors. The third mode, raw, ignores all requirements, and clips both A and RGB to [0,1]. This is useful to make mental ray modify output colors as little as possible. Because the color output may be invalid, the raw mode overrides the premultiply off option if present. Desaturation is always applied if enabled.
Note that last sentence.
Also, to check to see whether it has been translated by Maya effectively, turn on at least Info Verbosity (Translation tab of mental ray globals), and then take a look at the reflected options at the top of the render report.
dlanier
October 4th, 2006, 22:54
Thanks Bart !
I'll try that but the few tests I did when changing desaturate on/off and color clip Rgb/alpha/raw had no effect at all (Maya 7)
Regards,
bart
October 6th, 2006, 18:04
That is why I asked you to double check in the render report. That way we can see where it is not having an effect.
barnaby
October 9th, 2006, 22:07
Hey
One more thing to check if you are seeing unexpected values in the maya render view is the "Preview" section of the mental ray globals.
You should see if "Preview Convert Tiles" or "Preview Tonemap Tiles" is checked. If you uncheck those you should see true raw color output in your render view.
barnaby.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.