Material Modulation

Table of Content:

Material Modulation Introduction

Some material properties can be modulated by a texture, instead of using a global base color or scalar value. This technique is called texture mapping. The texture used can be a either a RGB image or a procedural texture. In general, there are seven types of modulable settings in YafaRay materials in two groups:

RGB texture mapping:

  • Diffuse color. ShinyDiffuse, Glossy and Coated Glossy.
  • Specular color. ShinyDiffuse, Glossy and Coated Glossy.

Scalar texture mapping:

  • Specular intensity. ShinyDiffuse, Glossy and Coated Glossy.
  • Alpha intensity. ShinyDiffuse.
  • Bump intensity. All materials.
  • Displacement mapping through a mesh modifier. All materials.
  • Blend mapping. Blend material.

RGB mapping is used to transfer color from a texture onto a mesh, while scalar mapping uses values from a texture to modulate different levels of intensity for a material feature. For instance, you can use a texture to have different values of glossy reflection across a surface. Some of these modulation modes are available for all material types, like bump intensity. Others are available only for some of them, depending on the material features.

All Map to slots use sliders which have in fact a range (-1,1), which means that they could be configured in negative mode as well.

Diffuse Color Mapping

To map the diffuse component with colors from a RGB texture, enable the Diffuse color slot [1] in the 'Map to' panel. Shinydiffuse, Glossy and Coated_glossy materials support color mapping of the diffuse component with textures. The applied RGB texture will be blended with the material base diffuse color [2] defined in the material settings (or with another texture defined in the channels stack) using the blending mode set in the "Map to" panel [3] and with the amount defined in the Diffuse color slider [4].

Diffuse reflection value [5] is an useful diffuse color global multiplying factor, affects the texture output as well.

You can use a procedural texture to map the diffuse color. Colors in a procedural texture are defined by two controls: Color Picker in the YafaRay Influence (Map to) section [6] and material base color [2]. More info about texturing here.

Below an example of diffuse color mapping in Shinydiffuse (left) and Glossy material (right):

Mapping color filtering

Color filtering is tinting of light that goes through a coloured transparent surface. In YafaRay this is done by multiplying transparency for the value component of the HSV coordinates of a color. It means that a white color on the texture can be made fully transparent if Transparency=1 while a black color on the texture can't be made any transparent even if Transparency=1. Mapped color filtering can be done by using a RGB texture on a shiny diffuse material, using Diffuse color slot [1] in the 'Map to' panel and then using a transparency factor [7] in the material section. Also for this feature to work, Transparent Shadows must be enabled in the render section with a sufficient transparent shadows depth.

When a diffuse color texture is used in a ShinyDiffuse material with Translucency [8], the amount of translucency will be defined by the texture brightness. Enable Transparent Shadows in Settings section to get transparent shadows and color filtering from the texture. Translucent back scattered light with transparent shadows & color fitering only works with Pathtracing, Bidirectional Pathtracing, and Photon mapping.

Mapping Emit

When a diffuse color texture is used in a ShinyDiffuse material which uses the Emit [9] feature, the amount of light emission produced by that material will be defined by the texture brightness. At the moment, texture-based light emission only works with the pathtracing method.

Mapping specular color

Shiny Diffuse Material Glossy Material

There are two kinds of mappable specular color in YafaRay, Mirror Color in Shinydiffuse, and Glossy Color in Glossy and Coated Glossy materials. The applied texture will hide the material specular base color (mirror or glossy) defined in the settings UI [1]. However, you can control opacity of the texture so it blends with the material base specular color, by using the appropiate slider [2] in the Blender 'Map to' panel. You can use a procedural texture as well.

Remember that coloured reflections are a particular feature of conductive materials, while non-conductive have neutral-colored reflections, which means they reflect light color without change. This material could be useful to map metalic reflections. The images below are examples of specular color mapping. Both cases are using full specularity strength:



Mirror color mapping. Glossy color mapping.

Texture used.

Mapping specular intensity

Shiny Diffuse Material Glossy Material

You can use a texture to map the amount of specular reflection. There are two kinds of specular reflection in YafaRay: Mirror in Shinydiffuse and Glossy Reflection in Glossy and Coated Glossy material. Textures will be processed as a scalar value. This means that if the RGB texture has got colors, they will be automatically transformed into tones of grey, so normally it is a wise idea to use desaturated textures to map scalar values. This way users have more control over the final result. You can use a procedural texture as well.

The texture in fact will map within the range between the specular strength set in material setting [1] and Default Value [2]. For instance, if Mirror strength is 0.20, it means that black color in the texture will make the object to be at least 0.20 reflective. If Default Value= 0.80, it means that white color in the texture will make the object to be as much as 0.80 reflective. The same happens with Glossy and Coated Glossy materials.

To map mirror strength in Shinydiffuse, use Mirror Amount slot [3]. To map glossy reflection strength, use Glossy Amount slot [4]. Below are examples of specular mapping. Both cases are using strength=0 and Default Value=1:



 Shinydiffuse mirror mapping.
 Glossy reflection mapping.

Texture used.

Mapping transparency

This feature is used to map mesh transparency with a texture. Information from the RGB texture is translated into amount of mesh transparency. To make it possible, textures need to be transformed into scalar values. This means that if the texture has got colors they will be automatically transformed into tones of grey. It is a wise idea to use desaturated textures to map intensity, so there is more control over the final result. You can use a procedural texture as well.

Don't confuse 'transparency mapping' with 'texture alpha'. The texture alpha channel (RGBA) is used in diffuse color mapping.

Alpha intensity mapping will just produce different values of transparency based on the texture scalar values. Those different levels of transparency will produce colored transparent shadows if transparency is applied onto a material with diffuse colors applied.

There are two kinds of transparency in YafaRay, 'specular' Transparency [1] and 'diffuse' transparency, also called Translucency [2]. To enable shadows calculation from transparency mapping, enable Transparent Shadows with enough Shadows depth, in the render General Settings section.

The texture will map in fact a range between the transparency value set in the material setting [1 or 2] and the Default Value [5]. For instance, if Trasparency is 0.20, it means that black color in the texture will make the object to be at least 0.20 transparent. If Default Value=0.80, it means that white color in the texture will make the object to be as much as 0.80 transparent. The same happens with Translucency.

To map Transparency, use Transparency slot [3]. To map Translucency, use Translucency slot [4].

At the moment, Translucency back scattered light with transparent shadows only works with Global Illumination methods, which are Pathtracing, Bidirectional Pathtracing, and Photon mapping. Below are examples of transparency and translucency mapping. Both cases are using strength=0, Var=1:

Below are examples of transparency and translucency mapping. Both cases are using strength=0, DVar=1:

 Transparency mapping.
 Translucency mapping.

Texture used.

Bump Intensity.

All four materials (ShinyDiffuse, Glossy, Coated_Glossy and Glass) support bump mapping.

Brian Lingard gives this definition of bump mapping:

"Bump mapping simulates the bumps or wrinkles in a surface without the need for geometric modifications to the model. The surface normal of a given surface is perturbed according to a bump map. The perturbed normal is then used instead of the original normal when shading the surface using the Lambertian technique. This method gives the appearance of bumps and depressions in the surface."

Bump is a scalar mapping type. Textures RGB data is transformed into a scalar value. It means that if the RGB texture has got colors, they will be transformed into tones of grey. It is a wise idea to use desaturated textures to map intensity, so there is more control over the final result. You can use a procedural texture as well.

To map bump, the Bump slot [1] must be enabled for the texture channel. Bump slider [2] controls amount of bump. YafaRay uses comparatively lower values than Blender Internal for bump mapping.

Normal mapping.

Normal Mapping is supported in YafaRay. To enable normal mapping using an appropiate image texture, enable 'Use map as normal map' tickbox [3] next to the Bump mapping slot.

Displacement mapping.

YafaRay supports Blender Displace modifier in mesh export. It can be applied to any mesh regardless of the material. First, a texture must be created as usual using supported Texture buttons. The texture will appear in the Texture channels stack. This created texture is later used as input in the Displace mesh modifier. More information about Blender Displace modifier in the link below:

http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Deform/Displace

Blend mapping.

You can use a texture to control how two materials are blended. This texture is a sort of a mask in which scalar values tell how big a percentage of each material is seen. If the RGB texture has got colors, they will be transformed into tones of grey. It is a wise idea to use desaturated textures to map blend, so there is more control over the final result. You can use a procedural texture as well. The texture should be mapped onto the object assigned with the blend material, enabling the Blending Amount slot [1].

If the texture is a black&white data, it means that black areas will show material 1 whereas white areas will show material 2 (example below). The texture can use tones of grey as well, which means that properties from both materials are blended in the same area.

Blending Amount slider [2] works as a global opacity factor for the texture. If you want the texture to have a complete control of the blending, use a Blending Amount=1. If Blending Amount is 0, the texture will be completely transparent and only the material 1 can be seen. If Blending Amount = 1, the texture scalar values will be inverted. The texture scalar values supersede Blend Value set in [3].

Below an example of blend mapping, using a black&white checker. On the left a Blend value=1 is used whereas on the right Blend value is 0.50:

 Related article: Blend Material