Mode: All Modes
Panel: Context Shading → sub-context Material → Ramps
In many real life situations - like skin or metals - the colour of diffuse and specular reflections can differ slightly, based on the amount of energy a surface receives or on the light angle of incidence. The new Ramp Shader options in Blender now allow you to set a range of colours for a Material, and define how the range will vary over a surface, and how it blends with the 'actual colour' (typically from material or as output of texture).
Ramps allow you to precisely control the colour gradient across a material, rather than just a simple blend from a brightened colour to a darkened colour, from the most strongly lit area to the darkest lit area. As well as several options for controlling the gradient from lit to shadowed, ramps also provide 'normal' input, to define a gradient from surfaces facing the camera to surfaces facing away from the camera. This is often used for materials like some types of metallic car paint, that change colour based on viewing angle.
Since texture calculations in Blender happen before shading, the Ramp Shader can completely replace texture or material color. But by use of the mixing options and Alpha values it is possible to create an additional layer of shading in Blender materials.
The Ramps panel is located in the Material context (F5). Here you can use the top two buttons to show either settings by pressing Show Col Ramp for diffuse or Show Spec Ramp for specular ramps (Ramps Panel.).
Pressing the button Colorband enables Ramp Shaders. By default it opens with two colours, with the first having Alpha = 0, and no colour. And the second having Alpha = 1 and a cyan colour (Ramps Panel Colorband.).
See the settings description of the colorband below.
The two pop-up buttons and the value slider in the bottom of the panel defines how the Ramp Shaders work:
- The input menu contains the following options for defining the gradient:
- The value as delivered by the material's shader (like Lambert or Phong) defines the colour. Here the amount of light doesn't matter for colour, only the direction of the light.
- As Shader, but now also lamp energy, colour and distance, is taken into account. This makes the material change colour when more light shines on it.
- The surface normal, relative to camera, is used for the Ramp Shader. This is possible with a texture as well, but added for convenience.
- All three previous options work per lamp, this option only does it in the end of all shading calculation. This allows full control over the entire shading, including 'Toon' style results. Using alpha values here is most useful for tweaking a finishing touch to a material.
- A list of the various blending modes available for blending the ramp shader with the colour from Input.
- The Factor slider denotes the overall factor of the Ramp Shader effect: 0.0 means no effect and 1.0 means full effect.
Mode: All Modes
Panel: Context Shading → sub-context Material → Ramps
A colorband can contain a gradient through a sequence of many colours (with alpha), each colour acting across a certain position in the spectrum. Colorbands are used in both materials and textures, as well as other places where a range of colours can be computed and displayed.
- Add a new mark to the centre of the colorband with default colours (neutral grey). New marks can also be added with CtrlLMB click on the colorband itself, which will add the mark at the position of the click, with the same colour as already existing underneath the mouse pointer.
- Remove the current mark from the colorband.
- The number of the current selected mark on the colorband that's being edited. The current selected mark is shown on the colorband with double width. To select a colour mark you can either press LMB on the desired one, or step the current colour number up and down with the right and left arrows in this control. You can also ⇧ ShiftLMB in the field and enter the required colour number manually.
- The location of the current mark along the colorband, from 0.0 (left) to 1.0 (right). The position of the marks can also be changed by clicking and dragging them with LMB .
If you reorder the positions of the colours, they will be renumbered so that they always start with 0 from the left and increment to the right.
- The colour of the current mark. You can LMB on the colour swatch under the Pos field to choose a colour using the Color Picker.
- The alpha value (opacity) of the current mark. An Alpha value of 0.0 means that the colour is totally transparent and will not be seen in the final colorband. A value of 1.0 sets the colour opaque. If you defined colours with different Alpha values, they will be interpolated between each other to get a smooth transition between different transparency settings. You can preview the Alpha settings on the colorband with the checker board pattern behind the colorband. If pattern is visible then the transparency is less than 1.0.
The colours can interpolate from one to the other in the following ways:
- Ease in by a quadratic equation.
- Linear (Default). A smooth, consistent transition between colours.
In this first example to the right, we want to texture a snake, specifically the deadly coral snake. We want to make a repeating set of four colours: black, yellow, red, yellow (and then back to black again). We also want to make the rings sharp in definition and transition. This example uses 8 colorband settings: 0 and 7 are black; 1 and 2 are yellow, 3 and 4 are red, and 5 & 6 are yellow. Position 0 and 1 close together, 2 and 3, etc. Use a little noise and turbulence; together with the scales texture you should get really close!
Let us make another simple example using Ramp Shaders.
- Remove default cube object from scene and add a Monkey mesh (⇧ ShiftA → Add → Mesh → Monkey). Press Subsurf (NOTE: In 2.42 and higher, Subsurf is now in the Modifier panels), and set display and render Subsurf Subdivision level to 2. Press Set Smooth to get a nice smooth Monkey. All this in Edit context (F9).
- Now press ⇆ Tab to exit Edit mode. Press F5 to enter Material context. In the Material panel press Add New to add a new material. Change the parameters in the Shaders tab as (Shader settings).
- Press Ramps tab to open the Ramp Shader panel. Press Colorband to activate the Ramp Shader effect. Now try to set the parameters as (Ramp Shader settings). Remember to set the Input to Normal. The second colour to the right is set to Alpha = 0.0 and the colour to pure black.
- In the Ramps tab press Show Spec Ramp and try to set the parameters as (Specular Ramp Shader color 0) and (Specular Ramp Shader color 1).
Here is the rendered result of the settings we just entered above. In (No Ramp Shader) there is no Ramp Shader active. In (Color Ramp) the Color Ramp is activated and finally in (Both Color and Specular Ramp) both Color Ramp and Specular Ramp are activated! Remember here we have just demonstrated one effect of the Ramp Shader. There is much more to explore, try changing the Input and Method parameters, to see totally different results from the ones we have just seen in this example.