Join Eric Keller for an in-depth discussion in this video Using ramp textures, part of Creating Textures and Shaders in Maya.
In this movie, I'm going to show you how you can use a ramp texture to increase the visual interest of the paint job applied to this car model. So currently, I have just a purple color applied to the car model itself. You can see the variation in color, because this is part of the car material. So we have two different colors for the base color, and also the lit color. The base color is this darker purple. the lit color is this brighter purple. What I like to do is I'd like to add in gradients that we have more of an interesting paint job. So it looks like we have darker colors moving from the bottom to the top, as well as the variation in the carPaint material itself.
Looks like whoever created this paint job spent some time on it. So I'm going to minimize the Render view and I have the car selected. The carPaint material is here in the Attribute Editor. I want to add a ramp to the Base Color to create this effect. So I'll click on the Texture icon to the right of the Base Color slider and this opens up the Create Render Node palette. Under 2D Textures, I'll choose Ramp. I'll see the car goes black because I no longer have the display of the texture in the Perspective View. But I can fix this just by selecting the carPaint material.
In the Attribute Editor, I can go down to the bottom. Under Hardware Texturing, I'll just choose Base Color. Now I can see that the ramp color is applied to the model. There is a bit of a problem though, because you can see how the ramp texture has been applied to this model in such a way so that it's using the UV texture coordinates to apply a 2D ramp to a 3D object. I'll select the car body, and open up the UV Texture Editor. You can see the problem here. Here are the UV texture coordinates. So it's like the model has been flattened.
We have the ramp going from the red values to the blue values. This is just a flat 2D texture. So it's just being projected down on top of these UVs. So that means that we can easily see the UV scenes. There is no 3D ramp texture in here. So we have to find another way to map this texture to the body. To do that, we'll just use a projection style ramp as opposed to the normal UV style projection. So what I am going to do is I'll open up the Hypershade in Windows > Rendering Editors > Hypershade, and I'll Graph Material on Selected Objects.
Here is the shader network. You can see the ramp is connected to the base color of the shader. What I'm going to do is I'll go into the Create menu and choose 2D Textures. Down here at the bottom, I'll switch from 2D Normal to 2D Projection. So this changes the way that the 2D Textures are mapped to the model. So now I'll choose 2D Textures > Ramp. This creates a new ramp. You can see that those are up here. So let me just move these out of the way, so we can actually see what's going on. So you can see as opposed to the original ramp that I created, this one has a few extra nodes.
So the original ramp I have is to simply place 2D Texture node connected to the ramp, and the ramp is connected to the base color of the carPaint material. In this case, I have a ramp node, place2DTexture node, a projection node, and place3dTexture node. This will give me more options for mapping a 2D texture to the 3D object. So what I'll do is I need to connect the projection node to the base color, not the ramp, but the projection node. To do this, I'll just middle-mouse button+drag the projection node over the carPaint material, and choose base_color.
This replaces the connection. So now I can see the original ramp is no longer connected and the projection node now is connected to the shader. So if I take a look in the Perspective View, it doesn't look like much has changed. That's just because Maya hasn't done a very good job of updating the color. So I'll select the carPaint material. Again, in the Hardware Texturing channel, I'll set the Texture channel to Base Color. Now it updates. What I'd like to do now is adjust the projection node itself, so that it's mapped on the car from the side.
Right now, it's mapped from the front to the back. So I'm going to click on the 4 key on the keyboard, so that I can see wireframe. I am going to select the place3dTexture node, so now I can see the actual projection node here. I'll press W to switch to Move mode. Let's just drag this out, so I can see it a little bit easier. In the Attribute Editor for the place3dTxture node, I'll set the Y channel of the Rotate to 90. So now this is projecting from the side. Then finally what I'd like to do is have this texture here mapped to the car, based on the size of the car.
So I'll select the projection node and choose Fit To Bounding Box or Fit To BBox. This just fits the projection nodes to the side of the bounding box of the car. So now that your ramp is no longer using the UVs to map to the car. Instead it's using this projection node. So in this case, I'll choose a view here, maybe something in the back, so we can do a render, and see how it looks. So there we go. We can see the ramp is now mapped correctly to the car. This purple color is just coming from the lit color of the material.
It's not part of the ramp. We can see the ramp is covering with the car evenly. There is no difference in the door, and the other parts of the car. So at this point, we can start to adjust the ramp itself. So I'm going to select the ramp texture. I'm going to change this red color to very dark purple. Maybe even a dark bluish purple. I'll select the green color just by clicking on this little dot here. I'm going to select the dark purple from the Color History and then just move the color slider, changing it just a little bit.
Then I'll select the color on the top. Do the same thing. I'll select that lighter purple from the Color History. Move this sort of the pink range. I can actually move the color markers on the ramp a little bit to tighten it up. Let's do a render and see how that looks. We'll get a nice view here. So there we go. It looks pretty good. I think the colors could be a little bit more obvious.
So I'll store the render in the Render View window. I'm going to choose the dark purple. I make it much darker, pulling up a little bit. There is no reason to be subtle when working with hot rods. This red at the top is a little bit warm. So I'm going to bring this back to the cooler side and make it a little bit lighter, and bring this down just to tighten it up a little bit. So it's obvious that there really is a painted gradient on here. It's not just something that's part of the carPaint. A couple of things I like to notify. I wanted to change the direction of the ramp.
I can try either changing this from a V ramp to a U ramp. So that way, the dark colors would start here at the front and move back towards the back the lighter color. Another option, of course, would be to select the place3dTexture node and change its rotation. I could Rotate it 90 degrees and see, but I like the way it is right here. So those are two options. Another thing to keep in mind, of course, is that this car is going to be driving around. We certainly don't want it to drive away from the projection node. So you can either parent the place3dTexture node into the car group so that if the car moves around the node moves with it, or you can go to the Texturing window and create a Texture Reference Object.
Either way, you want to make sure the projection node doesn't move away from the car. It looks kind of strange. So, let me do one last render. There we go. This is starting to look a little bit better, a little bit more tweaking. I think I can get it exactly the way I want. Now that I solve all the major problems of projecting the ramp onto the surface. You can see that I can just adjust the colors until I get exactly what I want. So here is one last render that just shows after tweaking the colors in the ramp a little bit, just changing their position in the colors slightly. I think I've got something closer to what I want. Now I think this car is ready to hit the road.
Here is the final ramp. So I've just moved this up a little bit, increased the saturation of the color, and just rearranged the position of the colors in the ramp, so it looks a little bit better. There we go.
- Understanding shading concepts
- Simulating the Fresnel effect for realistic reflections
- Rendering transparent and translucent surfaces
- Comparing mental ray and Maya standard shaders
- Introducing the mia_material
- Developing shader networks
- Using subsurface scattering shaders
- Mapping polygon UV coordinates
- Incorporating texture nodes into networks
- Improving skin detail with ambient occlusion
- Painting bump maps
- Creating normal and displacement maps
- Troubleshooting maps