Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TODO: Instancer, Instancer2

5. Creating materials

Exporting materials is probably the most complicated part, because it may involve complex shader networks, especially in apps with high artistic control, such as the popular DCC tools from Autodesk. Nevertheless, you can get good results even by using only a few plugins.

There are two types of plugins involved - material (names start with "Mtl") and BRDF (names start with "BRDF") plugins. BRDFs describe what happens with light when it interacts with the surface, like refraction, diffuse scattering, etc. BRDFs get plugged into material plugins, which may extend their behavior by for example combining several BRDFs or adding bump maps and so on. Finally the material plugin gets plugged into a Node that links it to a geometric object in the scene.

You should always connect a MtlSingleBRDF instance to the Node::material slot. Despite its name, the MtlSingleBRDF::brdf parameter accepts other Mtl plugins, so there is no problem with using any material before finally adding MtlSingleBRDF.

There are some material and BRDF plugins that still exist for compatibility reasons, but we don't recommend you use them. For example instead of connecting MtlDiffuse to a Node, you should create BRDFDiffuse -> MtlSingleBRDF::brdf -> Node::material. Plugins with names ending with "_ASGVIS" can also be ignored. We don't have an exhaustive list of deprecated plugins at the moment.

The workhorse of your material setups should be BRDFVRayMtl. It combines three types of effects in one plugin - diffuse, reflection and refraction (we have them in separate plugins as BRDFDiffuse, BRDFMirror and BRDFGlass respectively). You can use only one of the layers, though, by setting the colors of the others to black. The plugin splits the incoming light energy according to the colors for the three layers. For example, by default the reflection and refraction have black color, so these layers are skipped. If you set a white reflection color you will get a mirror. If you set a white refraction color you will get glass. The layers are evaluated in this order: reflection, refraction, diffuse. The amount of energy that passes to the next layer is the complementary color to the color of the layer. If you have a (0.2, 0.2, 0.2) reflection color, 20% of light the energy will go into the specular reflection and 80% will pass on to the refraction layer. If your refraction layer has color (1.0, 1.0, 1.0) all of the remaining energy will continue as refracted light, so you will get the effect of a glass material (a little reflection and full refraction of the rest). If the refraction color is (0.5, 0.5, 0.5) instead, 50% of the remaining energy will refract and 50% will scatter off from the diffuse layer. If the diffuse color is white, all of that remaining energy is scattered around the scene and if it's black all of it is absorbed (that would heat the object in the real world). So lets summarize what happens with the incoming energy with a few examples:

  • reflection=(0.1, 0.1, 0.1), refraction=(1.0, 1.0, 1.0), diffuse=(1.0, 0.0, 0.0) => 10% reflection, 90% refraction and 0% diffuse, so you won't see that red color anywhere
  • reflection=(0.1, 0.1, 0.1), refraction=(0.5, 0.5, 0.5), diffuse=(1.0, 0.0, 0.0) => 10% reflection, 45% refraction and 15% diffuse, so you will see a semi-transparent object with some red. * Note that 1/3 of the last 45% of the energy is red scattering, so actually 15% of the original energy is scattered, only in the red channel, and 30% is absorbed in the other channels.
  • reflection=(1.0, 1.0, 1.0), refraction=(0.5, 0.5, 0.5), diffuse=(1.0, 0.0, 0.0) => 100% reflection, 0% refraction and 0% diffuse, so you will see a perfect mirror - nothing is seen through it and no red
  • reflection=(0.1, 0.1, 0.1), refraction=(0.0, 0.0, 0.0), diffuse=(0.5, 1.0, 0.5) => 10% reflection, 0% refraction, 60% diffuse and 30% absorbed (no energy is absorbed in the green channel)

The absorption of energy in the diffuse layer matters for GI (global illumination). Having a closed room with pure white diffuse walls is like having a room of mirrors. V-Ray will bounce light around until it reaches its maximum GI depth and this may slow rendering down. If the walls were 88% white instead, only 7% of the original energy will remain after 20 bounces. At some point V-Ray will decide that the ray is too weak and insignificant and it will stop tracing it. V-Ray makes a lot of decisions based on light intensity, so this matters. Samples with intense light are considered more important than weak ones.

5.1. Material and BRDF plugins

...