Announcement

Collapse
No announcement yet.

OSL goodness in Vray

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

  • #61
    Hi guys,

    Was there any solution to the VRayOSLMtl issues where when you try to render with a *.osl file directly using VRay Standalone, you get the error "OSL include path not set"? I assume it is a path required for oslc.exe?

    I'm trying to setup an environment where I can easily code up some complex OSL shaders with V-Ray and was thinking VRay Standalone would be a great solution to this.

    Best regards,
    Ben Houston

    Comment


    • #62
      yes, it works perfectly fine, my issue was some nodes had weird privelleges bug where enviroment varibale would disappear after install. So after setting it manually everything reads nicely!

      Comment


      • #63
        Just having some time on RnD, before next episode starts. The idea is to have rain shader on top of the materials, to represent wetting with falling rain. Smth, like in UE4 and unity engines.

        Any ideas ?


        Very good looking stuff here done in blender


        https://vk.com/video164595741_171582289



        and the papers behind this


        https://seblagarde.wordpress.com/201...-wet-surfaces/
        I just can't seem to trust myself
        So what chance does that leave, for anyone else?
        ---------------------------------------------------------
        CG Artist

        Comment


        • #64
          Do you have the GLSL source that was used in the Blender example?

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

          Comment


          • #65
            I wish I had

            Only this
            http://developer.download.nvidia.com...ples.html#rain

            http://developer.download.nvidia.com...WhitePaper.pdf
            with old .fx shaders inside.
            I just can't seem to trust myself
            So what chance does that leave, for anyone else?
            ---------------------------------------------------------
            CG Artist

            Comment


            • #66
              Does GLSL work with animated parameters in Vray? My understanding is that OSL does not currently.

              Comment


              • #67
                In Max or in Maya?

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

                Comment


                • #68
                  Originally posted by vlado View Post
                  In Max or in Maya?

                  Best regards,
                  Vlado
                  referring
                  I was to OSL in Maya.

                  Comment


                  • #69
                    Maya has an XML Attribute Editor template that defines how materials display. I was wondering if it would be theoretically possible to modify this to change how custom OSL materials display in the attribute editor? For example, currently the plastic example OSL currently lumps all the parameters together into one "shader parameters" section. Could an XML Attribute Editor template be used to divide this up into, say, diffuse and specular sections, the way other shaders appear in the attribute editor?

                    Comment


                    • #70
                      The XML files are static and there is no way to do what you're after at the moment.
                      It seems to be a limitation in Maya.
                      V-Ray developer

                      Comment


                      • #71
                        The closure for subsurface is

                        closure color vray_subsurface (float refractiveIndex, float phaseFunction, color meanFreePath, color albedo);

                        previously there was no parameter for the sss subdivs. Has this been added in Vray 3.3? If so what is the new closure syntax? I was not able to find it listed in the docs.

                        Also, is it assumed that the scattering uses raytracing (rather than a prepass-based illumination map)?


                        Last edited by sharktacos; 11-05-2016, 09:33 AM.

                        Comment


                        • #72
                          There is no parameter for the subdivs right now. I'll make a note to add it.

                          Yes, it uses raytracing only.

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

                          Comment


                          • #73
                            Thanks. I'll add the following to my materials so it will be forward compatible:

                            Code:
                            vray_subsurface (ior, phase_function, subsurfaceColor * radius, subsurfaceColor, [COLOR=#ff0000]"subdivs", subdivs[/COLOR]);

                            Comment


                            • #74
                              Here's a fun OSL texture that give you hair color defined by Melanin and Dye color parameters, based on the paper "An Energy-Conserving Hair Reflectance Model"

                              Usage: The resulting texture hair color goes in "transmission color" and "diffuse color" of a VrayHairMtl3, with the "diffuse value" ideally less than 0.5. The secondary specular is the hair color multiplied with itself (which is what the "lock secondary" checkbox in the VrayHairMtl does).


                              Some additional notes: I used a color for the melanin amount since there are no sliders for floats in Vray's OSL in Maya, and colors have sliders. I just grabbed the red channel. Kinda sloppy, so perhaps someone has some ideas about a better way to do that. I'm thinking maybe a luminance().

                              Also I wanted the ability to put a texture map into the dye color. When you do that the color defaults to black, but the dye color should be white by default (if there is no dye). I used the gettextureinfo function to get it to actually default to white in the texture, but it still appears black in the attribute editor. So again, if folks have any ideas about how to address this, I'm all ears!




                              Code:
                              /*
                               *
                               * Hair color defined by Melanin and Dye color parameters
                               * based on the paper "An Energy-Conserving Hair Reflectance Model"
                               * http://www.eugenedeon.com/wp-content/uploads/2014/04/egsrhair.pdf
                               * written for OSL by Derek Flood 
                               * from http://docs.sharktacos.com/misc.php?action=help&hid=66
                               *
                               */
                               
                               color getTextureDif(string texture_name, color no_texture_default_color)
                              {
                                  int channels = -1;
                                  if (gettextureinfo(texture_name, "channels", channels))
                                  {
                                      return texture(texture_name, u, v);
                                  }
                               
                                  return no_texture_default_color;
                              }
                              
                              shader hairColorTex
                              [[ string description = "Hair color defined by Melanin and Dye color parameters " ]]
                              ( 
                                  string Dye_color = "color.png"
                                      [[ string description = "White for non-dyed hair. If using a map, 
                                      put it here and set Melanin Amount to zero" ]],
                                  color Melanin_amount = 0.3 
                                      [[ string description = "Melanin concentration in hair fiber (from 0 to 1).
                                      0.0 is white hair, 0.2 is blond, 0.3 is auburn, ... until you get to 1.0 for black hair. 
                                      Since there are no sliders, we use a color and grab the red channel" ]], 
                                  float Texture_Gamma = 1,
                                  
                                  output color result = 0  
                              )  
                              
                              {  
                              
                                  /* Read texture map or default to white color */
                                  color DyeColor = getTextureDif(Dye_color, color(1,1,1));
                                  
                                  /* Compute a perceptualy linear absorption weight from Melanin_amount */
                                  
                                  float Weight = max( pow(Melanin_amount[2], 2.0) * 33.0, 0.02);
                                  
                                  /* The fiber color is actually an absorption term. As light travels through fibers, 
                                  melanin particles filter out some wavelength. We compute it using Beer's Law. */
                                  
                                  color hairColor = exp(Weight * -color(0.187, 0.4, 1.05));
                                  
                                  /* Now we model the dying process as a thin transparent film over the fiber that will filter transmitted light.
                                  This is simply a multiplication. */
                                  
                                  hairColor *= DyeColor;
                                  
                                  /* Finally we derive the values for the transmission and secondary specular, 
                                  which is the value of the hairColor squared. */
                                  
                                  result=pow(hairColor, Texture_Gamma); //optionally gamma correct color
                                  
                              }
                              Last edited by sharktacos; 26-05-2016, 11:43 PM.

                              Comment


                              • #75
                                Thank you, I was after this Hair OSL on the forums a few weeks ago. I was also on the RenderMan forums where I found this code. Are you able to supply it as an OSL file? I tried copy paste it into a text editor and it didn't work.

                                I'm extremely interested in using the wet surface shader in my current project. Ill have to subscribe to this thread somehow.
                                http://stevejjd.blogspot.com.au/

                                If you look at my blog post you will see I have to render rain, steam, smoke. Maybe those pictures on my blog may inspire you to write some OSL shaders?
                                Last edited by stevejjd; 30-05-2016, 02:55 AM.

                                Comment

                                Working...
                                X