#GAMMA Formula in 3DS
11 messages in this thread
Hey Jonas,
Been pretty quiet lately, you been hiding out. <g>
Is there any possibility that I can get the formula for gamma that 3ds uses so
that I can determine the effect it will have on a given color value? I realise
this may get complicated when factoring in lighting parameters etc. I wonder if
you could shed some light on this. (another one of my good puns <g>).
Thanks,
John
Hi John,
<< hiding out? >>
naw… but there's alot to do before Siggraph.
<< I wonder if you could shed some light on this. (another one of my good puns
<g>). >>
At this time, I've never had this question asked. I can around on Monday.
jonas
Hi Jonas,
>> there's alot to do before Siggraph… <<
I'm sure. I'm hoping to get something in though its been a scramble. <g>
>> I can around on Monday… <<
Great, I'd appreciate it.
Thanks,
John
Hi John,
> Is there any possibility that I can get the formula for gamma that 3ds uses
> so that I can determine the effect it will have on a given color value? I
> realise this may get complicated when factoring in lighting parameters etc.
> I wonder if you could shed some light on this. (another one of my good puns >
<g>).
The answer from tech is….
"3ds just uses gamma in the standard way. I would suggest looking at
any standard graphics book (e.g. Foley, van Dam, Feiner and Hughes)
and look under gamma correction.
By the way lighting has nothing to do with it, as the affect happens
to the final RGB value."
>> By the way lighting has nothing to do with it… <<
Lighting has everything to do with it because for any given RGB value
assigned in the material editors, increasing or decreasing the light
source will change the rendered value of the assigned material. If
the lighting is too hot it will not fall within the legal NTSC color
space.
The formula determines YIQ values from RGB and then relates them to
legal NTSC color space. Y = Luminance. I/Q is NTSC's color wieghting
distribution.
Gamma is also effected by Lighting because depending on the light
level in the scene, the assigned RGB value will change when rendered
to a different RGB value. Which makes calculating YIQ based on RGB
values in the materials editor pointless without considering lighting
and gamma.
I'd like confirmation that the Gamma formula in Foley etc. is the
actual gamma correction formula used in 3DS.
Hi John,
<<.. . is the actual gamma correction formula used in 3DS… >>
"lookup value = intensity to the 1.0/y (where y/gamma represents the
nonlinearity of the monitor — ie, a gamma of 1 represents a linear device) "
"lookup value = intensity to the 1.0/y (where y/gamma represents the
nonlinearity of the monitor…. <<
This is like gamma 101. I totally understand gamma as it relates to
video. You tell me the kind of camera you're using or any non-linear
output device for that matter and I can calculate what the gamma
needs to be, applied to that device and correct for the NTSC monitor
so that it is linear.
3DS output through a linear device without gamma correction like an
Illuminator Pro in YUV should be 2.2 amount of gamma applied to the
rendered image to be correct. It is not. The default *lighting* is
too hot or the way 3DS is applying gamma is not standard.
It matters little which the case is, but I need the formula to be able to
calculate what gamma value *needs* to be applied regardless of how its being
applied for a given RGB value to calculate correct video space.
Thanks,
John
Hi John,
<<.. but I need the formula.. >>
I'll did deeper and knock on a few more doors..
Jonas,
>> I'll did deeper and knock on a few more doors…. <<
Thanks much, I didn't realise that it would be that complicated but regardless
I think it is well worth it because alot of people do not have Waveform /
Vectorscopes and are really in the dark about getting legal NTSC video out of
their systems. The formula I've provided will work after the fact as a check,
but I think it would be more convienent to be able to select a color and then
know that it will be video safe before rendering. Alot of animation gets by
that is not video legal, so if nothing else this should help people become more
aware of what color values they're using. Lets hope anyway, and hopefully it
will help alleviate alot of the questions with regard to the proper gamma
setting etc.
Thanks again,
John
Hi John,
<< the formula.. >>
There is nothing special about 3DS's use of gamma. The forumla is simply:
(1.0 / gamma)
(x / 255.0) * 255
where x is a value between 0 and 255 and the result is a number between 0 and
255 (if you are dealing with 8 bit deep intensities). Here is a simple
verification of this. With 3DS's default gamma value of 1.8 go into 3DS and
set the background so that green is set to 128 and then render to your favorite
24 bit image file format. Then with your favorite image file tool you will
find that all of the pixels have a green component of 174 (or one different if
dither is on). This corresponds to:
(1.0 / 1.8)
(128 / 255) * 255 = approximately 174
Thanks very much Jonas,
I'm amazed that its that simple. Especially as my understanding from my
conversations with Jack P. on the subject is that it is weighted so that the
midtones would be effected most, with the darkest and the lightest values
effected least. Which makes total sense from the sampling I did previously.
This formula looks to me as though everything gets boosted across the spectrum,
but that can't be, so there must be some algorithmic distribution built in that
just isn't apparent.
Thankyou very much for tracking this down. I think it will be most useful in
helping more fully understanding gamma and its relationship to NTSC legal
colors in the 3DS context.
BTW can I assume that this information may be shared should the occassion
arise?
John