Announcement

Collapse
No announcement yet.

IOR on fresnel

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

  • #16
    Reviving this thread...

    What Zap is saying here is that metals have an IOR of 25 to 50. That's new to me! I thought they would be IOR 2.0 and that 10 would be as high as you go (a mirror). I'd be interesting in a discussion of this, and an idea of what IOR values various metals have (brass, steel, gold, tin, etc).

    Also I's still be interested to know what IOR values cloth would have, or if it would be more accurate to use a ramp and samplerInfo, then what the shape of the falloff would be.

    Comment


    • #17
      Nope, I don't buy that stuff at all.

      See that dip down that you get at the right of his curve before it shoots back up? That's totally wrong. if you have a look at http://refractiveindex.info/?shelf=m...=Au&page=Rakic all of the data is taken from scans of materials and they give you reflectivity graphs from 0 to 90 degrees. If you look at the graph at the bottom of the page, it gives you one of the curves for gold, and you want to be looking at the green curve in the middle of the graph which shows the reflectivity for visible light (the other two are different types of polarized light). As you can see you get a curve that's fairly flat for 0 to 50 degrees that then starts curving up to 100% reflectivity at 90 degrees. What you're not getting is a really flat curve all the way along, then a huge dip down around 80 degrees before shooting back up to 100% at 90 degrees. I think the curve that he was using before with the 0 degree reflectivity, 90 degree reflectivity and curve shape was way more like an actual gold material.

      A big difference with metals compared to normal reflective surfaces, is that metals reflect the various colours of light differently. What causes gold to be more yellow / orange for example is that it reflects red light more strongly than it reflects green or blue light and so what you need to do is either make a separate reflection curve for each of the red, green and blue and mix them together before feeding them into the reflection strength in your shader, or use a ramp driven by the facing ratio with colour values along the gradient using the appropriate amount of red green and blue for each of the degrees.

      If you want to use the curves, choose a metal at the top of the refractiveindex.info site and then you'll have to change the wavelength value just underneath the various metal drop down menus. Use 475 nm for your blue curve, 510 nm for green and 650 for red. (Taken from http://science-edu.larc.nasa.gov/EDD...or_Colors.html). Go to the very bottom of the page each time and have a look at the reflectivity curve there. The red and blue curves are for two directions of polarized light (which we don't see) so you use the green one which is the average of the two and the equivalent of the visible light that we do see. What you'll find is that the overall shape of the curve is the same for red, green and blue, it's just that each of them three colour starts from a higher or lower amount. With the gold curve for example, I see it as being nearly flat from 0 to 40 degrees and then starting to curve upwards to 100% at 90 degrees, so you might be able to just use a single colour swatch at the start of your ramp with (0.94, 0.55, 0.4) a second swatch at around position 0.45 (40 degrees divided by 90 degrees to turn it into a percentage so we know where to place the swatch on the ramp) on the ramp with the appropriate amount of red, green and blue for 40 degrees, a totally white swatch at position 1.0 on the ramp and then maybe a fourth swatch at around position 0.77 on the ramp with the right amount of rgb so we get the curve slightly more accurate again.

      The last thing is that metal has no diffuse as such - it's all the one reflective material and the only thing that makes it look more diffuse or not, is how polished or rough the surface is. Some people like to use a bit of diffuse colour to make a duller looking metal which is fine, the only thing to note is that you might sometimes get an odd tint (or at least you do in max) as if you've got a red reflection for example, it should reflect all the red parts of light back and only allow the green and blue parts of your light through to shine on your diffuse, thus giving your material a bit of a cyan tint. If you get this, the best thing to do is make one totally diffuse material with your reflection curve in the diffuse slot of your metal, make another material with no diffuse and your reflection curve in the reflection slot of your material and then use a vray material to blend them together making sure you only use grey values in the blend amount colour swatch - this will stop any tinting from happening. The vray material in 3dsmax has options about how reflections and diffuse are blended where you can use rgb (so a red reflection kills all reflections hitting the diffuse) or monochrome (where a red reflection allows red light through, it just dulls down the amount of light that gets through into the diffuse.)

      With the refractiveindex.info stuff bear in mind that each of the actual scan data that they have comes from ONE single specific sample of that metal so if you've got a gold curve, it means you can replicate that specific type of gold only. There are a tonne of different types of golds in terms of hues and purity which will likely have an influence on it's colour and likewise a reference image that you might find of a gold you need to replicate might have that gold in an environment that has warmer or cold lighting or has an environment that's tinting the reflections to be a slightly different colour. The point is to use the curves as a rough guide or starting point and make some adjustments from there.

      Comment


      • #18
        An IOR of 25 or 50 is wrong. It might come somewhat close but it's using the formula incorrectly. This is because most renderers use a simplified Fresnel function that's not meant to be used for metals.

        The full Fresnel equation(s) use two variables; n and k. The simple one uses only one; n. This is the 'IOR' value. For non-metals the k value is practically zero, so you can discard it and have a much simpler and faster equation. For metals the k value isn't zero and if you want to be accurate then you would need the full equation.

        Have a look at refractiveindex.info for values and curves, it's a very good site.

        I'll see if I have some time to put together a full Fresnel shader for metals with OSL, I made it in maxscript and c++ so it shouldn't be too hard.

        edit: ah joconnell beat me to it with the site. ; )
        Last edited by Rens; 27-03-2014, 04:30 AM.
        Rens Heeren
        Generalist
        WEBSITE - IMDB - LINKEDIN - OSL SHADERS

        Comment


        • #19
          Ah!

          The very person that clarified all of the metal stuff to me!

          You in maya land in the new place Rens?

          Comment


          • #20
            No back to max again for now, it's fine after a while. ; ) Enjoying working with maya?

            -

            On the topic of the Fresnel equations, when you're using Schlick for metals as mentioned earlier in this thread, basically what you're doing is using an approximation of a simplified formula made only for non-metals, and use that for metals. Not the most ideal...
            Last edited by Rens; 27-03-2014, 05:18 AM.
            Rens Heeren
            Generalist
            WEBSITE - IMDB - LINKEDIN - OSL SHADERS

            Comment


            • #21
              No fun with maya just yet - lots of silliness with the basics right now and frustrations about all the simple, quick things you can do in max. I'll just have to get used to it but it's weird switching after 16 years

              Edit - fuck, it's actually 18 years :/

              Comment


              • #22
                John, for the colour primaries it would be better to see which colour corresponds to which wavelength in sRGB space. One way would be to use the CIE diagram and see what the dominant wavelength is at the three sRGB points.

                I got RGB 611 549 464 nm using this calculator:
                http://www.brucelindbloom.com/index....alculator.html

                Assuming D65 for sRGB.
                Rens Heeren
                Generalist
                WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                Comment


                • #23
                  Taking me to school as always - do you have any sneaky tricks for calibrating materials that you use often?

                  Comment


                  • #24
                    joconnell,

                    Wow, that was extremely helpful and fascinating, thanks! The chart at http://refractiveindex.info is very useful and I'm sure I will use it often.

                    What I do not see there are the IOR values for things like wood or cardboard or a t-shirt or fingernails or house paint. These all have fresnel-type reflections. One might argue that fabric does not really have IOR because it's the microfibers, but since the model of the vrayMaterial works with IOR, we practically need to know the "IOR value" for these things. Any thoughts on that?

                    Comment


                    • #25
                      Sure - refractive index is a bit limited but it's very handy for complex reflections like metals which can't just use a single number. For the likes of cloth as you say it's not really reflective, it's more a combination of the surface being slightly porous to light since it's a weave and not a continuous surface - light is breaking through the fabric which almost gives it an sss type look at the edges, then you've got the specular that will be broader or softer based on how loose or tight the weave is. What I'd be more inclined to do is try and replicate the falloff of the fabric using a ramp instead - I've got a habit of using the ramp to mix between two diffuse textures - one slightly brighter for the edge angles which kind of simulates the light being able to scatter through the fabric at glancing angles, then a very broad specular for the highlights. A table doesn't really exist for this stuff as I'd imagine they're very hard to scan. Likewise you'd have data for one particular bit of fabric you'd scanned and that wouldn't necessarily look like the fabric you want. What I reckon you'd be better off doing is what blizzard does with their fabrics - they get a sample of the material and just wrap it around a ball and then place that ball in whatever environment they're trying to replicate and take lots of reference photos. You'd bring in a grey ball and chrome ball as lighting reference, take photos of that and record the positions of the light in the room. Using that info you'd make a grey ball inside of maya and try to place lights to get the same position, intensity and softness of light. When you've got a grey ball that matches the one in your reference photos, then you can start trying to work on your fabric shader knowing that your lighting is in roughly the right place - since light and materials both have a huge knock on effect on each other you're better off taking one out of the equation and leaving it alone from then onwards. You can now happily tweak your various ramps on the material to try and get something resembling the fabric sample you shot in your reference photos.

                      Comment


                      • #26
                        Thanks that's helpful

                        Comment

                        Working...
                        X