Announcement

Collapse
No announcement yet.

osl node

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

  • osl node

    Hello,

    Can you add osl for vray for modo ?

    http://docs.chaosgroup.com/display/V...pport+in+V-Ray


  • #2
    We can, but it will probably be at least a few service packs after the initial release.
    There is more basic stuff to implement before that. And OSL shaders are not something most people would use, I think.

    Greetings,
    Vladimir Nedev
    Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

    Comment


    • #3
      Thank you vladimir, this is good news if it is integrated in the near future .

      Comment


      • #4
        Hello

        The osl is it on the roadmap today ? for me that's really an important feature.

        Comment


        • #5
          An great site for osl files (procedural textures) :
          http://www.swineworld.org/search/label/osl

          Comment


          • #6
            The V-Ray OSL texture/material is in the back-log, but I can't promise when we will get to it.

            Greetings,
            Vladimir Nedev
            Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

            Comment


            • #7
              The V-Ray OSL Texture and Material were added in the nightly build from 2017.05.20 .

              A clip demoing OSL in V-Ray for MODO.

              For an explanation of what OSL is, you can check its GIT page.
              The pdf file with the specification is most useful if you want to program your own shaders.
              Note that V-Ray supports an earlier version of the specification.

              This page contains information about the OSL implementation in V-Ray and its limitations, for the most part it applies to V-Ray for MODO as well.

              This page contains some example shaders made for V-Ray.

              This page contains shaders developed by the user sharktacos from the V-Ray for Maya forum.

              This page contains shaders developed by the user Rens from the V-Ray for 3ds Max forum. Link to the forum thread where he posts his new stuff.

              This GIT page contains OSL shaders developed for Blender. With some modification they can be used with V-Ray.
              Mostly you need to replace the input Vector with the u,v global variables.


              V-Ray for MODO supports the following metadata on shader parameters:
              string label - shows as the label for the parameter in the MODO UI;
              string widget
              boolean / checkBox - for int parameters, this turns them into a checkbox;
              mapper - for int parameters, this turns them into a drop-down with a fixed selection of choices, the choices are specified using string options;
              popup - for string parameters, this turns them into a drop-down with a fixed selection of choices, the choices are specified using string options;;
              IMPORTANT -
              don't use popup or your shader won't be compatible with the current OSL in V-Ray for 3ds Max, the parameter will be recognized as a texture slot, hopefully we will fix this in V-Ray for 3ds Max in the future;
              int/float min/max - set the min/max value for int/float parameters;

              The following are non standard metadata, they are not part of the OSL specification:
              string divider - creates a roll-out before the UI for the parameter, use empty string to create a simple divider;
              color defaultColor - for string parameters which don't have widget=string or widget=popup, i.e. they are recognized by V-Ray as a texture connection, this sets the default color of the parameter;
              Note that Max/Maya don't support this metadata, In Max the UI for the parameter is a texture slot, in Maya it is a color picker and a slot, with a default black color.
              Still you can use it to create a more user-friendly UI in MODO.

              Here is an example OSL texture that shows most of these options in use.

              Code:
              color sampleTexWithDefault(string texName, color defColor) {
                  int channels = -1;
                  if (gettextureinfo(texName, "channels", channels)) {
                      return texture(texName, u, v);
                  }
                  return defColor; // no texture connected, use default value
              }
              
              #define DEFAULT_TEX1 color(1, 0.5, 0.0)
              #define DEFAULT_TEX2 color(0, 0.5, 1.0)
              
              void swapYZ(output vector p) {
                  float tmp = p[1];
                  p[1] = p[2];
                  p[2] = tmp;
              }
              
              shader quickTest(
                  string color1Tex = "" [[color defaultColor = DEFAULT_TEX1]],
                  string color2Tex = "" [[color defaultColor = DEFAULT_TEX2]],
                  int patternType = 2 [[string widget = "mapper", string options = "checker:0|grid:1|checker+grid:2|noise:3", int min=0, int max=3]],
                  string noiseType = "perlin" [[string widget = "popup", string options = "perlin|uperlin|cell|simplex|usimplex|gabor"]],
              
                  float gridThickness = 0.1 [[float min = 0.0, float max = 1.0, string divider = "Grid params"]],
              
                  int gaborMode = 0 [[string widget = "mapper", string options = "Isotropic:0|Anisotropic:1|Hybrid:2", string label = "Mode", string divider="Gabor noise params"]],
                  vector gaborDirection = vector(0.1, 0.2, 0.3) [[string label = "Direction"]],
                  float gaborBandwidth = 1.0 [[string label = "Bandwidth"]],
                  float gaborImpulses = 16.0 [[string label = "Impulses"]],
                  int gaborFilter = 1 [[string widget = "checkBox", string label = "Filter"]],
              
                  output color res = 0
              ) {
                  float um = mod(u, 1.0);
                  float vm = mod(v, 1.0);
              
                  color color1 = sampleTexWithDefault(color1Tex, DEFAULT_TEX1);
                  color color2 = sampleTexWithDefault(color2Tex, DEFAULT_TEX2);
              
                  if (patternType == 0) {
                      if ((um > 0.5) ^ (vm > 0.5))
                          res = color2;
                      else
                          res = color1;
                  }
                  else if (patternType == 1) {
                      if (um > gridThickness && vm > gridThickness)
                          res = color2;
                      else
                          res = color1;
                  }
                  else if (patternType == 2) {
                      if ((um > 0.5) ^ (vm > 0.5) && um > gridThickness && vm > gridThickness)
                          res = color2;
                      else
                          res = color1;
                  }
                  else if (patternType == 3) {
                      float nv = noise(noiseType, u, v,
                          "anisotropic", gaborMode,
                          "direction", gaborDirection,
                          "bandwidth", gaborBandwidth,
                          "impulses", gaborImpulses,
                          "do filter", gaborFilter);
                      res = mix(color1, color2, nv);
                  }
              }
              Greetings,
              Vladimir Nedev
              Last edited by vladimir.nedev; 20-05-2017, 07:11 PM.
              Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

              Comment


              • #8
                Thanks Vladimir
                Win10 Pro 64 / AMD Ryzen 9 5950X / 128GB / RTX 3090 + 1080 Ti / MODO
                I am the resurrection, and the life: he that believeth in me, though he were dead, yet shall he live - Jesus Christ

                Comment


                • #9
                  I've made some improvements to the OSL Texture/Material with the intention to make it easier to develop OSL shaders in V-Ray for MODO.

                  - Compilation errors are now printed in the Event Log and an error dialog pops up when there are errors
                  - Added a button to enable auto-update in RT when the shader source file changes

                  These will be in the nightly build from 2017.05.23 .

                  You can see a demo of the second feature here.

                  Greetings,
                  Vladimir Nedev
                  Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                  Comment

                  Working...
                  X