Announcement

Collapse
No announcement yet.

skin shader a la Alsurface pleaseeee

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

  • #76
    Here's the file I'm working on trying to get it work.. some of the osl skin load the texture... and some other not, and an other one load it but it look's reallylighter.. and the other one too dark.. no one load it normally and the same way.. a lot of inconsistency in those OSL shader... there is a problem for sure somewhere... have a look Vlado you'll see.
    OSL skin fucked.zip

    Comment


    • #77
      sharktacos UPDATE!

      Your last skin shader you made for max, the diffuse work.. yesterday it was not but now it is I did put a white color in the depth and a diffuse map and it work, I had to put the gamma at 1 ( can you make it setted up at one by default?

      So now, can you please add Overall Color Mult map slot and one also for RGB Scatter Depth like in your maya interface please Only things missing would be opacity and the possibility to have the sss raytrace ID per object like in the sss2 in raytrace mode so that it blends togheter

      Click image for larger version

Name:	OSL interface.jpg
Views:	1
Size:	438.6 KB
ID:	862108

      Comment


      • #78
        Click image for larger version

Name:	OSLSkin fucked up when Blended.jpg
Views:	1
Size:	407.3 KB
ID:	862109Me again! I found the problem...!! When I blend it with a vray blend mt, the textures don't work!! I don't know why, Vlado, any idea?

        and it's fucked up.. when I play with the blend color of the blend mtl, I see squares moving ( squares in the texture.. the texture look like it divised in small squares... ) when I play with the blend slider or do anything mostly lol .. .really weird..

        I joined an image.. look what happen when I play with the blend , or with the textures etc.. squares of textures are moving.... it should look like the ball at the left, but with reflection ( the one on the left is the OSLskin not blended with a vrayblendmtl, it work's well when not blended..

        EDIT :shark .. I found something, the Phase Function thevalue between -1.0 and 1.0 in max it goes to really high number in one sens or the other and seem to do nothing.. it has no effect.. and the IOR seem to have no effect also..
        Last edited by Bigguns; 20-05-2016, 10:39 AM.

        Comment


        • #79
          Luc, can you confirm that the Lambert OSL is working with a texture map? Note that you should use a bitmap (like a PNG), not a procedural map (like checker). Also the shader ball preview might look messed up with OSL, but what really matters is what the actual render looks like. So does the OSL Lambert with a texture map now work?

          Once we establish that we can go to the next step, but I'm trying to be methodical here. It's a good approach when troubleshooting

          Comment


          • #80
            the lambert osl is not working me at all it cannot load.. but the latest skin shader you writed me is working with the diffuse map! but, when I blend it with the vray blend mtl, the texture get fucked upo, thats the problem, the blending ^^

            Comment


            • #81
              Originally posted by Bigguns View Post
              the lambert osl is not working me at all it cannot load.. but the latest skin shader you writed me is working with the diffuse map! but, when I blend it with the vray blend mtl, the texture get fucked upo, thats the problem, the blending ^^
              Do you mean it messes up the shader ball preview or the actual render is messed up?

              Comment


              • #82
                Also when you say the skin material is working with the "diffuse map" you mean the "subsurface color" map, right?
                Last edited by sharktacos; 20-05-2016, 09:06 PM.

                Comment


                • #83
                  Doh! My OSL Lambert code was missing the output. This should work:

                  Code:
                  surface
                  Lambert
                      
                  (
                      string diffuse_texture = "diffuse.png",
                      float diffuse_weight = 0.5,
                      output color result = 1
                  
                  )
                  {
                      color diffuseColor = texture(diffuse_texture, u, v);
                      
                      Ci = diffuse_weight * diffuseColor * diffuse(N) ;
                  }

                  Comment


                  • #84
                    Originally posted by Bigguns View Post
                    the Phase Function thevalue between -1.0 and 1.0 in max it goes to really high number in one sens or the other and seem to do nothing.. it has no effect.. and the IOR seem to have no effect also..
                    I'll take a look at that. I'm tending to just remove the phase function and IOR from the interface all together since the shader is intended to be used specifically for skin rather than for all subsurface stuff.

                    I get why you want opacity for eyes, but it may be better to do that with a VrayBlendMtl. Vray tends to not do well with opacity.

                    What would you want the overall color for? It's needed on the SSS2 to counter-balance the weird mix of the substurfacce and scatter colors, but on my shader that is not necessary. Is there something else you need the overall color for? Otherwise I'm thinking of just making it a float values and calling it "brightness" instead.

                    Comment


                    • #85
                      Do you mean it messes up the shader ball preview or the actual render is messed up?

                      It's messing both, the preview and at render time but only when I blend it with the vray blend mtl otherwise it work's perfectly. That's why since the start it was not working, because it was blended... at first I did not though it was the problem but it is. and yes, the maps are working, so now the problem is to find out why it don't work properly when blended with a vray blend mtl.. and to add the other map slot. Like a for the diffuse component, so I can add make texture here let's say for a woman, making the texture gamma at 1.0 by defaults in max , maybe fixing the IOR and phase function issu ? At least ti's working, I mean, the skin itself is working, but the control over these 2 parameters does nothing.. so I think something is borken there, don't know if you in maya it does a difference. In the sss2 it does though.
                      For opacity, if you can do like in the sss2, it work's correctly here.

                      Comment


                      • #86
                        Understood. I'll follow up on the maps.

                        When you are adding it to a VrayBlendMtl the OSL should be in the base, with the mode set to "additive" and then VrayMtls with diffuse amount set to zero adding in the spec/reflection on the other layers of the blend. Is this what you are doing?

                        This works fine in Maya. So if the same does not work in Max I'm a little baffled. Perhaps someone else here on the forums or someone from Chaos could have a look?

                        Comment


                        • #87
                          Try this shader. I have removed the phase function and IOR (they are not in the VraySkinMtl either). All color channels now can have maps. There is no bump or diffuse color. This should be added with a blendMtl along with the spec. The material is only focused on doing the SSS. I set the gamma to 1 by default. I added transparency instead of opacity since the swatches default to black. That way it defaults to being visible. Finally, I made it faster by removing one of the sss terms, so it now has 2 instead of 3 sss. The looks should still be the same, it will just be faster (although still slower than one sss2 material).

                          The code has not been tested, so it may have errors. I'll test it when I'm back at work. But you can cross your fingers and give it a try

                          Code:
                          /*
                           *
                           * Wavelength dependent subsurface scattering OSL material by Derek Flood (c)2016
                           * Based on the hypershade tree by Tony Reynolds
                           * from http://docs.sharktacos.com/misc.php?action=help&hid=66
                           *
                           */
                          
                          
                          surface DFskinMaxMtl
                              [[ string description = "blended skin material" ]]
                          (
                              /* Global Section */
                              float Depth_Scale = 1,
                              float Overall_Brightness = 0.8,
                            
                              /* SSS Section */
                              string Transparency = "transp.png",
                              string Subsurface_Color = "color.png",
                              float Subsurface_Amount = 0.8,
                              string RGB_Scatter_Depth = "RGB.png",
                              
                              float Texture_Gamma = 1.0,
                            
                              output color result = 1
                          )
                          
                          
                          
                          {
                          
                             
                              /* declare variables and read texture map */    
                              //color RGB_Depth = getTextureDif(RGB_Scatter_Depth, color(0.8,0.2,0.1));
                              color RGB_Depth = texture(RGB_Scatter_Depth, u, v);
                              
                              /* Prevent depth values from being zero which breaks the shader RGB mix */
                              RGB_Depth[0] = clamp(RGB_Depth[0],0.001,1);
                              RGB_Depth[1] = clamp(RGB_Depth[1],0.001,1);
                              RGB_Depth[2] = clamp(RGB_Depth[2],0.001,1);
                           
                              //color Map = getTextureDif(Subsurface_Color, color(0.85,0.75,0.65));
                              color Map = texture(Subsurface_Color, u, v);
                              
                              Map = pow(Map, Texture_Gamma);
                              
                              color SubsurfaceColor = Map * Overall_Brightness *  Subsurface_Amount;
                              color SubsurfaceR = SubsurfaceColor * color(1,0,0);
                              color SubsurfaceG = SubsurfaceColor * color(0,1,0);
                              color SubsurfaceB = SubsurfaceColor * color(0,0,1);
                              
                              float IOR = 1.38;
                              float PhaseFunction = 0.8;
                              int Subdivs = 8;
                            
                              
                              /* Closures */
                             
                              closure color SkinRed = vray_subsurface (
                                 IOR, PhaseFunction,
                                 SubsurfaceR * RGB_Depth[0] * Depth_Scale,
                                 SubsurfaceR,
                                 "subdivs", Subdivs);
                               
                              closure color SkinGB = vray_subsurface (
                                 IOR, PhaseFunction,
                                 (SubsurfaceG * RGB_Depth[1]) +
                                 (SubsurfaceB * RGB_Depth[2]) *
                                 Depth_Scale,
                                 SubsurfaceG + SubsurfaceB,
                                 "subdivs", Subdivs);
                                 
                            
                               Ci = SkinRed + SkinGB;
                               
                               /*
                               color opacity_result = getTextureColor(opacity_color_texture, opacity_color);
                              if (luminance(opacity_result) < 0.99)
                              {
                                  Ci *= opacity_result;
                                  Ci += (1.0 - opacity_result) * transparent();
                              }
                              */
                              
                               if (luminance(Transparency) > 0.01)
                              {
                                  Ci *= 1-Transparency;
                                  Ci += Transparency * transparent();
                              }
                              
                             
                          }
                          Last edited by sharktacos; 22-05-2016, 12:44 PM.

                          Comment


                          • #88
                            Originally posted by sharktacos View Post
                            Understood. I'll follow up on the maps.

                            When you are adding it to a VrayBlendMtl the OSL should be in the base, with the mode set to "additive" and then VrayMtls with diffuse amount set to zero adding in the spec/reflection on the other layers of the blend. Is this what you are doing?

                            This works fine in Maya. So if the same does not work in Max I'm a little baffled. Perhaps someone else here on the forums or someone from Chaos could have a look?

                            I put the color of the diffuse black in the blend mtl, not the amount to zero, I mean there is no value for this as far as I know. and yes additive mode checked.

                            Ok I'll test that new shader thank you!

                            Comment


                            • #89
                              it don't work that last shader, it says error : PhaseFunction`was not declared in this scope

                              chinese to me ^^

                              Comment


                              • #90
                                Originally posted by Bigguns View Post
                                it don't work that last shader, it says error : PhaseFunction`was not declared in this scope

                                chinese to me ^^
                                It was a typo in the code. I changed it above in post#87 if you want to try it again.
                                It's cool that Max is giving you error messages for OSL. Maya doesn't.

                                Comment

                                Working...
                                X