Email Password


  • Creating a Ghost Shader

  •                                                             Creating a Ghost Shader

                                                  Learning to use the "Sampler Info" Node

    If you haven't ever used the "sampler info" node in Maya, you're in for a treat. This is one of the most useful nodes, and it comes up in all sorts of common shaders networks. Let's say we wanted to turn our buddy here into a ghost:

    Right now he just has a basic Lambert shader applied to him.Select your geometry (you can use whatever geometry you like. If you just want to use a poly primitive, I always recommend a torus over a sphere), and apply a new Lambert. Select your new shader and open up the attribute editor to change the color to a light green. Then, click on the flag next to transparency to add an input connection and create a ramp texture.http://animationcarnival.com/Admins/NewsContentEdit.aspx?idx=47&type=tutes

    Next, open up the Hypershader, right click on your Lambert, and graph the network. This is what you should see open up in your work area:

    Now it's time to create a sampler info node. On the left of the Hypershader, scroll down until you get to the "general utilities" section and locate the sampler info node.

    Click on it to create a new node, and then middle mouse button drag the new node onto the ramp shader and select "other" in the dropdown menu. The connection editor will pop up. On the left, select "facing ratio." On the right select "U Coord" and "V Coord."

     What did we just do? At render time, the Sampler Info Node samples each pixel of the object and returns a value between 0 and 1. A value of 1 means that the geometry is facing the camera at that point. A value of 0 means that it is perpendicular to the camera. Everything in between is interpolated. It outputs this value as the "Facing Ratio." A ramp also operates on values between 0 and 1, where 0 is one end of the ramp, and 1 is the other.

    Here's what our render looks like:

    As you can see, by piping the facing ratio into the ramp, the ramp blends from one end to the other as the geometry turns torward or away from the camera. A shader of this type is said to be "camera based." It can also be referred to as a "falloff" shader.

    Some materials that commonly employ this falloff technique are glass, car paint, and many fabrics. In any caseOur result so far is cool, but not what we were going for. Open up the ramp in the attribute editor and lets change the values. We want the shader to be completely see-through when its facing us dead on, and to become gradually more opaque towards the edges. But we don't want a hard edge. It should be fuzzy around the perimeter.

    The ramp should look something like this:

    Render the new image and see what we get:

    Much better! You should note two things from the ramp:

    1. Areas of correspond to transparency. Areas of black correspond to opacity.

    2. The bottom of the ramp (where the positional value = 0) corresponds to the border of the geometry. The top of the ramp (value=1) corresponds to the portions of geometry that face the camera. This is what we used the sampler info node for.

    So are we done? Well.. we could do more. I'm going to map some noise into the ramp. I could also connect the sampler info node to another ramp and use that one to drive color. Falloff is by no means limited to transparency. You can use it for any shader channel you want in order to create different effects.

    Finish it off with a nice glow and we're done:

    In the end, I would like to thank you for the support that you have shown by reading this article, for more articles please keep visiting...