©Anton Podvalny

Table of Contents

Introduction


In this chapter we'll cover the topic about the bump mapping technique.

The plugins with which this technique can be implemented are these three:

  • BRDFBump - Applies a bump map to some base BRDF.
  • BRDFMultiBump - Combines up to 4 bump maps.

We can also mention a related plugin - TexBlendBumpNormal. The TexBlendBumpNormal texture is similar to the standard 3ds Max Normal Map texture, but works on any V-Ray compatible geometry, including V-Ray proxies, displaced objects etc.

Parameters


BRDFBump

  • base_brdf - Base BRDF
  • bump_tex_color - Bump texture
  • bump_tex_float - Bump texture
  • bump_tex_mult - Bump amount
  • bump_tex_mult_tex - Bump amount texture
  • bump_tex - Bump texture; this is deprecated, use bump_tex_color or bump_tex_float
  • bump_shadows - true to offset the surface shading point, in addition to the normal
  • map_type - The type of the map (0 - from regular texture output, 1 - normal map in tangent space, 2 - normal map in object space, 3 - normal map in camera space, 4 - normal map in world space, 5 - from texture bump output, 6 - explicit normal)
  • normal_uvwgen - The uvw generator for the normal map texture when map_type is 1.
  • maya_compatible - When this is true the BRDFBump will try to match the Maya bump/normal mapping
  • compute_bump_for_shadows - true to compute bump mapping for shadow rays in case the material is transparent; false to skip the bump map for shadow rays (faster rendering)
  • bump_delta_scale - Scale for sampling the bitmap when map_type is 0. Normally this is tied to the ray differentials, but can be changed if necessary.
  • normal_map_mult - Multiplier applied to the normal map
  • additional_bump - Texture for additional bump effect
  • bump_map_mult - Multiplier applied to the bump map

 

BRDFMultiBump

  • base_brdf - Base BRDF
  • bump_tex_0 - Bump texture
  • bump_mult_0 - Bump multipler 0
  • map_type_0 - A list with the type of the maps (0 - from regular texture output, 1 - normal map in tangent space, 2 - normal map in object space, 3 - normal map in camera space, 4 - normal map in world space, 5 - from texture bump output, 6 - explicit normal)
  • bump_tex_1 - Bump texture
  • bump_mult_1 - Bump multipler 0
  • map_type_1 - A list with the type of the maps (0 - from regular texture output, 1 - normal map in tangent space, 2 - normal map in object space, 3 - normal map in camera space, 4 - normal map in world space, 5 - from texture bump output, 6 - explicit normal)
  • bump_tex_2 - Bump texture
  • bump_mult_2 - Bump multipler 0
  • map_type_2 - A list with the type of the maps (0 - from regular texture output, 1 - normal map in tangent space, 2 - normal map in object space, 3 - normal map in camera space, 4 - normal map in world space, 5 - from texture bump output, 6 - explicit normal)
  • bump_tex_3 - Bump texture
  • bump_mult_3 - Bump multipler 0
  • map_type_3 - A list with the type of the maps (0 - from regular texture output, 1 - normal map in tangent space, 2 - normal map in object space, 3 - normal map in camera space, 4 - normal map in world space, 5 - from texture bump output, 6 - explicit normal)
  • normal_uvwgen - The uvw generator for the normal map texture when map_type is 1.

 

TexBlendBumpNormal

  • normalMap1 – The texture to use for normal mapping. Care needs to be taken for correct gamma correction of any bitmap textures assigned here. Some software packages generate normal maps that include a 2.2 gamma correction, while other packages generate linear normal maps. The TexBlendBumpNormal texture assumes that any normal textures are in tangent UV space. The mapping channel that defines that UV space can be specified with the map channel parameter. V-Ray assumes that the blue B component is "up" for the normal map (the direction along the surface normal), which means that the "neutral" color of a normal map is RGB 128, 128, 255. This can be swapped with the green G channel using the swap red and green parameter.
  • normalMapWeight1 - Weight of first tangent space normal map.
  • normalMap2 - Second tangent space normal map.
  • normalMapWeight2 - Weight of second tangent space normal map.
  • bumpMap1 – An additional texture for bump mapping applied on top of the normal map.
  • bumpMapWeight1 - Weight of first bump map.
  • bumpMap2 - Second bump map.
  • bumpMapWeight2 - Weight of second bump map.
  • sharpen

 

Examples


BRDFBump

 

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

bumpBitmap = renderer.classes.BitmapBuffer()
bumpBitmap.file = os.path.join('assets', 'bricks01.jpg')
bumpTexture = renderer.classes.TexBitmap()
bumpTexture.bitmap = bumpBitmap

newBitmap = renderer.classes.BitmapBuffer()
newBitmap.file = os.path.join('assets', 'Wood_Diff.jpg')
newTexture = renderer.classes.TexBitmap()
newTexture.bitmap = newBitmap

brdf = renderer.classes.BRDFDiffuse()
brdf.color_tex = newTexture

# Create a new BRDFBump
bumpedBRDF = renderer.classes.BRDFBump()
# Set the diffuse material as a base material
bumpedBRDF.base_brdf = brdf
# Set the bump teture with the bricks
bumpedBRDF.bump_tex_color = bumpTexture

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

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");

BitmapBuffer bumpBitmap = renderer.newPlugin<BitmapBuffer>();
bumpBitmap.set_file("assets" PATH_DELIMITER "bricks01.jpg");
TexBitmap bumpTexture = renderer.newPlugin<TexBitmap>();
bumpTexture.set_bitmap(bumpBitmap);

BitmapBuffer newBitmap = renderer.newPlugin<BitmapBuffer>();
newBitmap.set_file("assets" PATH_DELIMITER "Wood_Diff.jpg");
TexBitmap newTexture = renderer.newPlugin<TexBitmap>();
newTexture.set_bitmap(newBitmap);

BRDFDiffuse brdf = renderer.newPlugin<BRDFDiffuse>();
brdf.set_color_tex(newTexture);

// Create a new BRDFBump
BRDFBump bumpedBRDF = renderer.newPlugin<BRDFBump>();
// Set the diffuse material as a base material
bumpedBRDF.set_base_brdf(brdf);
// Set the bump teture with the bricks
bumpedBRDF.set_bump_tex_color(bumpTexture);

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

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");

BitmapBuffer bumpBitmap = renderer.NewPlugin<BitmapBuffer>();
bumpBitmap.File = Path.Combine("assets", "bricks01.jpg");
TexBitmap bumpTexture = renderer.NewPlugin<TexBitmap>();
bumpTexture.Bitmap = bumpBitmap;

BitmapBuffer newBitmap = renderer.NewPlugin<BitmapBuffer>();
newBitmap.File = Path.Combine("assets", "Wood_Diff.jpg");
TexBitmap newTexture = renderer.NewPlugin<TexBitmap>();
newTexture.Bitmap = newBitmap;

BRDFDiffuse brdf = renderer.NewPlugin<BRDFDiffuse>();
brdf.ColorTex = newTexture;

// Create a new BRDFBump
BRDFBump bumpedBRDF = renderer.NewPlugin<BRDFBump>();
// Set the diffuse material as a base material
bumpedBRDF.BaseBrdf = brdf;
// Set the bump teture with the bricks
bumpedBRDF.BumpTexColor = bumpTexture;

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

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");

var bumpBitmap = renderer.classes.BitmapBuffer();
bumpBitmap.file = path.join("assets", "bricks01.jpg");
var bumpTexture = renderer.classes.TexBitmap();
bumpTexture.bitmap = bumpBitmap;
  
var newBitmap = new renderer.classes.BitmapBuffer();
newBitmap.file = path.join("assets", "Wood_Diff.jpg");
var newTexture = new renderer.classes.TexBitmap();
newTexture.bitmap = newBitmap;

var brdf = new renderer.classes.BRDFDiffuse();
brdf.color_tex = newTexture;

// Create a new BRDFBump
var bumpedBRDF = new renderer.classes.BRDFBump();
// Set the diffuse material as a base material
bumpedBRDF.base_brdf = brdf;
// Set the bump teture with the bricks
bumpedBRDF.bump_tex_color = bumpTexture;

var newMaterial = renderer.classes.MtlSingleBRDF();
newMaterial.brdf = bumpedBRDF;

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));

 

Here's the result of the bumpMaterial applied to a plane - it resembles a colorful piece of chocolate:

TexBlendBumpNormal

In the example shown here a metal normal map was used in the normal channel and a planks texture for the bump channel.

 

 

 

 

  • No labels