Announcement

Collapse
No announcement yet.

An assortment of OSL shaders for your perusal

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

  • Sorry for the lack of updates, busy busy.

    Originally posted by snivlem View Post
    Can this shader be used on a pane of glass that actually has a thickness? Would I be correct in assuming this would be achieved by setting both "VRay IOR Out and VRay IOR Glass" to 1.550.

    Currently VRay IOR Out set to 1 which I think is why it is supposed to be used on a plane without a thickness?
    No, I've measured the values from 1, 2 and 3 panes of glass and fitted reflection and refraction curves to match them. When using more than one face/side of geo the calculations won't work anymore and you'd get unexpected results. : )
    The reason for this is that it's pretty hard to get values right if you're using only a plane as your geo for speed. Raytracing two or three actual panes of glass would be much slower.

    IOR out would be the IOR of air usually (outside of the glass). You could for example simulate window glass under water (IOR 1.333) as well if you'd ever want to... probably not though hehe. Setting both to 1.55 would effectively cancel out any reflection.

    Hope this helps!
    Rens Heeren
    Generalist
    WEBSITE - IMDB - LINKEDIN - OSL SHADERS

    Comment


    • Thanks for the shaders, Rens. I wanted to try the Arch Glass OSL shader but I get errors when I load it. Please see below. I'm using Max 2016 SP3 with Vray 3.40.02

      Code:
      [B][COLOR="#FF0000"]error: Input file "D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl" not found
      Could not compile shader D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl (OSL to OSO)[/COLOR][/B]
      Aleksandar Mitov
      www.renarvisuals.com
      office@renarvisuals.com

      3ds Max 2023.2.2 + Vray 7
      AMD Ryzen 9 9950X 16-core
      64GB DDR5
      GeForce RTX 3090 24GB + GPU Driver 565.90

      Comment


      • Is the "rhfunctions.h" from rens page in the same folder? They wont work otherwise.
        Last edited by Ihno; 12-08-2016, 07:35 AM.
        German guy, sorry for my English.

        Comment


        • Yes, it is. :/
          Aleksandar Mitov
          www.renarvisuals.com
          office@renarvisuals.com

          3ds Max 2023.2.2 + Vray 7
          AMD Ryzen 9 9950X 16-core
          64GB DDR5
          GeForce RTX 3090 24GB + GPU Driver 565.90

          Comment


          • Originally posted by Alex_M View Post
            Thanks for the shaders, Rens. I wanted to try the Arch Glass OSL shader but I get errors when I load it. Please see below. I'm using Max 2016 SP3 with Vray 3.40.02

            Code:
            [B][COLOR="#FF0000"]error: Input file "D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl" not found
            Could not compile shader D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl (OSL to OSO)[/COLOR][/B]
            Can you try putting the shader in a folder that doesn't contain spaces? I can't think of anything else that might be throwing it off right now.

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

            Comment


            • That worked! Why would that be a problem though? I tried another OSL shader from Rens called Mix Normal Maps and it works fine in a folder with spaces.
              Aleksandar Mitov
              www.renarvisuals.com
              office@renarvisuals.com

              3ds Max 2023.2.2 + Vray 7
              AMD Ryzen 9 9950X 16-core
              64GB DDR5
              GeForce RTX 3090 24GB + GPU Driver 565.90

              Comment


              • Originally posted by Alex_M View Post
                That worked! Why would that be a problem though? I tried another OSL shader from Rens called Mix Normal Maps and it works fine in a folder with spaces.
                It might not be the spaces as such, but some other character like the dash character '-' which is maybe is a Unicode character and not plain ASCII... or something like that.

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

                Comment


                • Yeah someone else had the same problem, also a folder with spaces and characters like dashes. : )
                  Rens Heeren
                  Generalist
                  WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                  Comment


                  • THanks for the shader and explanation rens. This is incredibly useful on projects where the architects give us sketchup models that have glass that is not thick! Massive timesaver!
                    Maya 2020/2022
                    Win 10x64
                    Vray 5

                    Comment


                    • I'm also having issues with the Arch glass osl

                      Using 3.40.02 & Max 2015 sp3

                      If I try rendering with RT I get an error - "Error during V-Ray RT initialization in stage 2!"
                      and if I render with production I get a finished render except max hangs after the render is completed
                      No error readout in the VrayOSLMtl node...

                      I have double checked that i have rhfunctions.h in the same folder and the path contains no spaces...
                      James Burrell www.objektiv-j.com
                      Visit my Patreon patreon.com/JamesBurrell

                      Comment


                      • Hey Rens,
                        I have a request for ya. You have several Fresnel implementations, each based I believe on viewing angle. It would be great if you could write an OSL Fresnel calculated per microfacet, rather than viewing angle, as described here (page 10-12). As you can see in the images, this is important for avoiding over-bright highlights as well as dark areas at glancing angles.

                        Comment


                        • Originally posted by sharktacos View Post
                          I have a request for ya. You have several Fresnel implementations, each based I believe on viewing angle. It would be great if you could write an OSL Fresnel calculated per microfacet, rather than viewing angle, as described here
                          This is not possible in OSL; it must be supported in the BRDFs provided by the renderer. This will be implemented in the next SP of V-Ray, but in the meantime you can use the alSurface material here:
                          https://github.com/ChaosGroup/vray_al_surface/releases

                          There is also a conceptual problem with OSL regarding this. Glossy Fresnel not only determines how a BRDF reacts to light, but its "transparency" as well (how it is combined with other BRDFs below it). OSL has no way for closures to return this transparency so it must be computed in another way, potentially duplicating the work done by the BRDF.

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

                          Comment


                          • Originally posted by vlado View Post
                            This is not possible in OSL; it must be supported in the BRDFs provided by the renderer. This will be implemented in the next SP of V-Ray
                            Vlado
                            Thanks for the explanation. Some followup questions:

                            1) The only OSL brdf that has Fresnel currently is the microfacet_ggx (the eta parameter). Is it correct that this currently is not using per microfacet Fresnel, but will in the next SP?

                            2) Will a Fresnel term that uses per microfacet be added to the other brdf closures (for example to the vray_blinn) closure too?

                            3) In an energy conserving shader the diffuse transmission would be attenuated by the fresnel transmission of the specular/reflection. So in psuedo code:
                            Code:
                            diffuseColor *= (1.0 - specColor)
                            This works if the specColor is multiplied with the Fresnel, but if the Fresnel is built into the brdf, how would one keep the shader energy conserving when combining closures?

                            Comment


                            • Originally posted by sharktacos View Post
                              1) The only OSL brdf that has Fresnel currently is the microfacet_ggx (the eta parameter). Is it correct that this currently is not using per microfacet Fresnel, but will in the next SP?
                              This is correct, yes.

                              2) Will a Fresnel term that uses per microfacet be added to the other brdf closures (for example to the vray_blinn) closure too?
                              Yes.

                              3) In an energy conserving shader the diffuse transmission would be attenuated by the fresnel transmission of the specular/reflection. So in psuedo code:
                              Code:
                              diffuseColor *= (1.0 - specColor)
                              This works if the specColor is multiplied with the Fresnel, but if the Fresnel is built into the brdf, how would one keep the shader energy conserving when combining closures?
                              I have no idea. Like I said above, this is an oversight in OSL. You can ask on the OSL Google group and see if there is a recommended approach.

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

                              Comment


                              • Originally posted by vlado View Post
                                OSL has no way for closures to return this transparency so it must be computed in another way, potentially duplicating the work done by the BRDF.
                                You could do the energy preservation but you'll have to duplicate the Fresnel work done inside the closure as Vlado warned earlier.
                                You do the Fresnel term math (hopefully matching that of the microfacet_ggx) and figure out the reflection weight.
                                Then apply it only to the diffuse/refractive closure below:

                                Code:
                                diffuseColor *= (1.0 - specularColor * fresnelReflectionWeight);
                                Best regards,
                                Ivan M.

                                Comment

                                Working...
                                X