Announcement

Collapse
No announcement yet.

Complex fresnel using VRayOSLtex

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

  • #31
    You need to change the wavelength to the appropriate value - R=0.650 G=0.510 B=0.475

    Comment


    • #32
      Here's mine for what it's worth.

      This is a somewhat different approach, I think I got the equation from the old Odforce Wiki. If someone wants to do complex number calculations in OSL there are a few functions for that included here.
      Attached Files
      Rens Heeren
      Generalist
      WEBSITE - IMDB - LINKEDIN - OSL SHADERS

      Comment


      • #33
        This works like a charm, thanks guys!

        Vlado, would it be possible to include colour swatches next to the n and k values? It would be awesome if we can put the correct numbers in and then tweak the colours individually. It would give more control over a colour correct and keep the shader a bit simpler.
        David Weaver

        Senior "Belief Crafter"
        Realtime UK

        https://www.artstation.com/artist/weaver

        Comment


        • #34
          Originally posted by vlado View Post
          Here is a shader that allows you to enter n and k values directly (for 0.65, 0.55 and 0.45 micrometers - you can get values directly from http://refractiveindex.info/)

          Use as a reflection color map and make sure the Fresnel option in the VRayMtl material is disabled.

          Best regards,
          Vlado
          Vlado, that's working great! But it seems I have to apply gamma to the osl texture, otherwise the result is very washed out.
          https://www.behance.net/Oliver_Kossatz

          Comment


          • #35
            Originally posted by kosso_olli View Post
            Vlado, that's working great! But it seems I have to apply gamma to the osl texture, otherwise the result is very washed out.
            Really, that's odd. It seems to work fine for me... can you show me? I have a feeling that applying gamma to this shader is wrong.

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

            Comment


            • #36
              Sure! Here you can see your complex fresnel osl with the values for copper. On the left without any modifications, on the right with gamma 2.2. When I redraw the reflectance curves with a falloff map, I get a result close to the gamma 2.2 version. Will check my gamma settings just to be sure, but I never had something like that before.

              Click image for larger version

Name:	osl_complex_fresnel_v01.JPG
Views:	1
Size:	30.9 KB
ID:	855370
              https://www.behance.net/Oliver_Kossatz

              Comment


              • #37
                Ok; not sure about that one though - I just copied the formulas and I'm pretty sure the Fresnel equations do not feature any gamma correction. What are the n and k values that you used? I think the default ones that I put in the shader are for copper.

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

                Comment


                • #38
                  My 3dsmax design 2011 crashes instantly everytime I try to load these OSL files; just to confirm it, can anyone doublecheck with an old max release?
                  Alessandro

                  Comment


                  • #39
                    Vlado,
                    I looked up the settings for copper over at refractiveindex.info and found out that your default values are already set for copper. But it is the same for all my other materials as well. My older ones used the curves, and they are much more saturated then the materials with the osl and no gamma correction.
                    That isn't a big problem for me, I can always put the osl texture into a color correct node.
                    https://www.behance.net/Oliver_Kossatz

                    Comment


                    • #40
                      I'm not sure this is a gamma issue.
                      I made a test with gold, rendering 3 different versions :
                      1- with the complex ior vrayosltex (values from refractiveindex.info)
                      2- with a falloff map with custom RGB curves (values from refractiveindex.info)
                      3- same as 1 (vrayosltex) but with a cc with gamma 0,45

                      As you can see the first two are pretty close, but the vrayosltex does indeed lack a little punch in the colors, whereas the gamma corrected version is very different.
                      Click image for larger version

Name:	gold_vrayosltex.png
Views:	1
Size:	287.0 KB
ID:	855373Click image for larger version

Name:	gold_falloff_map.png
Views:	1
Size:	283.1 KB
ID:	855374Click image for larger version

Name:	gold_vrayosltex_gamma.png
Views:	1
Size:	295.6 KB
ID:	855375

                      mekene

                      Comment


                      • #41
                        Well, it also depends on what wavelength you decide to sample; I used 0.45, 0.55 and 0.65 because this is what seemed to be used in the paper linked to the first post. However, in the thin film shader, I used 0.475, 0.51 and 0.65. A better approach will probably be to integrate the n and k values over the CIE curves for red/green/blue instead of point-sampling specific wavelengths. Or else, do full spectral rendering - but then you need to draw the n/k curves for the full spectrum.

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

                        Comment


                        • #42
                          Originally posted by theedge View Post
                          I'm not sure this is a gamma issue.
                          I made a test with gold, rendering 3 different versions :
                          1- with the complex ior vrayosltex (values from refractiveindex.info)
                          2- with a falloff map with custom RGB curves (values from refractiveindex.info)
                          3- same as 1 (vrayosltex) but with a cc with gamma 0,45

                          As you can see the first two are pretty close, but the vrayosltex does indeed lack a little punch in the colors, whereas the gamma corrected version is very different.
                          [ATTACH=CONFIG]22982[/ATTACH][ATTACH=CONFIG]22983[/ATTACH][ATTACH=CONFIG]22984[/ATTACH]
                          Could you please share that simple scene? I would like to make sure that there is no error on my setup.
                          https://www.behance.net/Oliver_Kossatz

                          Comment


                          • #43
                            Despite not understanding most of what's going on here, this thread is great.

                            Any chance in the far future having a shader that can just suck up the info from matlab and create the correct settings?

                            Comment


                            • #44
                              Originally posted by kosso_olli View Post
                              Could you please share that simple scene? I would like to make sure that there is no error on my setup.
                              Yes, here it is (max 2015).
                              gold_test.zip
                              I used values of .65 .55 and .45 for wavelenghts
                              As for the curves, well, they are approximated by eye so maybe not very accurate.

                              Please let me know if this is the way you have set up things. I'm also curious to know if this is the right workflow.

                              mekene

                              Comment


                              • #45
                                Thank you. I can confirm that the whole difference was a very dumb mistake in my scenes. Sorry for the inconvenience, everything seems to be correct now...
                                https://www.behance.net/Oliver_Kossatz

                                Comment

                                Working...
                                X