Valley of the Shadow of Death or Size does matter at least for Iray

124»

Comments

  • jag11jag11 Posts: 885

    When I first learnt pencil drawing the first thing i had to practice was drawing shades, I had to draw 10 shades starting from black, to white, so I wanted to replicate that in Photoshop and see how that renders in Iray. An RGB color has 3 components, red, green, blue with 256 values from 0 to 255, I required 10 shades, the values required are:

    0, 26, 51, 77, 102, 128, 153, 179, 204, 230, 255. All values are spaced by 10%. Here is the finished texture.

    The shades texture

    In DAZ Studio I created a new scene with a plane holding the recently created texture "shades.png", named it as IntensitiesFromTexture to get the best picture the texture was layed out as an 10 cd/cm2 emitter.

    Then I decided to add new a tile in the middle with the same intensity as the one created in Photoshop, the one with the 50% intensity. If the top emitter is 10 cd/cm2 then the 50% is 5 cd/cm2. I named the tile as tile-intensity- 50%

    ​Rendered but the middle tiles did not match, why?

    Decided to test with the other missing intensities, added the other tiles and adjusted intensities. Rendered again, but the lower row tiles are lighter.

    Decided to try a different strategy, changed Luminance to the full 10 cd/cm2 and adjust the color values from (1.00, 1.00, 1.00) to (.50, .50, .50), by holding Control Key, to open the Float Color Dialog ,  Rendered again, same result.

    Then I looked at Emission Color and noticed the color shown was lighter

    So this time I opened the Select Color Dialog, and noticed that the RGB Color was 186, 186, 186.

    Mmm, it should be (128, 128, 128), so I changed it. Rendered again and the middle tiles matched this time.

    Now, how do I make the remaing tiles match color, knowing that the top row is the correct one? I can't apply gamma in the Float Color or the Select Color dialogs.

    Oh, changed Tone Mapping settings -> gamma to 1.00, now the bottom row matched my original texture but the top row now looks dark.

    Opened Image Editor Dialog and Changed Image Gamma value to 1.

    Now they match again.

    Here are the test files if you want to play with them.

     

     

     

     

     

     

  • SixDsSixDs Posts: 2,384

    "I'm going to make an official request to correct the thread please, things are getting a bit of an angry red hue."

    Which in turn has caused me to develop a sickly green hue, rather reminiscent of the earlier green balls. winksmiley

  • Since someone has commented on this, I am sorry if our discussion has any feeling of ill-will, Jag. I think we both legitimately try to understand what is going on here and I am not angry at you or anything that you have said.

  • agent unawaresagent unawares Posts: 3,513
    edited January 2018

    Okay, I've looked at the scene.

    So, the problem you are seeing is that when DS renders a texture, it converts it to linear, and this is *not* a simple multiplicative process, how much the color needs to be adjusted depends how light and how dark it is. So when you tell DS that the image gamma is 2.2 and it linearizes it for the render, the color blocks are no longer simple 10% steps away from each other, they have all shifted according to a different ratio. So making all the emissives that are 10% apart from each other the same amount lighter and darker will only match up one of them at a time (except the two ends).

    And then when you tell DS "the image is already linear" so it does no conversion, then the sets match up because the texture values stayed 10% steps apart from each other.

    Essentially, what has even steps on our monitors adjusted for gamma 2.2 is not the same as what has even steps in linear space.

    I will see if I can figure how to correctly linearize the emission values; it should be fairly simple but I don't think quite as straightforward as converting something from sRGB.

    Post edited by agent unawares on
  • Okay, it is pretty simple still.

    First you convert to a float value based on your emission range. In this case your range is from 0 to 10, so you divide values by 10.

    Then you take that float value and raise it to the power of 2.2.

    Then to translate it back to the right scale, multiply that result by 10.

    So the values are: 0, 0.063, 0.29, 0.71, 1.33, 2.17, 3.25, 4.56, 6.12, 7.93, 10.

    Which gives this:

    image

    scale.png
    600 x 109 - 5K
  • jag11jag11 Posts: 885

    Okay, it is pretty simple still.

    First you convert to a float value based on your emission range. In this case your range is from 0 to 10, so you divide values by 10.

    Then you take that float value and raise it to the power of 2.2.

    Then to translate it back to the right scale, multiply that result by 10.

    So the values are: 0, 0.063, 0.29, 0.71, 1.33, 2.17, 3.25, 4.56, 6.12, 7.93, 10.

    Which gives this:

    image

    Thanks. That's what I wanted to prove with the spheres and the reasoning with the weird 4.4 gamma value applied...

    Most people believe they are rendering in the proper space. And when they feed DS textures and RGB values they are not in the required linear space.

    When you work in the linear space the colors are vivid, not faint.

    Iray applies gamma correction to convert to linear space(first 2.2), once the rendering finishes, we apply another 2.2 via Tone Mapping settings (2.2 + 2.2 = 4.4), so the magic 4.4 value compensates that correction and places the texture or RGB color in the right space. That's the reason I said blindly which fishtales image was the right one.

    It is confusing, disturbing if you want, but that's how it works under the hood.

    So, the purpose of this thread was to explain the inner works of Iray for taking advantage of the full capabilities.

     

  • jag11 said:

    Okay, it is pretty simple still.

    First you convert to a float value based on your emission range. In this case your range is from 0 to 10, so you divide values by 10.

    Then you take that float value and raise it to the power of 2.2.

    Then to translate it back to the right scale, multiply that result by 10.

    So the values are: 0, 0.063, 0.29, 0.71, 1.33, 2.17, 3.25, 4.56, 6.12, 7.93, 10.

    Which gives this:

    image

    Thanks. That's what I wanted to prove with the spheres and the reasoning with the weird 4.4 gamma value applied...

    Most people believe they are rendering in the proper space. And when they feed DS textures and RGB values they are not in the required linear space.

    When you work in the linear space the colors are vivid, not faint.

    Iray applies gamma correction to convert to linear space(first 2.2), once the rendering finishes, we apply another 2.2 via Tone Mapping settings (2.2 + 2.2 = 4.4), so the magic 4.4 value compensates that correction and places the texture or RGB color in the right space. That's the reason I said blindly which fishtales image was the right one.

    It is confusing, disturbing if you want, but that's how it works under the hood.

    So, the purpose of this thread was to explain the inner works of Iray for taking advantage of the full capabilities.

    Linear space is gamma 1 - that's what makes it linear, there is not power relationship between tones. Images in Linear space tend to look flat and dim until gamma correction is applied.

  • agent unawaresagent unawares Posts: 3,513
    edited January 2018
    jag11 said:

    Okay, it is pretty simple still.

    First you convert to a float value based on your emission range. In this case your range is from 0 to 10, so you divide values by 10.

    Then you take that float value and raise it to the power of 2.2.

    Then to translate it back to the right scale, multiply that result by 10.

    So the values are: 0, 0.063, 0.29, 0.71, 1.33, 2.17, 3.25, 4.56, 6.12, 7.93, 10.

    Which gives this:

    image

    Thanks. That's what I wanted to prove with the spheres and the reasoning with the weird 4.4 gamma value applied...

    Most people believe they are rendering in the proper space. And when they feed DS textures and RGB values they are not in the required linear space.

    When you work in the linear space the colors are vivid, not faint.

    Iray applies gamma correction to convert to linear space(first 2.2), once the rendering finishes, we apply another 2.2 via Tone Mapping settings (2.2 + 2.2 = 4.4)

    No, this is not what happens. As I said before, Image Gamma is not the same as tonemapping. There is no magic 4.4 number.

    This is what actually happens (the fact that I actually understand how these calculations work is the reason I am successfully finding the correct numbers to get colors and values to match textures and you are having trouble):

    First, Iray applies gamma correction to get to linear space from gamma 2.2. So you have value^2.2. Then once the rendering finishes that result is tonemapped back to gamma 2.2, which is result^0.45454545... . And the final render is (value^2.2)^0.45454545...=value. If you have the lighting somehow perfect you will get your correct-looking sRGB texture rendered back exactly.

    There is no "adding" of gamma values anywhere.

    Post edited by agent unawares on
  • agent unawaresagent unawares Posts: 3,513
    edited February 2018

    To go deeper into this, adding gamma values isn't even valid from a mathematical standpoint.

    If you gamma correct from 2.2 to linear "twice," this is what you are doing: (value^2.2)^2.2=value^(2.2*2.2)=value^4.84

    If you tonemap to gamma 2.2 then do it again, this is what you are doing: (value^0.45454545)^0.45454545=value^(0.45454545*0.45454545)=value^0.206612, and of course 0.206612 is the same thing as 1/4.84

     

    If you're going to insist that the correction to linear is working the inverse of how it should, even though it isn't, at least use the numbers that would exist in that scenario. ;)

    Post edited by agent unawares on
  • barbultbarbult Posts: 23,155
    jag11 said:

    Okay, it is pretty simple still.

    First you convert to a float value based on your emission range. In this case your range is from 0 to 10, so you divide values by 10.

    Then you take that float value and raise it to the power of 2.2.

    Then to translate it back to the right scale, multiply that result by 10.

    So the values are: 0, 0.063, 0.29, 0.71, 1.33, 2.17, 3.25, 4.56, 6.12, 7.93, 10.

    Which gives this:

    image

    Thanks. That's what I wanted to prove with the spheres and the reasoning with the weird 4.4 gamma value applied...

    Most people believe they are rendering in the proper space. And when they feed DS textures and RGB values they are not in the required linear space.

    When you work in the linear space the colors are vivid, not faint.

    Iray applies gamma correction to convert to linear space(first 2.2), once the rendering finishes, we apply another 2.2 via Tone Mapping settings (2.2 + 2.2 = 4.4)

    No, this is not what happens. As I said before, Image Gamma is not the same as tonemapping. There is no magic 4.4 number.

    This is what actually happens (the fact that I actually understand how these calculations work is the reason I am successfully finding the correct numbers to get colors and values to match textures and you are having trouble):

    First, Iray applies gamma correction to get to linear space from gamma 2.2. So you have value^2.2. Then once the rendering finishes that result is tonemapped back to gamma 2.2, which is result^0.45454545... . And the final render is (value^2.2)^0.45454545...=value. If you have the lighting somehow perfect you will get your correct-looking sRGB texture rendered back exactly.

    There is no "adding" of gamma values anywhere.

    This makes mathematical sense to me and is the most understandable explanation so far, for me.

Sign In or Register to comment.