Shader node reflection model setup inaccuracy?


  • Poser Ambassadors

    Now it should be apparent that the reflect node is sampling all over the place on the EnvSphere but everywhere it gets the answer, 1 (max white).

    Therefore with 100% reflection on the ball, it, too, appears to be 1 (max white). This is expected. It is, however, NOT physically correct, nor even plausible.


  • Poser Ambassadors

    There are numerous correct ways to make a glossy black surface, and an infinite number of incorrect ones. (Your odds of picking a correct one at random are near zero).

    Here's one way. This is how a perfectly smooth glossy (glassy) surface appears in a furnace.

    0_1501473088602_42262984-e23b-4143-82bf-8a110d75c68c-image.png


  • Poser Ambassadors

    Here is one of many correct ways to make a glossy surface with idealized Lambertian diffuse reflectance, with rgb 128, 20, 20 as the diffuse color.

    0_1501473208119_7c77b5ec-b3e2-44ae-9eba-4aad71552133-image.png

    The appearance in a furnace is correct. But we don't often experience furnaces so it looks funky.


  • Poser Ambassadors

    Just to preserve our belief in the shader, I changed the EnvSphere to use a nice HDRI and the render looks very plausible.

    0_1501473435567_ee6308ac-f3b2-4b7c-bfa5-8a3b13fb9e40-image.png


  • Poser Ambassadors

    Before we get into studying parameters and node arrangements, it will be useful to have a way to do two different setups in the same prop.

    Rotate your Ball using yRotate = 90 degrees.

    Now let's make a procedural mask for the ball that will give us black (0) for the left half, and white (1) for the right half.

    It should look like this.
    0_1501473727685_ab9800fc-bda8-44e4-b63e-fab44f6fec74-image.png


  • Poser Ambassadors

    Now we can use that 0/1 mask to give us a "control" sample and an experimental sample.

    Here I used it plugged in to a Reflect node Softness parameter. So, on the left, our known "control" is still as rendered earlier, with Softness 0. The left half is still completely white as we expect.

    0_1501474052549_af519c08-de85-43a6-ac14-b91a8da4015b-image.png

    The right half is something else though! The right half has Softness .5 because whatever you plug in is multiplied with the value, so .5 times 1 is .5.

    Interestingly the ball is not white. In fact, it's not even uniform. The center is darker than the edge.


  • Poser Ambassadors

    Change the experimental value to 1 and the difference is even more striking.

    0_1501474148656_75c6f2eb-4579-4766-938d-7e4612f50496-image.png

    I measure around 150 in the center, and 192 near the edge.

    I cannot explain this behavior. I presume it means that the legacy Reflect node, when running in SuperFly, is actually using one of the micro-facet reflection models, and not the simple direct sampling we're used to from FireFly.


  • Poser Ambassadors

    A quick test with the HDRI shows a surface that appears very much like a diffuse reflection.

    Except it's not the same. No model of diffuse reflection gets brighter at the edges - quite the opposite.

    0_1501474471212_5b410d7d-12ef-43d4-b9ca-6eed660118e6-image.png


  • Poser Ambassadors

    Here is a setup with a Diffuse node (rgb 150 150 150) on the left side and the Reflect node with Softness = 1 on the right side.

    0_1501474682638_84753f40-651a-4ab0-8d69-50e0c7b51b73-image.png

    Observe how at the center they're very similar, but approaching the edge they differ significantly.


  • Poser Ambassadors

    So we've demonstrated that with the legacy Reflect node, there is some micro-facet model in play. Could we guess that the Reflect node is actually now a "synonym" for the GlossyBsdf node in a particular setup?

    Let's try it and see.

    0_1501474908998_95550d0e-9b92-49d0-beff-f81b87d2218f-image.png

    I guessed that the equivalent would be GlossyBsdf with Color white and Distribution GGX.

    Looks like a match to me.

    But let's try a different Distribution just to be sure.

    0_1501475001397_95e19453-fde8-4e43-a918-0f82e757f905-image.png

    Well - clearly it's not even slightly matching the Beckmann distribution.

    I will leave it to you to experiment with other Distributions and other settings for Roughness. I tried a few and nothing was even close. I'm pretty convinced that the Reflect node is synonymous with the GlossyBsdf set to GGX.


  • Poser Ambassadors

    Let's test the first two of the original posted shaders, using the furnace.

    Note that because I want both setups in the same shader, I had to make a small change to replicate the first shader. Instead of plugging the diffuse into Alternate_Diffuse and the ks_microfacet into the Alternate_Specular, I did the equivalent combination using an AddClosure. I can assure you the math is the same.
    0_1501476029359_a971c850-69ee-455f-9438-58108f71dbc6-image.png

    The two shaders produce different responses and it is (to me anyway) obvious why this is so.

    The first (top) setup let's the diffuse node run free without modulation, and modulates the ks_microfacet reflectance using the idealized Fresnel equation.

    The second arrangement (bottom) uses the fresnel factors to modulate BOTH.

    In terms of math, letting S denote the specular node, D the diffuse node, and F the Fresnel coefficient for reflection, we can describe the first and second like this:

    First: D + FS
    Second: (1-F)D + FS

    See the difference? It is no surprise that the outcome differs.


  • Poser Ambassadors

    As further evidence of the math, I make a small addition to the first (top) shader wherein I use the complement of the Fresnel reflection coefficient to modulate the Diffuse node.

    And now, the two arrangments produce exactly the same result.

    0_1501476396906_8b1427ea-3831-46c3-91ac-7af20b66ef66-image.png

    So it should be clear that the two shaders truly are now "basically the same", and they DO produce the same results.


  • Poser Ambassadors

    Now up top I changed to noobalien's 3rd arrangment. This is basically the same and the image shows this.

    0_1501476727036_010eb8b0-a8df-47a1-840f-273beaaba92a-image.png

    However, and this is a very interesting point, these arrangements do differ in parameterization. The 3rd (top) arrangement offers a unique opportunity to manipulate the shader in certain ways that matter towards producing a more physically accurate shader, given that the surface is not ideally smooth, but instead has roughness.

    The simpler (bottom) arrangement does not let us adjust the Fresnel equation to compensate for roughness! And that is why the 3rd (top) arrangement is "better".

    This is a common theme in my shaders and a common complaint by other users who perceive my shaders as overly complicated. The complication is NECESSARY to implement variations. When you look at a particular set of values (such as roughness = 0), then it is possible to remove some nodes.

    But to allow for the other billion roughness values, AND maintain physical accuracy, the four-node setup is far more flexible than the three-node setup, even though they appear to be the same.

    They're only the same because they're unfinished. They are both equally WRONG at the moment, but one is easier to correct than the other.


  • Poser Ambassadors

    However, we have a serious problem.

    Nobody appears to know what is physically correct here.

    As you noted, noobalien,

    Supposedly, the roughness value should correlate to the interval between the fresnel black & white colours with grey values instead, but I can't find such reflection percentages anywhere.

    Indeed. I can't find any published rules for this either. We have only a series of ever-better "plausible" theories and implementations, as well as numerous parameterizations that more or less do what artists expect them to.

    I can tell you what I've used in the past, but I can also point to regimes where my roughness compensator would fall over.

    But it isn't just me. I recently read a paper from Disney where they explained the latest "principled" shader and why it's better, but they still showed an impossible outcome in the furnace from what is widely considered the best shader to use by far.

    Meh.


  • Poser Ambassadors

    This is pretty much what I used to manage the Fresnel effect for rough surfaces.

    I add one more blender and I blend the Fresnel with a constant rgb 64 64 64, according to how rough the surface is.

    This reduces the edge reflectance to be closer to the center reflectance.

    But when the IOR changes, then the gray value has to change some more. When I want the gray to automatically track the IOR, I can actually use an equation from a few more nodes.

    Here it is with no (black) diffuse in the furnace, with right-side roughness at .2
    0_1501478321063_e07a3ced-826a-42cf-84a0-641b4dc00d62-image.png

    Here with roughness .5 and with the HDRI environment.

    0_1501478410467_77f04139-6a96-4257-8346-bf7c95e78f9a-image.png

    There is still some Fresnel effect, but much reduced.

    Is it physically accurate? No, or at least I can't prove it. But it works well.


  • Poser Ambassadors

    Here it is with red diffuse.

    0_1501478540321_38454eb8-4157-4dc2-bce8-901b034b38e0-image.png


  • Poser Ambassadors

    Note in the past I have referred to this pattern as "rough surface fresnel". I used it to make very realistic skin even in FireFly, but it was very expensive to calculate.

    It found its way into EZSkin and I believe the checkbox is "Rough surface Fresnel".


  • Poser Ambassadors

    One more render and then I'm going to bed.

    This is using the above shader, roughness = .1 on the left, and .2 on the right.

    0_1501479019861_RoughSurfaceFresnel.jpg


  • Poser Ambassadors

    When I got up and looked at this I realized I made a mistake in parameterization. Looking at that image I was bothered by the still-very-high amount of fresnel edge reflection with that much blur.

    I forgot to add the squaring term I use on roughness and so does Disney. Without it the fresnel and blur don't go together, and the roughness number is too powerful and hard to use.

    0_1501500113134_68d34788-401a-4c18-a4b0-f65bda9cfea1-image.png


  • Poser Ambassadors

    With the roughness squaring term, a test render with .1 and .3 roughness looks like this

    0_1501500207532_RoughSurfaceFresnel.jpg

    I just woke up and intended to do .1 and .2 but that is .3. Need more coffee.

    Here is .1 and .2.
    0_1501500516465_RoughSurfaceFresnel.jpg