Announcement

Collapse
No announcement yet.

An assortment of OSL shaders for your perusal

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

  • #61
    Rens, A while back I recall you saying you were going to make a remapValue OSL. Maybe you could post it here...

    For what it's worth I did find this blendColors. Note sure it is the same tho:
    Code:
    shader blendColors (vector color1 = vector(1,0,0), vector color2 = vector(0,0,1), float blender = 0.0, output vector outOutput = vector(0,0,0))
    {
        outOutput = color1 * blender + color2 * (1.0 - blender);
    }

    Comment


    • #62
      Originally posted by sharktacos View Post
      Rens, A while back I recall you saying you were going to make a remapValue OSL. Maybe you could post it here...
      [/CODE]
      Is that the same as I posted here http://forums.chaosgroup.com/showthr...ode-in-3ds-max

      I'm looking to use the same technique as in Maya/VRay where you use a RemapRgbToHsv node that plugs into a V Ramp. Can an OSL do the same workflow?

      Comment


      • #63
        Wow I just discovered this thread, fantastic stuff!

        EDIT : Just tested that osl reflection stuff, it's amazing!! I'm testing it for skin.. and reflection look WAYYYYY better now, thank's a lot for that
        Last edited by Bigguns; 11-06-2016, 01:34 PM.

        Comment


        • #64
          Glad to hear it's working well! : )

          I had a chance to test the OSL maps in Maya, and other than a doubling of the inputs (one color, one texture) it appears to be working fine! Did anyone experience any problems in Maya?

          One thing that seemed to be missing was the string widget, as in an actual text field, this was a colour input in the UI.


          Originally posted by sharktacos View Post
          Rens, A while back I recall you saying you were going to make a remapValue OSL. Maybe you could post it here...
          Yes, I have a working color correction shader with some remapping (scaling) options, like Nuke's grade node, as well as HSV options. However I was a bit too quick with my reply, remapValue allows you to adjust the input colour using a curve or gradient, yes? I'll write one where you can input one gradient ramp to drive another, because OSL does not allow for UI curves or keys.

          Originally posted by sharktacos View Post
          The place where I get stuck is the subsurface. They use the Hanrahan-Krueger BSDF to do a cheap/fast sss, and as you say, you can't write BxDFs/closures in OSL. So I'm at a loss what to do for that part -- other than to exclude it. Any thoughts?
          Other than to match it with existing BxDFs, not much. : )

          Originally posted by stevejjd View Post
          I'm looking to use the same technique as in Maya/VRay where you use a RemapRgbToHsv node that plugs into a V Ramp. Can an OSL do the same workflow?
          It should, if you're looking to remap one ramp or colour range using another ramp? As I mentioned there are no UI curves or gradients in OSL, but you can drive one gradient with another one.
          Rens Heeren
          Generalist
          WEBSITE - IMDB - LINKEDIN - OSL SHADERS

          Comment


          • #65
            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.

            Click image for larger version

Name:	archglass_rndr.jpg
Views:	1
Size:	47.5 KB
ID:	862409

            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.

            Click image for larger version

Name:	archglass_ui.JPG
Views:	1
Size:	45.7 KB
ID:	862407

            Click image for larger version

Name:	archglass_node.JPG
Views:	1
Size:	82.0 KB
ID:	862408
            Rens Heeren
            Generalist
            WEBSITE - IMDB - LINKEDIN - OSL SHADERS

            Comment


            • #66
              NOTE: This is from the first post, which I'll now edit to make it into an index to make things a bit clearer. : )

              The Reflector!

              Click image for larger version

Name:	reflector_screen.JPG
Views:	1
Size:	38.5 KB
ID:	884638

              Links
              Page:
              http://www.rensheeren.com/blog/osl-reflector/
              Download:
              http://www.rensheeren.com/osl/reflector_tex_v002.osl
              http://www.rensheeren.com/osl/rhfunctions.h
              Save both in the same folder, both are needed for the shader to work. Overwrite rhfunctions.h if asked.

              Features
              - Metals and non-metals. Uses complex Fresnel for metals and switches to non-complex for non-metals for quicker rendering.
              - Polarisation for both, should you want to play around with that.
              - Outside medium IOR, for example for objects under water.
              - Aaaand... rough Fresnel!

              Rough Frensel I hear you ask? Say you have a smooth plastic ball, the reflection amount follows a Fresnel curve, where the reflection amount is lowest where it faces you or the camera, and strongest on the grazing or side angles.
              Now if you roughen it up using sandpaper that angle dependant reflection strength difference is not visible anymore, when viewed as a whole. The sides would reflect roughly the same amount as the front. However in most renderers this front/side reflection curve gets applied the same independent of how rough the surface is. This leads to objects have overly bright or dark reflections on the side angles. It may look like a subtle change but objects with low glossiness / high roughness will look a lot better when the reflection curve gets smoothed out with increasing roughness.

              Click image for larger version

Name:	reflector_sphere1_flt.jpg
Views:	2
Size:	9.0 KB
ID:	884641

              How to use
              – Create a VRay OSL Texture map.
              – Load in the downloaded .osl shader.
              – Create a VRayMtl and disable Fresnel reflections.
              – Plug the OSL map into the reflection.
              – You may want to create a VRayColor map to drive the roughness/glossiness values of both the OSL shader and the VRayMtl. Plug it into roughness_tex for the OSL shader and in Refl Gloss for the VrayMtl.

              Click image for larger version

Name:	reflector_nodescreen.JPG
Views:	1
Size:	43.1 KB
ID:	884637


              Some examples:

              Click image for larger version

Name:	reflector_sphere1.jpg
Views:	1
Size:	39.0 KB
ID:	884639

              Click image for larger version

Name:	reflector_sphere2.jpg
Views:	1
Size:	53.3 KB
ID:	884640

              Rough Frensel setup on the left.
              Rens Heeren
              Generalist
              WEBSITE - IMDB - LINKEDIN - OSL SHADERS

              Comment


              • #67
                Are there any shaders that anyone would like to see?
                Rens Heeren
                Generalist
                WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                Comment


                • #68
                  I don't know if this is possible, I wish there was a shader that makes single sided geometry appear to have actual thickness... kinda like a shader-based Shell modifier. It doesn't have to be so big as to change the object's silhouette, just a one-pixel edge that catches the light.
                  Last edited by Laserschwert; 17-06-2016, 04:48 AM.

                  Comment


                  • #69
                    Originally posted by Rens View Post
                    Are there any shaders that anyone would like to see?
                    I remember one time I saw something floating around here which emulates building interios. Imagine you have a high-rise building with thousands of offices behind glass windows. Somewhere I found some sort of shader or sth which generates perspectively correct simplified interiors/rooms behind those glass panels. I can't find it at the moment, but do you know what I mean?
                    Software:
                    Windows 7 Ultimate x64 SP1
                    3ds Max 2016 SP4
                    V-Ray Adv 3.60.04


                    Hardware:
                    Intel Core i7-4930K @ 3.40 GHz
                    NVIDIA GeForce GTX 780 (4096MB RAM)
                    64GB RAM


                    DxDiag

                    Comment


                    • #70
                      Originally posted by Rens View Post
                      Are there any shaders that anyone would like to see?
                      Originally posted by Ihno View Post
                      Rens, could you be so kind and make a blur map? Just a map which burs its input map, maby with several blur algorithms.
                      And if possible keep it seamless.
                      I was allways wondering why max dosn't allready has such map, could be so usefull.


                      And whats about a Curvature with 3 input Textures Flat,Concave,Convex?

                      You should sell your shaders, or at least add a donate button to your Page.
                      I'd be happy to pay a little for them
                      German guy, sorry for my English.

                      Comment


                      • #71
                        +1 for the blur map!
                        Software:
                        Windows 7 Ultimate x64 SP1
                        3ds Max 2016 SP4
                        V-Ray Adv 3.60.04


                        Hardware:
                        Intel Core i7-4930K @ 3.40 GHz
                        NVIDIA GeForce GTX 780 (4096MB RAM)
                        64GB RAM


                        DxDiag

                        Comment


                        • #72
                          Actually I think I may want something even more important: Texture Bombing!

                          Just taking one or several input textures and then randomly scatter/distribute them in texture space with randomization in rotation, maybe brightnes/saturation/etc, ideally with a density setting and some controls for blending. That would be dope! WOuld pay money for it.
                          Software:
                          Windows 7 Ultimate x64 SP1
                          3ds Max 2016 SP4
                          V-Ray Adv 3.60.04


                          Hardware:
                          Intel Core i7-4930K @ 3.40 GHz
                          NVIDIA GeForce GTX 780 (4096MB RAM)
                          64GB RAM


                          DxDiag

                          Comment


                          • #73
                            Can you do a decent Color Correction node via OSL? Also +1 for blur node...

                            Comment


                            • #74
                              Originally posted by Moriah View Post
                              Can you do a decent Color Correction node via OSL? Also +1 for blur node...
                              No love for this one?
                              http://www.cuneytozdas.com/software/.../#ColorCorrect
                              Software:
                              Windows 7 Ultimate x64 SP1
                              3ds Max 2016 SP4
                              V-Ray Adv 3.60.04


                              Hardware:
                              Intel Core i7-4930K @ 3.40 GHz
                              NVIDIA GeForce GTX 780 (4096MB RAM)
                              64GB RAM


                              DxDiag

                              Comment


                              • #75
                                I'm not sure I follow the reason for the rough fresnel. Couldn't you just increase the ior and decrease the reflection amount, or is it a case of this does it in fewer clicks and/or it's more physically accurate?
                                David Weaver

                                Senior "Belief Crafter"
                                Realtime UK

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

                                Comment

                                Working...
                                X