Announcement

Collapse
No announcement yet.

Replicate the VFB contrast in compositing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replicate the VFB contrast in compositing

    Hi guys.
    I've got a VFB related question.

    How is the Contrast option(under the Exposure rollout, in the VFB) working?

    I can't seem to reproduce that sort of contrast in compositing(Photoshop / Fusion)
    My workflow is that I'm saving the render as an EXR(with no colour-corrections applied) and then re-apply these colour-corrections(exposure, highlight burn, LUT AND gamma - in this order) back in comp.
    But now I'm trying to add the Contrast too(besides exposure and highlight burn, LUT and gamma) in the Fusion comp, but the result doesn't seem to be the same as in the VFB.
    Would the contrast be applied to the EXR before or after the exposure, highlight burn, LUT and gamma?

    I tried to apply it in all ways but no matter what I do, I can't replicate the VFB results.
    That leads me to think that the Contrast tool in Fusion is not the same as the one the VFB.
    Is the VFB contrast algorithm different than the one you can find in other applications such as Photoshop, Fusion, etc.)?
    And, if yes, how would I replicate that sort of VFB contrast in my compositing application?

    Thank you.
    Peter.
    CGI studio: www.moxels.com

    i7-4930K @ 3,4GHz watercooled
    Asus Rampage V Extreme Black Edition Intel X79
    64 GB DDR3 Corsair Vengeance Jet Black 1866 MHz Quad Channel
    8 * GTX Titan X
    960GB SSD Crucial M500 SATA-3
    nVidia drivers: always latest
    Windows 10 up to date

  • #2
    I'm not sure exactly what the "Contrast" control is doing in the VFB but it appears to be modifying the contrast with a curve adjustment rather than pulling in the absolute White and Black values. Absolute 0 values stay pure black but anything that's just slightly above gets adjusted, same for whites. In Fusion if you use a ColorCurve (CCv) and add two points and make all of those linear and then arrange the two middle ones to make a vertical or horizontal line in the middle you'll get virtually identical results. Weirdly it seems to match best when I work in non-linear workflow in Fusion (i.e., you'll need a gamut before and after the CCv if you want to keep the view LUT active). You can get similar results in photoshop with the curves adjustment (no 32bit!) although it's more difficult since the curve does not have handles (it's almost easier to draw it using the pencil for the horizontal line).
    Last edited by dlparisi; 03-10-2018, 07:02 PM.
    www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

    Comment


    • #3
      Hmm.
      Not sure I follow your explanation about the Fusion solution. I got lost when you said I should add 2 middle points and alight them in the middle.

      In fact, that's the solution I care about, not the Photoshop one.

      CGI studio: www.moxels.com

      i7-4930K @ 3,4GHz watercooled
      Asus Rampage V Extreme Black Edition Intel X79
      64 GB DDR3 Corsair Vengeance Jet Black 1866 MHz Quad Channel
      8 * GTX Titan X
      960GB SSD Crucial M500 SATA-3
      nVidia drivers: always latest
      Windows 10 up to date

      Comment


      • #4
        Yeah, not the best explanation. I've attached a zip file with 2 .setting files that you can load in to the ColorCurve (right click on node-->Settings-->Load). The +1 contrast should look like this...
        Click image for larger version  Name:	colorCurve-Contrast 1.jpg Views:	1 Size:	27.0 KB ID:	1013218


        ColorCurves-Contrast Options.zip
        Attached Files
        www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

        Comment


        • #5
          BTW-you can avoid the whole gamut nodes thing if you center the horizontal or vertical lines around a .219 value (mid gray in linear) rather than .5.
          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

          Comment


          • #6
            I should also point out that what I'm describing here is the extreme of -1 and 1 contrast (which you would probably never want to actually use). To get something in between you probably just want to adjust the handles on the two end points of the curve. Basically the equivalent of the old s-curve adjustment.

            Click image for larger version

Name:	colorCurve-Contrast.jpg
Views:	115
Size:	29.0 KB
ID:	1013224
            www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

            Comment


            • #7
              If you've got a slice tool in fusion (here's one - https://www.pixelfondue.com/blog/201...ckmagic-fusion), you could make a black to white gradient in fusion, run the slice tool on it to confirm it's a linear gradient, then load that image into the vfb, put on some contrast and save it out and run the slice tool on it again to see how it's changed?

              Comment


              • #8
                Here is the code that V-Ray uses, perhaps someone can turn this into a Nuke expression or something?

                Code:
                float schlickBiasPrecomputedMult(float t, float biasMult) {
                    return t/(biasMult*(1.0f-2.0f*t)+1.0f);
                }
                
                // Nonlinear contrast correction function which preserves the detail in dark and bright areas.
                float contrastFunc(float c, float slope, float biasMult) {
                    float res;
                
                    // Use Schlick's gain function in [0.0, 1.0] (which is a bias function in [0.0, 0.5] and a reflected bias in [0.5, 1.0]).
                    // Outside [0.0, 1.0] use a linear function with a slope equal to the slope of the gain function at 0.0 and 1.0.
                    if (c<=0.0f) res=c*slope;
                    else if (c<0.5f) res=schlickBiasPrecomputedMult(c, biasMult);
                    else if (c<1.0f) res=1.0f-schlickBiasPrecomputedMult(1.0f-c, biasMult);
                    else res=(c-1.0f)*slope+1.0f;
                
                    return res;
                }
                
                // Apply contrast on the given linear input color
                VUtils::Color contrast(VUtils::Color &color) {
                    // Calculate the contrast bias
                    float bias=-contrast*0.5f+0.5f;
                    bias=clamp(bias, 1e-3f, 1.0f-1e-3f);
                    contrastBiasMult=1.0f/bias-2.0f;
                
                    // Calculate the slope of the contrast function at t>=1.0
                    contrastSlope=bias/(1.0f-bias);
                
                    // Linear input color
                    VUtils::Color res=color;
                
                    // Remove any negative components
                    res.clampMin();
                
                    // We apply the contrast function in sRGB color space
                    res.encodeToSRGB();
                
                    // Apply the contrast to each color component separately
                    float r=contrastFunc(res.r(), contrastSlope, contrastBiasMult);
                    float g=contrastFunc(res.g(), contrastSlope, contrastBiasMult);
                    float b=contrastFunc(res.b(), contrastSlope, contrastBiasMult);
                    res.set(r, g, b);
                
                    // Convert back to linear space
                    res.decodeFromSRGB();
                
                    return res;
                }
                Best regards,
                Vlado
                I only act like I know everything, Rogers.

                Comment


                • #9
                  Again another good example why we finally need to be able to save the image exactly as we see it in VFB, with contrast, LUT etc. applied. Why do all that in Fusion, Nuke or anything again, when it is so much simpler to just save it straight from VFB? I just can't get my head around this. The less tools are needed to get a good looking image, the better. As we say in Germany: Too many cooks spoil the porridge.
                  https://www.behance.net/Oliver_Kossatz

                  Comment


                  • #10
                    Originally posted by kosso_olli View Post
                    Again another good example why we finally need to be able to save the image exactly as we see it in VFB, with contrast, LUT etc. applied. Why do all that in Fusion, Nuke or anything again, when it is so much simpler to just save it straight from VFB? I just can't get my head around this. The less tools are needed to get a good looking image, the better. As we say in Germany: Too many cooks spoil the porridge.
                    Indeed.
                    The VFB as it is, is completely inconsistent.
                    If you save the render as an .exr, it saves certain corrections but doesn't save others.
                    it took me a lot of white hairs to figure out what is being saved and what not, and how would I work around that.

                    But, none the less, you'd still need to reproduce all these colour corrections in comp since, in comp, you may want to add other elemtbs like: peole, says, glows and what not. And you need to apply many of these things on the 32 bit image, then add the gamut and LUT again.
                    I wish we could just save ALL vfb colour corrections as an LUT and then re-use it wherever you want. That would be the simplest thing to do, and save all drama aroind all these VFB issues.
                    CGI studio: www.moxels.com

                    i7-4930K @ 3,4GHz watercooled
                    Asus Rampage V Extreme Black Edition Intel X79
                    64 GB DDR3 Corsair Vengeance Jet Black 1866 MHz Quad Channel
                    8 * GTX Titan X
                    960GB SSD Crucial M500 SATA-3
                    nVidia drivers: always latest
                    Windows 10 up to date

                    Comment


                    • #11
                      Originally posted by peteristrate View Post
                      I wish we could just save ALL vfb colour corrections as an LUT and then re-use it wherever you want. That would be the simplest thing to do, and save all drama aroind all these VFB issues.
                      I think it will not work when the corrections are saved as LUT. Nearly every piece of software I tested interprets the LUT different. I could not get an exact match. A LUT applied in Photoshop for example looks different than in After Effects. I wouldn't say that this is correct, though. Adobes products are a likely to be wrong...

                      https://www.behance.net/Oliver_Kossatz

                      Comment


                      • #12
                        Originally posted by kosso_olli View Post

                        I think it will not work when the corrections are saved as LUT. Nearly every piece of software I tested interprets the LUT different. I could not get an exact match. A LUT applied in Photoshop for example looks different than in After Effects. I wouldn't say that this is correct, though. Adobes products are a likely to be wrong...
                        Not sure about Adobe products, but in Fusion, Nuke the LUTs can be matched perfectly.
                        Not the contrast, though - I mean, I don't know how to do it.

                        I will ask in a Fusion group too and let you know if I find a solution.
                        CGI studio: www.moxels.com

                        i7-4930K @ 3,4GHz watercooled
                        Asus Rampage V Extreme Black Edition Intel X79
                        64 GB DDR3 Corsair Vengeance Jet Black 1866 MHz Quad Channel
                        8 * GTX Titan X
                        960GB SSD Crucial M500 SATA-3
                        nVidia drivers: always latest
                        Windows 10 up to date

                        Comment


                        • #13
                          Further proof that Adobes products are doing bad stuff...
                          https://www.behance.net/Oliver_Kossatz

                          Comment


                          • #14
                            Originally posted by kosso_olli View Post
                            Again another good example why we finally need to be able to save the image exactly as we see it in VFB, with contrast, LUT etc. applied.
                            You will be able to do this with the V-Ray Next update.

                            Best regards,
                            Vlado

                            I only act like I know everything, Rogers.

                            Comment


                            • #15
                              Originally posted by peteristrate View Post
                              The VFB as it is, is completely inconsistent. If you save the render as an .exr, it saves certain corrections but doesn't save others.
                              This is because the ways people use the VFB are wildly inconsistent VFX guys only use the color corrections for display purposes and exploration of the rendered result but absolutely do not want any of those burned into the final image. Other users prefer to have it all baked in, especially if the result is processed in Photoshop or directly sent to clients. It seems like we will need to provide options for both types of workflow.

                              Best regards,
                              Vlado
                              I only act like I know everything, Rogers.

                              Comment

                              Working...
                              X