Announcement

Collapse
No announcement yet.

vray hair shader?

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

  • #16
    After a quick play with this I managed to combine to two now. I have attached the scene for you. I used the hair sampler node to sample the texture that is connected to the maya hair. And then connect that to a ramp. And in the color gain I connected the fur sampler which is connected to a ramp. So now the hair has the texture from the plane and the roots are black. It was good I solved this because I had a similar problem myself with how to texture paint the trasparency but still keep the transparency along the strand. Let me know if you can open the scene, I'm not sure if we are using the same vray versions.

    J

    Originally posted by bigbossfr View Post
    I tried to setup the hair to pick up the texture color of the head, i failed.
    If anyone or Vlado know how i can do this, it will be great !

    To have a ramp on your hair, connect a VrayHairSampler (distanceAlongStrand) to the V of a ramp, and connect your ramp where you want into the VrayHairMtl (color for example). You will have black and white root/tip.
    Attached Files
    Johan Vikstrom
    Swiss International AB - Head of 3D - www.swiss.se

    Comment


    • #17
      I have opened the scene, and it is not exactly that i want.
      I want the hair pick up the color of the "pPlaneShape1". Your ramp is connected directly to the hair. But me, i want the ramp connected to the "pPlaneShape1", and the hair pick up the color of the "pPlaneShape1" ( UV ).
      I don't know if it is possible.
      www.deex.info

      Comment


      • #18
        But that is exactly what it is doing... It samples how the ramp is textured (UV) on the plane and applies that to the hair. If you apply the ramp to a shader and connect it to the plane it will look the same. Try making a checkboard and tweak it a bit, apply the shader to the plane and see how it looks. If you connect that checkerboard to the mayahair now you will see the hair is textured the same way (UV).
        If you want both at the same time just put the same shader on the plane also...

        Originally posted by bigbossfr View Post
        I have opened the scene, and it is not exactly that i want.
        I want the hair pick up the color of the "pPlaneShape1". Your ramp is connected directly to the hair. But me, i want the ramp connected to the "pPlaneShape1", and the hair pick up the color of the "pPlaneShape1" ( UV ).
        I don't know if it is possible.
        Johan Vikstrom
        Swiss International AB - Head of 3D - www.swiss.se

        Comment


        • #19
          Doesn't work for me.
          Here a example which does'nt work :
          https://rapidshare.com/files/410002548/vrayHair.zip
          www.deex.info

          Comment


          • #20
            Yes, I get the same problem. I haven't actually tested anything else than a plane, I just assumed it worked for everything else since I tried it. Maybe Vlado can help with this. Is this suppose to happen or is it a bug?
            Attached Files
            Johan Vikstrom
            Swiss International AB - Head of 3D - www.swiss.se

            Comment


            • #21
              Yep, perhaps a bug.
              Vlado will say us.
              www.deex.info

              Comment


              • #22
                Originally posted by sharktacos View Post
                If you could share the MEL for that it would be awesome. I'm not very good at that kind of thing so I don't think I could write it myself.
                Here you go:

                http://www.treyharrell.com/downloads...ultimatter.zip

                It's quick & hacky, but gets the job done. I've used a similar technique in production... the mattes are quite good, but depending on how picky your comp artists are, nothing short of a premulted & isolated alpha may be good enough for them

                Unzip the .mel into your maya/<version>/scripts directory and restart Maya.

                From there, make sure VRay is set as your render engine and you've got a shave node in your scene.

                Then you alter the pre-render MEL command in your VRay common tab to look like this:

                shaveVrayPreRender;th_ShaveMultimatter(200);

                This will give you a separate multimatte for every Shave node in your scene automatically, starting with ObjectID 200 in this case. Change the number in the command if you'd like the change your starting ID.

                You can hack the script if you don't like the pass/element naming conventions.

                It uses the ugly/hacky old-style render element creation code, so it should work with VRay 1.5+ (2.0 introduced much, much cleaner ways to create passes... using old-style for compatibility with both).

                --T

                Comment


                • #23
                  Originally posted by griml0ck View Post
                  Yes, I get the same problem. I haven't actually tested anything else than a plane, I just assumed it worked for everything else since I tried it. Maybe Vlado can help with this. Is this suppose to happen or is it a bug?
                  I've got this working fine here...

                  Click image for larger version

Name:	hairuvcap.png
Views:	1
Size:	141.1 KB
ID:	845009

                  http://www.treyharrell.com/downloads/hair3UVs.ma.zip

                  For whatever reason, the hairSystem doesn't pick up the correct UV's color if piped through a gamma node first. Bizarre.

                  Anyhow...

                  - Create a hair system on a sphere or something
                  - Map a ramp or other procedural to a mat on the surface (gamma corrected, of course)
                  - Go to the hair system's shading rollout and assign your procedural to the color value there
                  - Add hair shader attrs to the hair system
                  - Create a hair3 node, assign it to the hair system's extra attr
                  - create a vray hairsampler node and a gammacorrect node
                  - pipe hairsampler.hairColor into the gamma node (at .4545,.4545,.4545 gamma)
                  - pipe the gamma node into your desired slot on the hair3 mat

                  --T

                  Comment


                  • #24
                    Hmm I did some more tests today. It seems it works with a ramp but not with a checkboard. But I get the same problem with mentalray. And even if you bake the texture you still get the same result. But this seems like a maya bug and not vray since it looks wrong in the viewport as well and in mentalray.
                    Johan Vikstrom
                    Swiss International AB - Head of 3D - www.swiss.se

                    Comment


                    • #25
                      Actually Trey almost got there, but there is still some tinkering left - once you get the nice red/green gradient on the hair colors, you can use them as UV coordinates for your checker texture.

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

                      Comment


                      • #26
                        Awesome, thanks Trey! I'll give this a try

                        Comment


                        • #27
                          Originally posted by vlado View Post
                          Actually Trey almost got there, but there is still some tinkering left - once you get the nice red/green gradient on the hair colors, you can use them as UV coordinates for your checker texture.

                          Best regards,
                          Vlado
                          Hey Vlado,

                          I almost let this one slide... are you suggesting to use a red/green UV ramp then use the hairsampler's color attr to drive uv placement (instead of a place2d etc) on maps attached to the hair3 shader?

                          That...just...might...work!

                          --T

                          Comment


                          • #28
                            Heh... maybe not. SamplerInfo UV out onto hairsystem color breaks, as do two ramps added. They break on the pfx preview/mental ray too so I'm assuming this is a Maya bug, like the gamma issue. A manually painted UV file ramp *sort of* works.

                            But really, just plugging a file texture into haircolor then using the hairsampler color out seems to be the best approach at the moment. You can still use blend color on each follicle clump if you want to add streaks and the like.

                            I'm not too concerned about some procedurals breaking, as long as texture maps are coming through ok, although hopefully with the rumored nHair in 2013, more dev time has been spent on the shading parameters of hairsystems

                            --T

                            Click image for larger version

Name:	hairmap.png
Views:	1
Size:	108.1 KB
ID:	845050

                            Comment


                            • #29
                              Originally posted by treyharrell View Post
                              Actually, it's possible to add a pre-frame MEL command just after the shavePreRender script which adds an object ID to the piece of placeholder geo that's inserted into the scene at rendertime ... run the pre-frame script from your globals and you'll see the geo name. From there it's possible to iterate similarly named objects and auto-create multimattes depending on how many shaveNodes are in your scene. Just add your own preframe MEL after Joe's.
                              Trey, would it be possible to modify the MEL script you posted to generate mattes for the native Shave material, or would it only work with vrayHairMtl3?

                              Comment


                              • #30
                                Originally posted by sharktacos View Post
                                Trey, would it be possible to modify the MEL script you posted to generate mattes for the native Shave material, or would it only work with vrayHairMtl3?
                                That MEL script I created only works with ShaveNodes... it's been testing with native Shave shading.

                                I haven't tested it with a Hair3 override on Shave, but in that case, I assume you could just do a material ID on the Hair3 mat, yeah?

                                --T

                                Comment

                                Working...
                                X