Announcement

Collapse
No announcement yet.

Determining correct falloff

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

  • Determining correct falloff

    So it was brought to my attention that Viscorbel had found a problem with the custom brdf method I've been teaching in the Mastering V-Ray course.

    You can read more here.
    http://viscorbel.com/vray-materials-part-3-metals/
    Image taken from his blog post:


    So I did some testing and I honestly expected the reflections to line up to the orientation of the lights (22.5* rotation) but they don't. Maybe I'm just tired and over thinking this, but from an orthographic camera, shouldn't these reflections line up and if they don't, is what Viscorbel trying to do physically correct?
    admin@masteringcgi.com.au

    ----------------------
    Mastering CGI
    CGSociety Folio
    CREAM Studios
    Mastering V-Ray Thread

  • #2
    So after thinking about it for a second I realised it's because the thickness of the sphere offsets the angle at which the ray hits the surface.



    Just need confirmation that the 3dsMax Falloff map does work linearly and everything is correct.
    admin@masteringcgi.com.au

    ----------------------
    Mastering CGI
    CGSociety Folio
    CREAM Studios
    Mastering V-Ray Thread

    Comment


    • #3
      I've just tried this and I get the same result as Viscorbel.

      Correct me if I'm wrong but you are expecting the falloff map to return RGB 128 at 45 degrees. It appears that it actually returns RGB 76.

      I've attached a couple of images and a Max 2014 scene if anyone else want to check.

      Click image for larger version

Name:	Falloff Test RGB.jpg
Views:	1
Size:	44.1 KB
ID:	855867Click image for larger version

Name:	Falloff Test BW.jpg
Views:	1
Size:	26.5 KB
ID:	855868
      Attached Files
      Dan Brew

      Comment


      • #4
        The falloff map is not linear, the correction curve to linearize it looks roughly like the attached image.
        Click image for larger version

Name:	correction_curve.png
Views:	1
Size:	2.9 KB
ID:	855871
        Seems that 3ds max uses some math behind the scenes to distort it for some reason.

        Comment


        • #5
          Does that curve look a tiny bit srgb-ish?

          Comment


          • #6
            The Falloff map works with the cosine of the angle, and not with the actual angle. The curve that viscorbel shows above is the graph of its inverse (the arccos function).

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

            Comment


            • #7
              It kind of does, but it's not...
              Here's an overlayClick image for larger version

Name:	srgb_comp.jpg
Views:	1
Size:	321.7 KB
ID:	855879

              I've tried correcting the falloff map with gamma or reverse gamma, but that doesn't fix it, just distorts it differently

              Comment


              • #8
                I knew someone smarter would figure out the math behind it

                Comment


                • #9
                  Originally posted by joconnell View Post
                  Does that curve look a tiny bit srgb-ish?
                  That's exactly what I thought but I can't make the maths to fit.

                  255 * (0.5^2.2) = 55.5

                  I'm getting a value of approximately 76 at 45 degrees.
                  Dan Brew

                  Comment


                  • #10
                    Originally posted by DanielBrew View Post
                    That's exactly what I thought but I can't make the maths to fit.
                    Use cos/arccos instead...

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

                    Comment


                    • #11
                      Originally posted by vlado View Post
                      The Falloff map works with the cosine of the angle, and not with the actual angle. The curve that viscorbel shows above is the graph of its inverse (the arccos function).

                      Best regards,
                      Vlado
                      Maybe this could be implemented with an OSL-Texture, so that we could use it with the gradient remap like Viscorbel mentioned here:

                      Attached Files

                      Comment


                      • #12
                        Originally posted by Wobi View Post
                        Maybe this could be implemented with an OSL-Texture
                        Feel free That's what OSL is for.

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

                        Comment


                        • #13
                          Hehe, yeah I'm trying to do so, but my maths skills are just not good enough.
                          I got the part with the facing ratio, but I can't get the arccos-thing to work:

                          Code:
                          shader facing_ratio_linear (
                             
                            
                                  output color Col_Out = color(0.5)
                          )
                          {
                          
                              float facing = 1 - (dot(normalize(N), normalize(I))* -1);
                                  Col_Out = color(facing , facing , facing );
                          
                          }
                          I try to get the graph we are after here:

                          http://rechneronline.de/function-graphs/

                          with the function: acos(x)

                          But this just doesn't look like the graph we need....
                          Last edited by Wobi; 20-04-2015, 08:57 AM.

                          Comment


                          • #14
                            Try acos(1-x)/(pi*0.5)

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

                            Comment


                            • #15
                              Yes, that does it:

                              facing_ratio_linear.osl
                              Code:
                              shader facing_ratio_linear (
                                     output color Col_Out = color(0.5)
                              )
                              {
                                     float floatOut = acos (1.0 - (1 - (dot(normalize(N), normalize(I))* -1)))/(M_PI * 0.5);
                                     Col_Out = color(floatOut  , floatOut , floatOut );
                              }
                              Thanks Vlado!
                              Attached Files
                              Last edited by Wobi; 20-04-2015, 09:27 AM.

                              Comment

                              Working...
                              X