©Anton Podvalny

In this chapter we'll talk about the most common types of V-Ray materials - V-Ray Material, V-Ray Light Material and V-Ray Blend (layered) Material.

V-Ray Material


This type is implemented by the BRDFVRayMtl plugin and is usually connected to a MtlSingleBRDF instance. Diffuse materials are opaque - the light hits the surface and bounces off. They also don't have a specular component (a shine), because their molecular distribution is pretty chaotic. In nature though many of the real materials contain some specular component. BRDFVRayMtl allows for better physically correct illumination (energy distribution) in the scene, faster rendering, and more convenient reflection and refraction parameters. Within BRDFVRayMtl you can apply different texture maps, control the reflections and refractions, add bump and displacement maps, force direct GI calculations, and choose the BRDF for the material.

The generic BRDFVRayMtl can also simulate translucency - refraction values (glossiness) and absorption (fog) can be parametrized to create realistically looking material. The material has a lot of parameters we'll cover now.

Parameters

Diffuse

  • diffuse – this is the diffuse color of the material. Note the actual diffuse color of the surface also depends on the reflection and refraction colors. See the Energy preservation parameter below.

  • roughness – this parameter can be used to simulate rough surfaces or surfaces covered with dust (for example, skin, or the surface of the moon). For more information, see The Roughness Parameter example below.


Reflection

  • reflect – reflection color. Note that the reflection color dims the diffuse surface color based on the Energy preservation option. For more information, see The Reflection Color Parameter example below.
  • fresnel – checking this option makes the reflection strength dependent on the viewing angle of the surface. Some materials in nature (glass, etc.) reflect light in this manner. Note that the Fresnel effect depends on the index of refraction as well.
  • fresnel_ior – the IOR to use when calculating Fresnel reflections. Normally this is locked to the Refraction IOR parameter, but you can unlock it for finer control. For more information, see The Fresnel Option example below.
  • hilight_glossiness – this determines the shape of the highlight on the material. Normally this parameter is locked to the Reflection glossiness value in order to produce physically accurate results.
  • reflect_glossiness – controls the sharpness of reflections. A value of 1.0 means perfect mirror-like reflection; lower values produce blurry or glossy reflections. Use the Subdivs parameter below to control the quality of glossy reflections. For more information, see The Reflection Glossiness Parameter example below.
  • reflect_subdivs – controls the quality of glossy reflections. Lower values will render faster, but the result will be more noisy. Higher values take longer, but produce smoother results.
  • reflect_dim_distance – specifies a distance after which the reflection rays will not be traced.
  • reflect_dim_distance_falloff – a fall off radius for the dim distance.
  • reflect_affect_alpha – Allows you to specify which channels are going to be affected by the reflection of the material

    • Color Only (0) – the reflection will affect only the RGB channel of the final render
    • Color+alpha (1) – this will cause the material to transmit the alpha of the reflected objects, instead of displaying an opaque alpha.
    • All channels (2) – all channels and render elements will be affected by the reflections of the material.
  • reflect_depth – the number of times a ray can be reflected. Scenes with lots of reflective and refractive surfaces may require higher values to look right.

  • reflect_exit_color – if a ray has reached its maximum reflection depth, this color will be returned without tracing the ray further.


Refraction

  • refract – refraction color. Note that the actual refraction color depends on the reflection color as well. For more information, see The Refraction Color Parameter example below.
  • refract_ior – index of refraction for the material, which describes the way light bends when crossing the material surface. A value of 1.0 means the light will not change direction. For more information, see The Refraction IOR Parameter example below.
  • refract_glossiness – controls the sharpness of refractions. A value of 1.0 means perfect glass-like refraction; lower values produce blurry or glossy refractions. Use the Subdivs parameter below to control the quality of glossy refractions. For more information, see The Refraction Glossiness Parameter example below.
  • refract_subdivs – controls the quality of glossy refractions. Lower values will render faster, but the result will be more noisy. Higher values take longer, but produce smoother results. This parameter also controls the quality of the translucent effect, if on (see below).
  • refr_interpolation_on – V-Ray can use a caching scheme similar to the irradiance map to speed up rendering of glossy refractions and translucency. Check this option to turn caching on. For more information, see The Refraction Depth Parameter example below.
  • refract_depth – the number of times a ray can be refracted. Scenes with lots of refractive and reflective surfaces may require higher values to look right.
  • refract_exit_color – if this is on, and a ray has reached the maximum refraction depth, the ray will be terminated and the exit color returned. When this is off, the ray will not be refracted, but will be continued without changes. For more information, see The Refraction Exit Color Parameter example below.
  • fog_color – the attenuation of light as it passes through the material. This option allows the user to simulate the fact that thick objects look less transparent than thin objects. Note that the effect of the fog color depends on the absolute size of the objects and is therefore scene-dependent unless the Fog system units scaling is enabled. The fog color also determines the look of the object when using translucency. For more information, see The Fog Color Parameter example below.
  • fog_mult – the strength of the fog effect. Smaller values reduce the effect of the fog, making the material more transparent. Larger values increase the fog effect, making the material more opaque. In more precise terms, this is the inverse of the distance at which a ray inside the object is attenuated with am amount equal to the Fog color. For more information, see The Fog Multiplier Parameter example below.
  • fog_bias – this parameter allows the user to change the way the fog color is applied; by adjusting this parameter, you can make thin parts of the object to appear more transparent or less transparent than normal.
  • refract_affect_shadows – this will cause the material to cast transparent shadows, depending on the refraction color and the fog color. This only works with V-Ray shadows and lights.
  • refract_affect_alpha – Allows you to specify which channels are going to be affected by the transparency of the material

    • Color Only (0) – the transparency will affect only the RGB channel of the final render
    • Color+alpha (1) – this will cause the material to transmit the alpha of the refracted objects, instead of displaying an opaque alpha. Note that currently this works only with clear (non-glossy) refractions.
    • All channels (2) – all channels and render elements will be affected by the transparency of the material
  • dispersion_on – this option enables the calculation of true light wavelength dispersion. For more information, see the Dispersion example below.
  • dispersion - (a.k.a. abbe) this option allows you to increase or decrease the dispersion effect. Lowering it widens the dispersion and vice versa.


Translucency

  • translucency – selects the algorithm for calculating translucency (also called sub-surface scattering). Note that refraction must be enabled for this effect to be visible. The possible values are:

    • None (0) – no translucency is calculated for the material;
    • Hard (wax) model (1) – this model is specifically suited for hard materials like marble;
    • Soft (water) model (2) – this model is mostly for compatibility with older V-Ray versions (1.09.x);
    • Hybrid model (3) – this is the most realistic sss model and is suitable for simulating skin, milk, fruit juice and other translucent materials.
    • Volumetric translucency (4) – 
    • Volumetric (water) model (5) – Works together with the Refraction color of the material to scatter light inside the object. It is useful for liquids and other highly transparent materials. The Refraction color and Refraction glossiness determine respectively how much of the interior of the object is visible and how rays interact with the object’s surface.
    • SSS (wax) model (6) – Can work with Refraction color/Glossiness and is useful for skin, wax, marble and other relatively opaque materials.

With V-Ray 5, update 1, the translucency modes for VRayMtl are updated based on the volumetric random walk code originally developed for the VRayScatterVolume material. However, the implementation in the VRayMtl is updated and slightly more advanced compared to VRayScatterVolume. The old translucency modes (Hard (wax) model, Soft (water) model, Hybrid model) are still there and will be shown if scenes with a VRayMtl that uses one of them is loaded. With newly created materials, only the new two modes are available.

The new translucency modes require GI with minimum 16 bounces (brute force or light cache). They also require the Affect shadows option of the material to be enabled. The old modes (Hard (wax) model, Soft (water) model, Hybrid model) support only single-bounce scattering.

As the new translucency modes perform multibounce volumetric light scattering, they require closed objects.


BF+LC (correct result)

GI is disabled

BF+None

BF+BF (3 bounces)


  • translucency_color – normally the color of the sub-surface scattering effect depends on the Fog color; this parameter allows you to additionally tint the SSS effect.

  • translucency_thickness – this limits the rays that will be traced below the surface. This is useful if you do not want or do not need to trace the whole sub-surface volume.
  • translucency_light_mult – a multiplier for the translucent effect.
  • translucency_scatter_coeff – the amount of scattering inside the object. 0.0 means rays will be scattered in all directions; 1.0 means a ray cannot change its direction inside the sub-surface volume.
  • translucency_scatter_dir - controls the direction of scattering for a ray. 0.0 means a ray can only go forward (away from the surface, inside the object); 0.5 means that a ray has an equal chance of going forward or backward; 1.0 means a ray will be scattered backward (towards the surface, to the outside of the object).

Self-Illumination

  • self_illumination – controls the emission of the surface.
  • self_illumination_gi – when enabled, the self-illumination affects global illumination rays and allows the surface to cast light on nearby objects. Note however, that it may be more efficient to use area lights or BRDFLight material for this effect.


BRDF

BRDF parameters determine the type of the highlights and glossy reflections for the material. The parameters have an effect only if the reflection color is different from black and reflection glossiness is different than 1.0.

brdf_type – this determines the type of BRDF (the shape of the highlight):

  • Phong (0) – Phong highlight/reflections
  • Blinn (1) – Blinn highlight/reflections
  • Ward (2) – Ward highlight/reflections
  • Microfacet GTR (GGX) (3) – GGX highlight/reflections


Options

  • reflect_trace – if this is off, reflections will not be traced, even if the reflection color is greater than black. You can turn this off to produce only highlights. Note that when this is off, the diffuse color will not be dimmed by the reflection color, as would happen normally.
  • refract_trace – if this is off, refractions will not traced, even if the refraction color is greater than black.
  • option_cutoff – this is a threshold below which reflections/refractions will not be traced. V-Ray tries to estimate the contribution of reflections/refractions to the image, and if it is below this threshold, these effects are not computed. Do not set this to 0.0 as it may cause excessively long render times in some cases.
  • environment_priority – this specifies how to determine the environment to use if a reflected or refracted ray goes through several materials each of which has an environment override.
  • option_double_sided – if this is checked, V-Ray will flip the normal for back-facing surfaces with this material. Otherwise, the lighting on the "outer" side of the material will be computed always. You can use this to achieve a fake translucent effect for thin objects like paper.
  • option_reflect_on_back – if this is checked, reflections will be computed for back-facing surfaces too. Note that this affects total internal reflections too (when refractions are computed).
  • option_use_irradiance_map – if this is checked, the irradiance map will be used to approximate diffuse indirect illumination for the material. If this is off, brute force GI will be used in which case the quality of the brute force GI is determined by the Subdivs parameter of the Irradiance Map. You can use this for objects in the scene which have small details and are not approximated very well by the irradiance map.
  • fog_unit_scale_on – when enabled, the fog color attenuation becomes dependent on the current system units. For more information, see Fog System Units Scaling example below.
  • use_environment_override – if this is checked, Effect ID can be used to input values for Material ID.
  • option_glossy_rays_as_gi – this specifies on what occasions glossy rays will be treated as GI rays:

    • Never (0) – glossy rays are never treated as GI rays.
    • Only for GI rays (1) – glossy rays will be treated as GI rays only when GI is being evaluated. This can speed up rendering of scenes with glossy reflections and is the default.
    • Always (2) – glossy rays are always treated as GI rays. A side effect is that the Secondary GI engine will be used for glossy rays. For example, if the primary engine is irradiance map, and the secondary is light cache, the glossy rays will use the light cache (which is a lot faster).
  • option_energy_mode – determines how the diffuse, reflection, and refraction color affect each other. V-Ray tries to keep the total amount of light reflected off a surface to be less than or equal to the light falling on the surface (as this happens in the real life). For this purpose, the following rule is applied: the reflection level dims the diffuse and refraction levels (a pure white reflection will remove any diffuse and refraction effects), and the refraction level dims the diffuse level (a pure white refraction color will remove any diffuse effects). This parameter determines whether the dimming happens separately for the RGB components or is based on the intensity:

    • RGB (0) – this mode causes dimming to be performed separately on the RGB components. For example, a pure white diffuse color and pure red reflection color will give a surface with cyan diffuse color (because the red component is already taken by the reflection).
    • Monochrome (1) – this mode causes dimming to be performed based on the intensity of the diffuse/reflection/refraction levels. For more information, see The Energy Preservation Mode Parameter example below.

Parameter Examples



Example: Roughness


This example demonstrates the effect of the Roughness parameter. Note how, as the Roughness increases, the material appears 'flatter' and dustier.



Roughness = 0.0


Roughness = 0.1


Roughness = 0.2


Roughness = 0.3


Roughness = 0.4


Roughness = 0.5


Roughness = 0.6


Roughness = 0.7


Roughness = 0.8


Roughness = 0.9


Roughness = 1.0

0.0
1.0






Example: Reflection Color


This example demonstrates how the Reflect color parameter controls the reflectivity of the material. Note that this color also acts as a filter for the Diffuse color (e.g. stronger reflections dim the diffuse component).


Example: Fresnel Option


This example demonstrates the effect of the Fresnel reflections option. Note how the strength of the reflection varies with the Fresnel IOR of the material. For this example, the Reflect color is pure white (255, 255, 255).


Reflect = 0, 0, 0

Reflect = 51, 51, 51

Reflect = 102, 102, 102

Reflect = 153, 153, 153

Reflect = 204, 204, 204

Reflect = 255, 255, 255

Black (0, 0, 0)
White (255, 255, 255)


Fresnel IOR = 1.6


Fresnel IOR = 2.2


Fresnel IOR = 2.8


Fresnel IOR = 3.4


Fresnel IOR = 4.0


Fresnel IOR = 4.6


Fresnel IOR = 5.2


Fresnel IOR = 5.8

Fresnel IOR = 6.4


Fresnel IOR = 7.0


Fresnel IOR = 7.6

1.6
7.6





Example: Reflection Glossiness

This example demonstrates how the Glossiness parameter controls the highlights and reflection blurriness of the material. Fresnel IOR = 3.5.


Example: Reflection Depth


This example demonstrates the effect of the reflection Max depth parameter.


Glossiness = 0.0

Glossiness = 0.1

Glossiness = 0.2

Glossiness = 0.3

Glossiness = 0.4

Glossiness = 0.5

Glossiness = 0.6

Glossiness = 0.7

Glossiness = 0.8

Glossiness = 0.9

Glossiness = 1.0

0.0
1.0


Reflection Max depth = 1


Reflection Max depth = 2


Reflection Max depth = 3


Reflection Max depth = 4


Reflection Max depth = 5


Reflection Max depth = 10

1
10





Example: Refraction Color


This example demonstrates the effect of the Refract color parameter to produce glass materials. For the images in this example, the material has a gray Diffuse color, white Reflect color, and the Fresnel Reflections option is enabled.


Example: Refraction IOR


This example demonstrates the effect of the Refraction IOR parameter. Note how light bends more as the IOR deviates from 1.0. When the index of refraction (IOR) is 1.0, the render produces a transparent object. Note, however, that in the case of transparent objects, it might be better to assign an opacity map to the material rather than use refraction.



Refraction Color = 0, 0, 0


Refraction Color = 26, 26, 26


Refraction Color = 51, 51, 51


Refraction Color = 77, 77, 77


Refraction Color = 102, 102, 102


Refraction Color = 128, 128, 128


Refraction Color = 153, 153, 153


Refraction Color = 179, 179, 179


Refraction Color = 204, 204, 204


Refraction Color = 230, 230, 230


Refraction Color = 255, 255, 255

Black (0, 0, 0)
White (255, 255, 255)


Refraction IOR = 0.80


Refraction IOR = 1.00


Refraction IOR = 1.20


Refraction IOR = 1.40


Refraction IOR = 1.60


Refraction IOR = 1.80


Refraction IOR = 2.00


Refraction IOR = 2.20


Refraction IOR = 2.40


Refraction IOR = 2.60


Refraction IOR = 2.80

0.80
2.80


Example: Refraction Glossiness


This example demonstrates the effect of the refraction Glossiness parameter. Note how lower refraction Glossiness values blur the refractions and cause the material to appear as frosted glass.


Example: Refraction Depth


This example demonstrates the effect of the refraction Max depth parameter. Note how too low of a refraction depth produces incorrect results. Also, in the last two examples, note how areas with total internal reflection are also affected by the Reflection Max depth.



Refraction Glossiness = 0.0


Refraction Glossiness = 0.1


Refraction Glossiness = 0.2


Refraction Glossiness = 0.3


Refraction Glossiness = 0.4


Refraction Glossiness = 0.5


Refraction Glossiness = 0.6


Refraction Glossiness = 0.7


Refraction Glossiness = 0.8


Refraction Glossiness = 0.9


Refraction Glossiness = 1.0

0.0
1.0


Refraction Max depth = 1


Refraction Max depth = 2


Refraction Max depth = 3


Refraction Max depth = 4


Refraction Max depth = 5


Refraction Max depth = 10

1
10




Example: Fog Depth


This example demonstrates the effect of the Depth parameter. Translucency is set to None.

Example: Fog Color


This example demonstrates the effect of the Fog color parameter. Notice that we are changing
the hue value of the Fog color. Translucency is set to None.



Depth = 5

Depth = 2

Depth = 0.5

Depth = 0.2

Depth = 0.1

Fog color (HSV) Hue = 42

Fog color (HSV) Hue = 245

Fog color (HSV) Hue = 128

Fog color (HSV) Hue = 196

Fog color (HSV) Hue = 17




Example: Dispersion Abbe


This example demonstrates the dispersion capabilities of the V-Ray material and the effect of the Dispersion Abbe parameter.


Dispersion Abbe = 1

Dispersion Abbe = 2

Dispersion Abbe = 3


Dispersion Abbe = 4

Dispersion Abbe = 5

Dispersion Abbe = 6

Dispersion Abbe = 7


Dispersion Abbe = 8


Dispersion Abbe = 9


Dispersion Abbe = 10

1
10




Various material examples

The following examples are rendered using the BRDFVRayMtl Scenes bundle.


BRDFVRayMtl presets:



Default

Rendered using the file VRay_Default.vrscene

Aluminium

Rendered using the file VRayMtl_Aluminium.vrscene

Aluminium (Rough)

Rendered using the file VRayMtl_Aluminium_Rough.vrscene

Aluminium (Brushed)

Rendered using the file VRayMtl_Aluminium_Brushed.vrscene

Chrome

Rendered using the file VRayMtl_Chrome.vrscene

Copper

Rendered using the file VRayMtl_Copper.vrscene

Copper (Rough)

Rendered using the file VRayMtl_Copper_Rough.vrscene

Gold

Rendered using the file VRayMtl_Gold.vrscene

Gold (Rough)

Rendered using the file VRayMtl_Gold_Rough.vrscene

Iron

Rendered using the file VRayMtl_Iron.vrscene

Lead

Rendered using the file VRayMtl_Lead.vrscene

Silver

Rendered using the file VRayMtl_Silver.vrscene

Silver (Rough)

Rendered using the file VRayMtl_Silver_Rough.vrscene

Diamond

Rendered using the file VRayMtl_Diamond.vrscene

Glass

Rendered using the file VRayMtl_Glass.vrscene

Glass (Frosted)

Rendered using the file VRayMtl_Glass_Frosted.vrscene

Glass (Tinted)

Rendered using the file VRayMtl_Glass_Tinted.vrscene

Glass (Architectural)

Rendered using the file VRayMtl_Glass_Architectural.vrscene

Water

Rendered using the file VRayMtl_Water.vrscene

Chocolate

Rendered using the file VRayMtl_Chocolate.vrscene

Ceramic

Rendered using the file VRayMtl_Ceramic.vrscene

Plastic

Rendered using the file VRayMtl_Plastic.vrscene

Rubber

Rendered using the file VRayMtl_Rubber.vrscene

Red Velvet

Rendered using the file VRayMtl_Red_Velvet.vrscene

White Satin

Rendered using the file VRayMtl_White_Satin.vrscene

Pink Satin

Rendered using the file VRayMtl_Pink_Satin.vrscene

Soap Bubble

Rendered using the file VRayMtl_Soap_Bubble.vrscene



Code example



# Load scene from a file.
renderer.load(os.path.join(SCENE_PATH, 'material.vrscene'))

# Create a new BRDFVRayMtl
newBRDF = renderer.classes.BRDFVRayMtl()
# We specify solid red color
newBRDF.diffuse = vray.AColor(1.0, 0.0, 0.0)
# We also make the material reflective with red color
newBRDF.reflect = vray.AColor(1.0, 0.0, 0.0)

newMaterial = renderer.classes.MtlSingleBRDF()
newMaterial.brdf = newBRDF

newNode = renderer.classes.Node()
newNode.material = newMaterial
newNode.geometry = renderer.plugins['CubeShape@mesh2']
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0))
// Load scene from a file.
renderer.load("material.vrscene");

// Create a new BRDFVRayMtl
BRDFVRayMtl newBRDF = renderer.newPlugin<BRDFVRayMtl>();
// We specify solid red color
newBRDF.set_diffuse(AColor(1.0f, 0.0f, 0.0f));
// We also make the material reflective with red color 
newBRDF.set_reflect(AColor(1.0f, 0.0f, 0.0f));

MtlSingleBRDF newMaterial = renderer.newPlugin<MtlSingleBRDF>();
newMaterial.set_brdf(newBRDF);

Node newNode = renderer.newPlugin<Node>();
newNode.set_material(newMaterial);
newNode.set_geometry(renderer.getPlugin("CubeShape@mesh2"));
newNode.set_transform(Transform(Matrix(1), Vector(-15, 0, 0)));
// Load scene from a file.
renderer.Load("material.vrscene");

// Create a new BRDFVRayMtl
BRDFVRayMtl newBRDF = renderer.NewPlugin<BRDFVRayMtl>();
// We specify solid red color
newBRDF.Diffuse = new Color(1.0f, 0.0f, 0.0f);
// We also make the material reflective with red color 
newBRDF.Reflect = new Color(1.0f, 0.0f, 0.0f);

MtlSingleBRDF newMaterial = renderer.NewPlugin<MtlSingleBRDF>();
newMaterial.Brdf = newBRDF;

Node newNode = renderer.NewPlugin<Node>();
newNode.Material = newMaterial;
newNode.Geometry = renderer.GetPlugin("CubeShape@mesh2");
newNode.Transform = new Transform(new Matrix(1), new Vector(-15, 0, 0));
// Load scene from a file synchronously.
renderer.loadSync("material.vrscene");

// Create a new BRDFVRayMtl
var newBRDF = new renderer.classes.BRDFVRayMtl();
// We specify diffuse red color
newBRDF.diffuse = new vray.Color(1.0, 0.0, 0.0);
// We also make the material reflective with red color 
newBRDF.reflect = new vray.Color(1.0, 0.0, 0.0);

var newMaterial = new renderer.classes.MtlSingleBRDF();
newMaterial.brdf = newBRDF;

var newNode = renderer.classes.Node();
newNode.material = newMaterial;
newNode.geometry = renderer.plugins["CubeShape@mesh2"];
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0));

V-Ray Light Material


The VRayLightMtl produces self-illuminating surfaces. When we want to have self-emitting masterial, we use the plugin called BRDFLight. When we make a light geometry, we use the LightMesh plugin

This scene is rendered using this scene bundle. Notice the comments in the file "vrscenes/mtl_light.vrscene".

Parameters

  • color - The self-illumination color
  • colorMultiplier - Color Multiplier
  • transparency - Transparency texture of the BRDF
  • doubleSided - If false, the light color is black for back-facing surfaces
  • emitOnBackSide - Emit on back side
  • channels - Render channels the result of this BRDF will be written to
  • compensateExposure - Compensate camera exposure
  • multiplyByOpacity - When enabled the color of the light brdf is multiplied by the brdf's opacity (inverse of the brdf's transparency)


Examples


# Load scene from a file.
renderer.load(os.path.join(SCENE_PATH, 'material.vrscene'))

# Create a new BRDFLight
newBRDF = renderer.classes.BRDFLight()
# We specify solid red color
newBRDF.color = vray.AColor(1.0, 0.0, 0.0)
 
newMaterial = renderer.classes.MtlSingleBRDF()
newMaterial.brdf = newBRDF
 
newNode = renderer.classes.Node()
newNode.material = newMaterial
newNode.geometry = renderer.plugins['CubeShape@mesh2']
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0))
// Load scene from a file.
renderer.load("material.vrscene");

// Create a new BRDFLight
BRDFLight newBRDF = renderer.newPlugin<BRDFLight>();
// We specify solid red color
newBRDF.set_color(AColor(1, 0, 0));

MtlSingleBRDF newMaterial = renderer.newPlugin<MtlSingleBRDF>();
newMaterial.set_brdf(newBRDF);

Node newNode = renderer.newPlugin<Node>();
newNode.set_material(newMaterial);
newNode.set_geometry(renderer.getPlugin("CubeShape@mesh2"));
newNode.set_transform(Transform(Matrix(1), Vector(-15, 0, 0)));
// Load scene from a file.
renderer.Load("material.vrscene");

// Create a new BRDFLight
BRDFLight newBRDF = renderer.NewPlugin<BRDFLight>();
// We specify solid red color
newBRDF.Color = new AColor(1, 0, 0);

MtlSingleBRDF newMaterial = renderer.NewPlugin<MtlSingleBRDF>();
newMaterial.Brdf = newBRDF;

Node newNode = renderer.NewPlugin<Node>();
newNode.Material = newMaterial;
newNode.Geometry = renderer.GetPlugin("CubeShape@mesh2");
newNode.Transform = new Transform(new Matrix(1), new Vector(-15, 0, 0));
// Load scene from a file synchronously.
renderer.loadSync("material.vrscene");

// Create a new BRDFLight
var newBRDF = new renderer.classes.BRDFLight();
// We specify diffuse red color
newBRDF.color = new vray.AColor(1.0, 0.0, 0.0);

var newMaterial = new renderer.classes.MtlSingleBRDF();
newMaterial.brdf = newBRDF;

var newNode = renderer.classes.Node();
newNode.material = newMaterial;
newNode.geometry = renderer.plugins["CubeShape@mesh2"];
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0));

V-Ray Blend Material


BRDFLayered can be used to layer several V-Ray compatible materials in an efficient manner. It can be used to create complex materials like car paints, human skin (when used with VRayFastSSS, which we'll talk about later, as a base material), etc.

An advantage of BRDFLayered is that you can use the VRayMtl Select render element to split the different sub-materials of BRDFLayered into different render elements.

BRDFLayered takes a base material and applies other materials (coatings) on top of it. This works like a stack, where each coat material blends between its own shading and that of the materials below it in the stack.

In order to use it, we need the BRDFLayered plugin, which contains a collection of brdfs and weights to blend them.

Parameters

  • brdfs - List of BRDFs to blend
  • weights - List of weights to multiply the contribution of each BRDF. The indices in this list correspond to the indices in the previous one.
  • transparency
  • transparency_tex
  • transparency_tex_mult
  • additive_mode - Whether to enable Additive (Shellac) mode. Shellac material mixes two materials by superimposing one over the other. In this mode we can produce an over-burnt color and the results are not physically realistic.
  • channels - List of render channels the result of this BRDF will be written to


Examples

Here's an example of the Shellac mode mixing:

Code example


# Load scene from a file.
renderer.load(os.path.join(SCENE_PATH, 'material.vrscene'))

# Create a bitmap buffer which can load data from a file
newBitmap = renderer.classes.BitmapBuffer()
newBitmap.file = os.path.join('assets', 'bricks01.jpg')

# TexBitmap is used for file-based texturing. Other Tex{*} plugins offer procedural and combination textures
newTexture = renderer.classes.TexBitmap()
# Set the texture to use the loaded buffer
newTexture.bitmap = newBitmap

# Create a new BRDFVRayMtl
diffuseBRDF = renderer.classes.BRDFVRayMtl()
# We specify a bricks texture
diffuseBRDF.diffuse = newTexture

# Create a new BRDFVRayMtl
reflectBRDF = renderer.classes.BRDFVRayMtl()
# We also make the material reflective with white color, semi-transparent
reflectBRDF.diffuse = vray.AColor(1.0, 0.0, 0.0, 0.5)
reflectBRDF.reflect = vray.AColor(1.0, 1.0, 1.0, 0.5)

# Create a new BRDFLayered material
newMaterial = renderer.classes.BRDFLayered()
# Assign the previously created BRDFs
newMaterial.brdfs = [diffuseBRDF, reflectBRDF]
# Assign equal weights for blending them
newMaterial.weights = [vray.AColor(0.5, 0.5, 0.5), vray.AColor(0.5, 0.5, 0.5)]

newNode = renderer.classes.Node()
newNode.material = newMaterial
newNode.geometry = renderer.plugins['CubeShape@mesh2']
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0))
// Load scene from a file.
renderer.load("material.vrscene");

// Create a bitmap buffer which can load data from a file
BitmapBuffer newBitmap = renderer.newPlugin<BitmapBuffer>();
newBitmap.set_file("assets" PATH_DELIMITER "bricks01.jpg");

// TexBitmap is used for file-based texturing. Other Tex{*} plugins offer procedural and combination textures
TexBitmap newTexture = renderer.newPlugin<TexBitmap>();
// Set the texture to use the loaded buffer
newTexture.set_bitmap(newBitmap);

// Create a new BRDFVRayMtl
BRDFVRayMtl diffuseBRDF = renderer.newPlugin<BRDFVRayMtl>();
// We specify a bricks texture
diffuseBRDF.set_diffuse(newTexture);

// Create a new BRDFVRayMtl
BRDFVRayMtl reflectBRDF = renderer.newPlugin<BRDFVRayMtl>();
// We also make the material reflective with white color, semi-transparent
reflectBRDF.set_diffuse(AColor(1.0f, 0.0f, 0.0f, 0.5f));
reflectBRDF.set_reflect(AColor(1.0f, 1.0f, 1.0f, 0.5f));

// Create a new BRDFLayered material
BRDFLayered newMaterial = renderer.newPlugin<BRDFLayered>();
ValueList brdfsList;
brdfsList.push_back(Value(diffuseBRDF));
brdfsList.push_back(Value(reflectBRDF));
// Assign the previously created BRDFs
newMaterial.set_brdfs(brdfsList);
ValueList weightsList;
weightsList.push_back(Value(AColor(0.5f, 0.5f, 0.5f)));
weightsList.push_back(Value(AColor(0.5f, 0.5f, 0.5f)));
// Assign equal weights for blending them
newMaterial.set_weights(weightsList);

Node newNode = renderer.newPlugin<Node>();
newNode.set_material(newMaterial);
newNode.set_geometry(renderer.getPlugin("CubeShape@mesh2"));
newNode.set_transform(Transform(Matrix(1), Vector(-15, 0, 0)));
// Load scene from a file.
renderer.Load("material.vrscene");

// Create a bitmap buffer which can load data from a file
BitmapBuffer newBitmap = renderer.NewPlugin<BitmapBuffer>();
newBitmap.File = Path.Combine("assets", "bricks01.jpg");

// TexBitmap is used for file-based texturing. Other Tex{*} plugins offer procedural and combination textures
TexBitmap newTexture = renderer.NewPlugin<TexBitmap>();
// Set the texture to use the loaded buffer
newTexture.Bitmap = newBitmap;

// Create a new BRDFVRayMtl
BRDFVRayMtl diffuseBRDF = renderer.NewPlugin<BRDFVRayMtl>();
// We specify a bricks texture
diffuseBRDF.Diffuse = newTexture;

// Create a new BRDFVRayMtl
BRDFVRayMtl reflectBRDF = renderer.NewPlugin<BRDFVRayMtl>();
// We also make the material reflective with white color, semi-transparent
reflectBRDF.Diffuse = new AColor(1.0f, 0.0f, 0.0f, 0.5f);
reflectBRDF.Reflect = new AColor(1.0f, 1.0f, 1.0f, 0.5f);

// Create a new BRDFLayered material
BRDFLayered newMaterial = renderer.NewPlugin<BRDFLayered>();
// Assign the previously created BRDFs
newMaterial.Brdfs = new object[] { diffuseBRDF, reflectBRDF };
// Assign equal weights for blending them
newMaterial.Weights = new object[] { new AColor(0.5f, 0.5f, 0.5f), new AColor(0.5f, 0.5f, 0.5f) };

Node newNode = renderer.NewPlugin<Node>();
newNode.Material = newMaterial;
newNode.Geometry = renderer.GetPlugin("CubeShape@mesh2");
newNode.Transform = new Transform(new Matrix(1), new Vector(-15, 0, 0));
// Load scene from a file synchronously.
renderer.loadSync("material.vrscene");

// Create a bitmap buffer which can load data from a file
var newBitmap = renderer.classes.BitmapBuffer();
newBitmap.file = path.join("assets", "bricks01.jpg");
  
// TexBitmap is used for file-based texturing. Other Tex{*} plugins offer procedural and combination textures
var newTexture = renderer.classes.TexBitmap();
// Set the texture to use the loaded buffer
newTexture.bitmap = newBitmap;
  
// Create a new BRDFVRayMtl
var diffuseBRDF = new renderer.classes.BRDFVRayMtl();
// We specify a bricks texture
diffuseBRDF.diffuse = newTexture;
  
// Create a new BRDFVRayMtl
var reflectBRDF = new renderer.classes.BRDFVRayMtl();
// We also make the material reflective with white color, semi-transparent
reflectBRDF.diffuse = new vray.AColor(1.0, 0.0, 0.0, 0.5);
reflectBRDF.reflect = new vray.AColor(1.0, 1.0, 1.0, 0.5);
  
// Create a new BRDFLayered material
var newMaterial = new renderer.classes.BRDFLayered();
// Assign the previously created BRDFs
newMaterial.brdfs = [diffuseBRDF, reflectBRDF];
// Assign equal weights for blending them
newMaterial.weights = [new vray.AColor(0.5, 0.5, 0.5), new vray.AColor(0.5, 0.5, 0.5)];

var newNode = renderer.classes.Node();
newNode.material = newMaterial;
newNode.geometry = renderer.plugins["CubeShape@mesh2"];
newNode.transform = vray.Transform(vray.Matrix(1), vray.Vector(-15, 0, 0));

  • No labels
Was this helpful?