Announcement

Collapse
No announcement yet.

An assortment of OSL shaders for your perusal

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

  • Hey gang, is there a way in OSL to do something like Maya's surface luminance? That is, can you drive a ramp's direction (the V-cord) based on the light direction? OSL has a thing called diffuse_ramp, but I don't think it is supported in Vray...

    Comment


    • Nope, I'm afraid not. Why do you need it?

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

      Comment


      • Originally posted by vlado View Post
        Nope, I'm afraid not. Why do you need it?

        Best regards,
        Vlado

        It's for an iris texture where a ramp based on the light direction controls the brightness of the iris. This is nice for getting a stylized iris, like you see in most CG animated films. I have it working with a bunch of nodes in Maya's Hypershade, but thought it would be nice if I could get it into an OSL texture (I'm not a fan of big messy Hypershade trees).

        Maybe there's a way to use a diffuse color closure to drive the ramp?

        Comment


        • Is this safe to ignore (maya) - using the archglass shader.

          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_number_of_glass_panes (type: int)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_pane_absorbtion_tint (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_reflective_coating (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_dirt_color (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_dirt_amount (type: float)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_ior_out (type: float)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_ior_glass (type: float)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_refraction_mode (type: int)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_normalmap_pane1 (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_normalmap1 (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_normalmap_pane2 (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_normalmap2 (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_normalmap_pane3 (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_normalmap3 (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_first_normalmap_for_all (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_pane_absorbtion_tint_tex (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_absorbtion_tex (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_reflective_coating_tex (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_coating_tex (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_dirt_color_tex (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_dirt_col_tex (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_dirt_amount_tex (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_use_dirt_amount_tex (type: bool)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_info_page (type: sampler)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_number_of_glass_panes (type: int)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_pane_absorbtion_tint (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_reflective_coating (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_front_dirt_color (type: color)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          [2016/Oct/19|09:32:07] V-Ray error: Can't add attribute: vray_dirt_amount (type: float)
          Error: ./osl_stuff.cpp:407: status: : (kInvalidParameter): Object is incompatible with this method
          Error: status: (kInvalidParameter): Object is incompatible with this method
          Maya 2020/2022
          Win 10x64
          Vray 5

          Comment


          • Originally posted by snivlem View Post
            Is this safe to ignore (maya) - using the archglass shader.
            These errors should not appear. I tested the archglass shader, but it seems to work on our end. Could you provide a little more details how this is happening? What's your V-Ray version?
            V-Ray for Maya dev team lead

            Comment


            • Just about to send you a PM with a link to the scene.
              Maya 2020/2022
              Win 10x64
              Vray 5

              Comment


              • Originally posted by snivlem View Post
                Just about to send you a PM with a link to the scene.
                It seems that you are missing the "rhfunctions.h" file, which comes with the archglass shader. It seems to work fine if I add it beside the OSL file.
                V-Ray for Maya dev team lead

                Comment


                • I forgot to attach it in the upload but it is there on the disk. I didn't make up that renderlog either, it came from that scene.
                  Maya 2020/2022
                  Win 10x64
                  Vray 5

                  Comment


                  • Originally posted by snivlem View Post
                    Is this safe to ignore (maya) - using the archglass shader.
                    I think it is safe to ignore it. But if you can tell us the exact steps needed to get to this error it will be quite helpful.
                    A ready made scene is not useful, because there we'll see only the consequences of the bug, but won't find how it had happened.

                    How are you creating the material and how are you manipulating the parameters/attributes? Do you use some scripts?
                    V-Ray developer

                    Comment


                    • Originally posted by Rens View Post
                      ArchGlass
                      Simulate multi-paned window glass with only a single-sided plane! And also the first OSL material (not texture) of these.
                      An OSL shader for creating realistic glass window panes. Window reflections are amazingly complex; you get for one pane of glass reflections from the front, back, and scattering from inbetween, light gets absorbed and passed through to the other side only to be reflected back by the next pane of glass. This shader allows you to simulate full window glass geometry with only one plane. Useful for everything but close-ups.

                      [ATTACH=CONFIG]30870[/ATTACH]

                      Links
                      Page:
                      http://www.rensheeren.com/blog/osl-archglass/
                      Download links:
                      http://www.rensheeren.com/osl/archGlass_mat_v002.osl
                      http://www.rensheeren.com/osl/rhfunctions.h
                      Right-click and save both in the same folder, both are needed for the shader to work. Overwrite rhfunctions.h if asked.

                      Features
                      - Specify the amount of window panes (1-3).
                      - Absorbtion/tint colour.
                      - Reflective coating layer, for example a one-way mirror or high reflectance building glass.
                      - Dirt layer, like a layer of dust or sand on the outside.
                      - IOR of glass and surrounding medium (air usually).
                      - Normal map inputs for creating warped reflections for each pane separately.
                      - Supports ray traced refraction, transparency, and black opaque for the refraction/transmission.

                      How to use
                      – Create a VRay OSL Material.
                      – Load in the downloaded OSL shader.
                      – Set how many panes are in your window. Most modern windows in temperate and cooler climates have two panes for insulation.
                      – Optionally set a colour for the reflective coating if your window needs one.
                      – Same for the dirt. The colour is usually fine, you define how much dirt there is on top of the windows with the dirt amount input.
                      – Set the refraction mode, 1 – ray traced refraction, 2 – transparency, 3 – no refraction, just black, for mixing with a self-illuminated interior or to just have only the glass reflection.
                      – Normal map inputs need a normal map with RGB 0.5 0.5 1.0 as the ‘base’, meaning that there won’t be any normal difference with that colour.
                      – Apply to a one-sided plane object.

                      [ATTACH=CONFIG]30868[/ATTACH]

                      [ATTACH=CONFIG]30869[/ATTACH]
                      I know this thread is kind of old, but I just bumped into it and got excited about that glass shader.
                      With vray next this doesnt seem to work.
                      Get following message:
                      <buffer>:264: error: function 'microfacet_ggx' was not declared in this scope

                      Any idea if this is fixable?
                      Add Your Light LogoCheck out my tutorials, assets, free samples and weekly newsletter:
                      www.AddYourLight.com
                      Always looking to learn, become better and serve better.

                      Comment


                      • We’ll check it out, thanks for the report!

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

                        Comment


                        • Hi Manuel, V-Ray Next switched to OSL 1.8 which deprecated all specific microfacet_NNN() functions in favor of the more generic microfacet(). I've patched the original code by Rens so that it compiles in Next as well.

                          Best regards,
                          Ivan
                          Attached Files

                          Comment


                          • Great, thank you!
                            I'll try it out.
                            Add Your Light LogoCheck out my tutorials, assets, free samples and weekly newsletter:
                            www.AddYourLight.com
                            Always looking to learn, become better and serve better.

                            Comment


                            • Thank you ikomotov for editing the file.
                              Ok, it loads without the error message now . But in the shader parameters nothing is visible. It renders the material on my workstation, but not on the render node in distributed rendering. Black where a window should be. (I copied the OSL file and the *.h file to the render node Plugins folder). I seems I have to learn first, how to use and configure OSL shaders. I thing, this Arch_glass shader is essential for windows reflections. Until now I distorted the things to be reflected in Photoshop and mapped this to a box. But if the windows reflect other parts of the model it doesn´t work of course.
                              Last edited by 3d-laboratory; 24-08-2019, 02:39 AM.
                              Workstation: Ryzen 9 5950x @ 4,20GHz 64 GB RAM, Nvidia Quadro P5000, Win10 Prof.<br>Rendernode: AMD Threadripper 2990wx 64 GB RAM, Win 10 Prof. MAX 2025.2, VRay 6.2, ForestPack, RailClone, RichDirt, KStudio ProjectManager....

                              Comment


                              • Hey guys,
                                I thought of hjacking this thread. I wanted to dive in a little bit into the whole osl shader thing. At the moment I wanted to create a possible BerconTile alternative as a pure osl shader.

                                I looked into the SimpleTiles osl, which comes with 3dsMax. But I struggle with the uvw mapping per tile. I would to have a proper uvw mapping per tile. Can anyone point me to maybe some tutorials or further stuff to read, which could help me in this regard?

                                Comment

                                Working...
                                X