Home Technical Talk

PBR Fresnel , Spec , Diff ? Marmoset none ?

interpolator
Offline / Send Message
Shrike interpolator
Hey guys

Im working on the PBR pipeline for our team and I got a really good approximation so far which im pretty happy with -

However I was wondering about the use of fresnel in spec and diffuse

Im looking at several render engines and games for reference and PDFs etc.

I set up 2 fresnel effects now, one that lightens up the edges of the specular cube a bit (looking at Toolbag), and one that is darkening perpendicular to your view, well classic fresnel.

Now I read from Pixar that the diffuse is also affected by the fresnel effect, and not just the specular component, but I didnt really find that elsewhere. Can anyone confirm this ? It looks right however.

Also looking at recently released marmoset 2, they do not seem to use a proprietairy fresnel at all, only one that brightens up the sharp angles / edges if you want, creating a rim-light effect (which is an artistic addition that is not based on real life ?)
Mainly that confused me, Marmoset not using fresnel (please correct me)
so neither darkening the spec nor the diffuse

Filmic games http://filmicgames.com/archives/557
describes that what toolbag does more or less

marmo.JPG
http://www.marmoset.co/wp-content/uploads/fresnelcompare02.jpg

Cinema 4D uses fresnel based on physical refraction index and also has presets for most common materials, which seem to exactly represent the curves you see on many talks and documents and even the marmoset website

c4d.JPG
German: Steel, Refraction index 1.51 as example

But I do not know if I use that one right, as their shader is more
of a sandbox and you can do what you want.

Here I mixed both approaches somehow to an extend:
https://hostr.co/file/tXqsxZhXZhYC/both.JPG

So anyone can lighten me up ? Should I use fresnel in the spec and diffuse or spec only ? Or is there more behind ?
Darken non-grazing angles, or only brighten grazing angles, or both ?

Replies

  • Shadownami92
    Offline / Send Message
    Shadownami92 polycounter lvl 7
    If I understand this page correctly... http://www.marmoset.co/toolbag/learn/pbr-practice

    Then I think that you will want the fresnel to effect diffuse and roughness/spec since fresnel is light reflecting at steep angles from the camera. Just taking diffuse/albedo into account I think will always achieve a smooth/soft gradient effect which would be less than ideal for more shiny/reflective surfaces. By taking the roughness into account you would get the clean reflections at sharp angles which is more like real life, while it would still be a bit like classic fresnel in how it looks if the material is more rough anyways.

    I could be wrong though so someone more experienced with PBR could probably chime in with a more accurate explanation.
  • EarthQuake
    Toolbag 2's Fresnel gets more reflective a grazing angles, as in real life. In Toolbag 1 we had the weird "center gets darker" method but that doesn't really make much sense.

    More here: http://www.marmoset.co/toolbag/learn/pbr-theory

    The gloss/rougness map also affects Fresnel, which is covered a bit in the link above.
  • Shrike
    Offline / Send Message
    Shrike interpolator
    Edit

    Wait, I see you coupled specular intensity with the fresnel effect, and so theres 2 effects, that explains a lot

    I was really confused since I used the specular intensity on full and thought it would brighten in a linear fashion. So both sliders are actually fresnel

    Why do we have terms like specular intensity or Epics "metalness" (not the texture, the shader output) as they describe on their documentation, if they just 1 to 1 describe the fresnel refraction index. Maybe im leaning too far out of the window here, but such terms just bring more complications than giving us something real we can look up and is normed. "Metalness" like if you were teaching children :/.

    Correct me if im still wrong, but all this confusion because of 3 words describing one thing, being used in 4 places then ?


    Btw, really fun digging in the stuff, building shaders, testing things love it :) can recommend
  • oks2024
    You don't want to have a Fresnel slider, it's part of the model, and described by the Fresnel term you use in your Cook Torrance BRDF (Schlick approximation is the most common).

    Sebastien Lagarde proposed a modified schlick function taking roughness into account, in order to have a fresnel attenuation for ambient specular on rough material. You may want to have a look at it: here.

    I don't know what you mean by shader output, but the metalness value is supposed to be a linear blend between two kind of materials, dielectrics and metals.

    And for the terms like "metallic" you can read th very interesting paper froam Disney about their approach of PBR: here.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    If I understand this page correctly... http://www.marmoset.co/toolbag/learn/pbr-practice

    Then I think that you will want the fresnel to effect diffuse and roughness/spec since fresnel is light reflecting at steep angles from the camera. Just taking diffuse/albedo into account I think will always achieve a smooth/soft gradient effect which would be less than ideal for more shiny/reflective surfaces. By taking the roughness into account you would get the clean reflections at sharp angles which is more like real life, while it would still be a bit like classic fresnel in how it looks if the material is more rough anyways.

    I could be wrong though so someone more experienced with PBR could probably chime in with a more accurate explanation.

    Something I've been meaning to ask about is, on that page it shows two curves, one for rubber and one for chrome. How does marmoset toolbag control the differences between materials fresnel curves?

    When rendering with the mia material in mental ray I usually turn on the Fresnel checkbox and then adjust the index of refraction to match a real world value for my material to control the Fresnel curve. Is there a similiar control inside of toolbag 2.0?

    (On a side note, In epics documentation of UE4 it states that the specular value should be treated as an IoR for advanced material creation.)

    Also the page says this about Fresnel:
    There is one big caveat for the Fresnel effect – it quickly becomes less evident as surfaces become less smooth. More information on this interaction will be given a bit later on.

    But John Hable's post seems to indicate just the opposite! Or are you saying it's less evident perhaps at certain angles or on certain shapes with higher roughness?

    http://filmicgames.com/archives/547


    oks2024:

    I agree, a Fresnel slider would be bad, but it's important to note that different materials in the real world have been measured and found to have different Fresnel curves. There should be a control for that somewhere.
  • Shrike
    Offline / Send Message
    Shrike interpolator
    oks2024 wrote: »
    You don't want to have a Fresnel slider, it's part of the model, and described by the Fresnel term you use in your Cook Torrance BRDF (Schlick approximation is the most common).

    Sebastien Lagarde proposed a modified schlick function taking roughness into account, in order to have a fresnel attenuation for ambient specular on rough material. You may want to have a look at it: here.

    I don't know what you mean by shader output, but the metalness value is supposed to be a linear blend between two kind of materials, dielectrics and metals.

    And for the terms like "metallic" you can read th very interesting paper froam Disney about their approach of PBR: here.


    ?
    The thing is that the specular intensity or the metalness (not 100% sure dont have ue4) is exactly changing the fresnel refraction index.

    In marmoset, if intensity is on full, you have a fully reflective surface, and turning it down is effectively using a lower refraction index, or well has the exact visual representation of it. ( flat angles go down in reflectivity, sharp angles stay and get sharper)


    Using a near zero specular intensity would fit for example gold, which does nearly not have reflection at flat angles (1.166), while a nearly full specular intensity in marmoset would represent something like titan (2.16), that is very reflective at flat angles.
    I agree, a Fresnel slider would be bad, but it's important to note that different materials in the real world have been measured and found to have different Fresnel curves. There should be a control for that somewhere.

    If there were no fresnel slider, how would you decide the index of a material ? As far as I grasp this, the metalness in ue4 and specular intensity in marmoset do exactly this, because its needed.

    You say it yourself that you have to input it manually in Vray, and so
    do I in cinema, because how else does the program know ?

    If you generalize conductors to a high and metals to a low index (or vice versa), then it would make somewhat sense, but then the term metalness is wrong, as gold and titan have exact opposite effective reflective strenght resulting from fresnel and are both metals

    So if I understand this right, people are now just using high specular intensity/metalness for metals because its more shiny and UE4 calls it metalness, even tho metals do often have rather low metalness
    Epic effectively learning people that just start in the new PBR system plain wrong things about real life materials while it would have been really easy to just give a RL-conform term.

    Or am i missing something huge ? Looking at a wrong index/numbers ?


    Marmoset claims 5% reflectivity for water which pretty much represent
    the index of 1.5, leading again to the specular intensity fresnel relation. And from the conclusion that we need to control fresnel somehow,
    and that using the specular intensity slider looks exactly like it, and there is no other control, I have to conclude that it is exactly that.

    So if UE4 does exactly the same, just call it metalness, then we have bad terminology again, because asphalt has more "metalness" than steel.

    This metal / non metal thing seems to be a relict from the past where you had to think in those terms to know if you had to color specular or not. Materials vary so much in real life, and doing such a generalization cannot be right.

    Please Please correct me if im wrong with this
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    Shrike wrote: »
    ?
    The thing is that the specular intensity or the metalness (not 100% sure dont have ue4) is exactly changing the fresnel refraction index.

    In marmoset, if intensity is on full, you have a fully reflective surface, and turning it down is effectively using a lower refraction index, or well has the exact visual representation of it. ( flat angles go down in reflectivity, sharp angles stay and get sharper)


    Using a near zero specular intensity would fit for example gold, which does nearly not have reflection at flat angles (1.166), while a nearly full specular intensity in marmoset would represent something like titan (2.16), that is very reflective at flat angles.



    If there were no fresnel slider, how would you decide the index of a material ? As far as I grasp this, the metalness in ue4 and specular intensity in marmoset do exactly this, because its needed.

    You say it yourself that you have to input it manually in Vray, and so
    do I in cinema, because how else does the program know ?

    If you generalize conductors to a high and metals to a low index (or vice versa), then it would make somewhat sense, but then the term metalness is wrong, as gold and titan have exact opposite effective reflective strenght resulting from fresnel and are both metals

    So if I understand this right, people are now just using high specular intensity/metalness for metals because its more shiny and UE4 calls it metalness, even tho metals do often have rather low metalness
    Epic effectively learning people that just start in the new PBR system plain wrong things about real life materials while it would have been really easy to just give a RL-conform term.

    Or am i missing something huge ? Looking at a wrong index/numbers ?


    Marmoset claims 5% reflectivity for water which pretty much represent
    the index of 1.5, leading again to the specular intensity fresnel relation. And from the conclusion that we need to control fresnel somehow,
    and that using the specular intensity slider looks exactly like it, and there is no other control, I have to conclude that it is exactly that.

    So if UE4 does exactly the same, just call it metalness, then we have bad terminology again, because asphalt has more "metalness" than steel.

    This metal / non metal thing seems to be a relict from the past where you had to think in those terms to know if you had to color specular or not. Materials vary so much in real life, and doing such a generalization cannot be right.

    Please Please correct me if im wrong with this


    A slider would be bad because there's usually not much precision and also it's easier imo if IOR isn't in a 0-1 range. Unreal is kind of a pain in that I have to convert real world IoR values to use them in unreal. It's a lot easier to put a number in the input box that matches actual IoR values.

    Also, metalness is included in toolbag 2.0 in order to be compatible with art created for next gen games who also use this technique to save memory(UE4). Instead of using a full RGB image for specular to achieve metal, they use a simple alpha to define what is metal and what is not. Both the reflectance and color of the reflection are driven by the albedo map when using a metalness input.
  • jeffdr
    Offline / Send Message
    jeffdr polycounter lvl 11
    It's all a bit complicated, and I can't quite decipher some of the questions being asked, but maybe clearly defining terminology in practical terms will help:

    "Base Reflectivity" is how reflective your surface is, neglecting any fresnel effects. Basically, pretend the fresnel effect doesn't exist, and this is how reflective your material is. It is a value between 0% and 100%, and can be colored in some cases (different for R, G, and B).

    "Index of Refraction (IOR)" is, for our purposes here, just a means of setting the base reflectivity. Any given index of refraction corresponds to one and only one base reflectivity, and vice versa. IOR does not vary depending on viewing angle, it is a constant property of a material, as is base reflectivity.

    "Fresnel" is the shorthand name for the effect where reflectivity goes from base reflectivity (as defined above) up to 100% at the edges.

    In this diagram from my PBR article:
    pbr_theory_fresnel.png

    You can see two materials, one with a low base reflectivity (rubber), and one with a high one (chrome). You can see they both go up to 100% on the edges, due to the fresnel effect. On the left hand side of the graph, you can see the base reflectivities are labeled. Since base reflectivity is directly related to IOR, that's all IOR does in toolbag's shaders - it decides where the left hand side of that curve resides.

    Now, toolbag does indeed have a "Fresnel" slider, but this just adjusts the strength of the fresnel curve. To use an example, when the toolbag fresnel slider is at 1.0, it looks like the graph above, but when it's at 0.0, then those lines become flat/horizontal, at the same height as the leftmost point (leftmost point never moves no matter what the "fresnel" value is set to). This setting isn't physically accurate, and actually I didn't really want to add it at all, but it's just there for greater artistic control. It is usually best left alone in my opinion (default is 1.0).

    In "metalness" mode, the shading is all the same, but the inputs are just specified in a different way (for example there is no Fresnel slider, though there easily could be). Again, I know its sort of confusing but trust me the metalness workflow is not particularly limited in terms of its shading possibilities.
  • jeffdr
    Offline / Send Message
    jeffdr polycounter lvl 11
    artquest wrote: »
    But John Hable's post seems to indicate just the opposite! Or are you saying it's less evident perhaps at certain angles or on certain shapes with higher roughness?

    Hable and I are in agreement I suspect. Basically I was saying that on rough materials, there is no angle you can view a surface where all microfacets are aligned (since its rough), so you can never really see that "100% at the edges" effect. This just is more a question of view-dependence. It does not mean that rough surfaces are less reflective or don't have specularity (clearly they do, in both toolbag and real life).

    Someone mentioned Seb Lagarde's work; he came to the same conclusions as well.
    artquest wrote: »
    I agree, a Fresnel slider would be bad, but it's important to note that different materials in the real world have been measured and found to have different Fresnel curves. There should be a control for that somewhere.

    It's true, the shape of the curve does vary somewhat among materials. In my research I haven't been able to find any really compelling examples however, where it was drastically different, so I didn't make it a priority for toolbag 2. It's a possible avenue for expansion though.
  • oks2024
    @strike

    You should read The physics and maths of shading, the chapter on fresnel is at the page 14.

    The specular color is the specular reflectance of the material, this is how you indicate the material behavior.

    An other helpfull link : Feeding a physically based shading model

    You'll find how to transform IoR into specular reflectance, and also see that indexes of reflection can't really be used for metal, it's either wrong or complex, because they vary over the visible spectrum.

    I think you misunderstand the metalness parameter of UE4.
    First it must be though as a binary value. 0 means the material is a dielectric, 1 means it's a metal.
    The idea of this parameter comes from a simple observation. Dielectric materials have a monochromatic specular value (most of them between 0.03 and 0.05), and metals have a colored specular and a black diffuse.

    In a metalness/metallic workflow you set only one colored map, let's call it baseColor.
    When metallic = 0, baseColor is used as the albedo value, and a fixed value (0.03 for example) is used as specular.
    When metallic = 1, black is used as the albedo value, and the base color is used as specular.

    And for other values it's just a linear blend between those two models, but you don't really want to use them, the materials are either metal or dielectric.

    You may notice that in that case you're stuck with a fixed specular value for dielectric. That's why on the UE4 they added a parameter (called specular I think, I'll need to check that) that control this value.

    This workflow is used for two main reasons. You have less values to store in you GBuffer and it's more intuitive (Disney use that for this reason and I don't think they care about memory consumption).
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    "Index of Refraction (IOR)" is, for our purposes here, just a means of setting the base reflectivity. Any given index of refraction corresponds to one and only one base reflectivity, and vice versa. IOR does not vary depending on viewing angle, it is a constant property of a material, as is base reflectivity.

    Yes! True, In mental ray tweaking the IoR value will change the Fresnel curve.
    jeffdr wrote: »
    Hable and I are in agreement I suspect. Basically I was saying that on rough materials, there is no angle you can view a surface where all microfacets are aligned (since its rough), so you can never really see that "100% at the edges" effect. This just is more a question of view-dependence. It does not mean that rough surfaces are less reflective or don't have specularity (clearly they do, in both toolbag and real life).

    Someone mentioned Seb Lagarde's work; he came to the same conclusions as well.



    It's true, the shape of the curve does vary somewhat among materials. In my research I haven't been able to find any really compelling examples however, where it was drastically different, so I didn't make it a priority for toolbag 2. It's a possible avenue for expansion though.

    As for examples of drastically different curves, you are correct. It's a very subtle difference. But when (trying) to render realism in mental ray, even slight variations in IoR really help dial in the correct look of material types. It becomes something very important to achieving photo realism.

    Here's something I've been working on recently. (I was inspired after seeing the lego movie.) Something kept looking wrong until I looked up the exact IOR value for the particular type of plastic used for clear lego bricks. It was only off by .04 (EDIT: It was actually off by .08.) and it did indeed change the look enough to be notice-able.
    LegoRenderTest.jpg
  • Shrike
    Offline / Send Message
    Shrike interpolator
    Thanks guys for your contribution to this discussion

    I did a image that hopefully better represents my concern as we are talking a little along each other I think

    IOR.png

    Thing is that we push this new tech, and EVERYONE is learning it as the new standard,
    we cannot be this vague with terms. If Im going crazy while digging real deep in PDFs and building PBR shaders myself for weeks (i dont know too much tho) because something is strangely named, It can only be worse for the normal or learning user

    Lego looks sweet, a little more brightness would be nice tho : )
  • oks2024
    There is no magic behind the metallic parameter, as I said, it will just define if you use your colored map as Albedo (dielectric) or Specular (metal).

    And it's not a lucky guess, I have the UE4 source code.

    I don't understand why do you want to link that with IoR. The IoR is in the specular color.
    And the visibility of the cubemap is controlled by the roughness.

    Oh, and Epic is not wrong ^^.
  • EarthQuake
    Yeah metalness is just a toggle for weather the albedo defines the diffuse or specular color. For different types of metals, you use different color/intensity in the albedo map, same as you would IoR. Its just a different way to pack the data, and isn't limiting in the way you think it is.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    perna wrote: »
    artquest: Nice. Could you render it with the wrong value for comparison, to drive home your point?

    Rendertime on the lego model is kinda high as I was using the scene to test out a lot of indirect lighting across different MILA materials so after I got one example done I gave up :P. But here's a sphere in the same scene with the same material that is applied to the grey lego pieces. I tried to keep the examples within range of a lot of common materials.

    iY3EsT61jHGte.gif

    Something to note is that these differences are even more important when dealing with transparent materials. You can see how small changes in the IOR effect transparent materials. Now to be honest, if I didn't have the actual lego set sitting on my desk as I worked I probably would have never gotten so obsessed with matching it perfectly. The correct IOR value is 1.584 for the particular type of clear plastic used by lego.

    ie99UWvUBwEvi.gif

    Although most of the other shaders in the scene are the new MILA (beta) layering library shaders. I used the MIA material X in this test since more people are familiar with it's settings.

    Grey Sphere MIA X Shader settings:

    Diffuse weight 1.0
    Reflection: 1.0
    Glossiness: 0.6
    BRDF: Fresnel checked on.
Sign In or Register to comment.