---
title: "Textures Color Modifications and Combinations"
canonical: "https://documentation.chaos.com/space/APPSDK/132679069/Textures%20Color%20Modifications%20and%20Combinations"
format: markdown
---
In this chapter we'll cover some textures that modify and combine colors.

## **TexAColorOp**

---

One of the most used combination [plugins](https://docs-chaos.atlassian.net/wiki/spaces/APPSDK/pages/132811190). It has two input AColor textures, two optional multiplier textures, an optional separate alpha channel input texture and a lot of output textures: sum, difference, product, division, min, max, intensity, power and single color channel outputs.

### Parameters

- **color_a** - The first color
- **color_b** - The second color
- **mult_a** - Multiplier for the first color
- **mult_b** - Multiplier for the second color
- **result_alpha** - The alpha for the result; if not specified, the resulting alpha taken from the first color)
- **mode** - Which output should be considered as the output of the main texture (0 - result_a, 1 - result_b, 2 - product, 3 - sum, 4 - difference, 5 - power, 6 - division, 7 - Minimum, 8 - Maximum, 9 - absolute difference), 10 - Lower intensity color, 11 - Greater intensity color
- **product** - `(color_a*mult_a)*(color_b*mult_b)`
- **division** - `(color_a*mult_a)/(color_b*mult_b)`
- **minimum** - `Min(color_a*mult_a , color_b*mult_b)`
- **maximum** - `Max(color_a*mult_a , color_b*mult_b)`
- **sum** - `(color_a*mult_a)+(color_b*mult_b)`
- **difference** - `(color_a*mult_a)-(color_b*mult_b)`
- **result_a** - `color_a*mult_a`
- **result_b** - `color_b*mult_b`
- **red** - `(color_a*mult_a).r`
- **green** - `(color_a*mult_a).g`
- **blue** - `(color_a*mult_a).b`
- **alpha** - `(color_a*mult_a).a`
- **intensity** - `mult_a*(color_a.r+color_a.g+color_a.b)/3.0`
- **power** - `(color_a*mult_a)^mult_b`


### **Example**

![image](media://83b9aab0-15d6-454b-9f72-cb76069be523)


<span style="color: #202124">***The middle section of the image ***</span>*is the result of multiplying ****Texture A**** (left) by ****Texture B**** (right).*

### **Code**

** **

<details>
<summary>Python</summary>

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

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

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

# Create a new TexAColorOp to combine the textures
combinedTexture = renderer.classes.TexAColorOp()
# Assign the input textures
combinedTexture.color_a = newTexture
combinedTexture.color_b = newTexture2
combinedTexture.mode = 2   # product mode

diffuseBRDF = renderer.classes.BRDFDiffuse()
diffuseBRDF.color_tex = combinedTexture

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

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))
```
</details>

<details>
<summary>C++</summary>

```c++
// Load scene from a file.
renderer.load("material.vrscene");

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

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

// Create a new TexAColorOp to combine the textures
TexAColorOp combinedTexture = renderer.newPlugin<TexAColorOp>();
// Assign the input textures
combinedTexture.set_color_a(newTexture);
combinedTexture.set_color_b(newTexture2);
combinedTexture.set_mode(2);   // product mode

BRDFDiffuse diffuseBRDF = renderer.newPlugin<BRDFDiffuse>();
diffuseBRDF.set_color_tex(combinedTexture);

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

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)));
```
</details>

<details>
<summary>C#.NET</summary>

```csharp
// Load scene from a file.
renderer.Load("material.vrscene");

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

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

// Create a new TexAColorOp to combine the textures
TexAColorOp combinedTexture = renderer.NewPlugin<TexAColorOp>();
// Assign the input textures
combinedTexture.ColorA = newTexture;
combinedTexture.ColorB = newTexture2;
combinedTexture.Mode = 2;   // product mode

BRDFDiffuse diffuseBRDF = renderer.NewPlugin<BRDFDiffuse>();
diffuseBRDF.ColorTex = combinedTexture;

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

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));
```
</details>

<details>
<summary>Node.js</summary>

```javascript
// Load scene from a file synchronously.
renderer.loadSync("material.vrscene");

var newBitmap = renderer.classes.BitmapBuffer();
newBitmap.file = path.join("assets", "bricks01.jpg");
var newTexture = renderer.classes.TexBitmap();
newTexture.bitmap = newBitmap;
  
var newBitmap2 = new renderer.classes.BitmapBuffer();
newBitmap2.file = path.join("assets", "Wood_Diff.jpg");
var newTexture2 = new renderer.classes.TexBitmap();
newTexture2.bitmap = newBitmap2;
  
// Create a new TexAColorOp to combine the textures
var combinedTexture = new renderer.classes.TexAColorOp();
// Assign the input textures
combinedTexture.color_a = newTexture;
combinedTexture.color_b = newTexture2;
combinedTexture.mode = 2;   // product mode
  
var diffuseBRDF = new renderer.classes.BRDFDiffuse();
diffuseBRDF.color_tex = combinedTexture;

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

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));
```
</details>

## **TexBlend**

---

Blend two input AColor textures using another float texture for weighting (or a constant value, of course).

### Parameters

- **color_a** - input texture A
- **color_b** - input texture B
- **blend_amount** - blend coefficient (could be a texture)
- **composite** - If true, color_b will be composited over color_a with the given weight, taking its alpha into account

###   
**Example**


![image](media://c4fb1c77-9ff2-4f2a-a65a-b43d712f97d7)

<span style="color: #202124">***The middle section of the image represents a mix between***</span>*** Texture Top (left) and Color Bottom (right).***


## **TexClamp**

---

Clamp an input texture between some min and max values.

### Parameters

- **texture** - Input texture
- **min_color** - Minimum value to sample from texture
- **max_color** - Maximum value to sample from texture

##   
**TexCondition**

---

Switch between two AColor textures depending on some type of comparison between two float textures.

### Parameters

- **operation** - The condition check: 0 - equal, 1 - not equal, 2 - greater than, 3 - greater or equal, 4 - less than, 5 - less or equal
- **op_a** - The first number to compare
- **op_b** - The second number to compare
- **result_true** - The color to return if the condition is true
- **result_false** - The color to return if the condition is false
- **color** - The resulting color


### **Example**

Here we combine the checkered and marble textures, and output black where their contours match.

![image](media://0427dcc3-f874-4f8e-875b-60e33119371f)



## **TexFloatOp**

---

Similar to TexAColorOp for floats, it has a whole lot of functions.

### Parameters

- **float_a** - The first number
- **float_b** - The second number
- **product** - `float_a*float_b`
- **ratio** - `float_a/float_b`
- **sum** - `float_a+float_b`
- **difference** - `float_a-float_b`
- **power** - The first number raised to the power of the second number
- **sin** - `sin(float_a*float_b)`
- **cos** - `cos(float_a*float_b)`
- **asin** - `asin(float_a*float_b)`
- **acos** - `acos(float_a*float_b)`
- **atan** - `atan(float_a*float_b)`
- **atan2** - `atan2(float_b, float_a)`, computes the arctangent of `float_b/float_a`
- **min** - `min(float_a, float_b)`
- **max** - `max(float_a, float_b)`
- **abs** - `abs(float_a)`
- **ceil** - `ceil(float_a)`
- **exp** - `exp(float_a)`
- **floor** - `floor(float_a)`
- **log** - `log(float_a)`
- **log10** - `log10(float_a)`
- **sqrt** - square root of float_a
- **fmod** - `fmod(float_a, float_b)`
- **average** - `(float_a+float_b)*0.5`
- **tan** - `tan(float_a)`
- **mode** - Determines what output to use when no output parameter is specified. Useful if the type of the operation needs to be animatable.


## **TexGradient, TexGradRamp, TexRamp**

---

Gradient textures.

### Parameters

- **compatibility_with** - This is used to differentiate between textures exported from different applications. The value means : 0 - 3ds Max (this is also the default), 1 - Maya, ...
- **alpha_from_intensity** - If 2 - the alpha is forced to 1.0f; 1 - the resulting alpha is the color intensity (if compatibility_with is 0) or the color luminance (if compatibility_with is 1); 0 - the alpha is taken from the bitmap alpha
- **invert** - If true, the resulting texture color will be inverted
- **invert_alpha** - If true and invert is on, the resulting texture alpha will be inverted too. If false, just the color will be inverted
- **color_mult** - A multiplier for the texture color
- **color_offset** - An additional offset for the texture color
- **alpha_mult** - A multiplier for the texture alpha
- **alpha_offset** - An additional offset for the texture alpha
- **nouvw_color** - The color when there are no valid uvw coordinates
- **color** - The resulting color
- **out_transparency** - The resulting transparency
- **out_alpha** - The resulting alpha
- **out_intensity** - The resulting intensity
- **uvwgen** - The uvw generator for the texture
- **placement_type** - The way the valid portion of the texture is applied: 0 - the whole texture is valid, 1 - crop, 2 -place
- **u** - U coordinate of the valid texture sector
- **v** - V coordinate of the valid texture sector
- **w** - Width of the valid texture sector
- **h** - Height of the valid texture sector
- **jitter** - Amount of random placement variation
- **tile_u** - If true there is horizontal tiling
- **tile_v** - If true there is vertical tiling
- **uv_noise_on** - If true the noise is enabled.
- **uv_noise_animate** - If true the noise is animated. Use "UV noise phase" to animate the noise.
- **uv_noise_amount** - UV noise amount
- **uv_noise_levels** - UV noise iterations
- **uv_noise_size** - UV noise size
- **un_noise_phase** - UV noise phase
- **positions** - positions of the given colors
- **colors** - the given colors
- **texture_map** - the texture used for mapped gradient ramp
- **gradient_type** - 0:four corner, 1:box, 2:diagonal, 3:lighting, 4:linear, 5:mapped, 6:normal, 7:pong, 8:radial, 9:spiral, 10:sweep, 11:tartan
- **interpolation** - 0:none, 1:linear, 2:expUp, 3:expDown, 4:smooth, 5:bump, 6:spike
- **noise_amount** - Distortion noise amount
- **noise_type** - 0:regular, 1:fractal, 2:turbulence
- **noise_size** - default = 1.0
- **noise_phase** - default = 0.0
- **noise_levels** - default = 4.0
- **noise_treshold_low** - default = 0.0f
- **noise_treshold_high** - default = 1.0f
- **noise_smooth** - default = 0.0f
- **gradient_position** - When 'gradient_type' is 'position' this will specify the position of color in gradient to return


### **Example**

Here's an example with gradient maps used for the wallpaper, the chair, and the tree's decorations:


## **TexHSVToRGB**

---

Convert HSV input texture to RGB.

### Parameters

- **inHsv** - Input texture in HSV format
- **color** - Output texture in RGB format


## **TexInvert**

---

Returns the complementary color of the input texture.

The following scene is rendered by using the [scene bundle](https://drive.google.com/file/d/1slNbvDpjp0kHVoKA0ccOqJvcD2m2iFCc/view?usp=sharing) and uncommenting "vrscenes/map_41 TexInvert.vrscene".


![image](media://f2f314d0-3374-43d8-9680-cc10e9ab408d)


### Parameters

- **texture** - The texture to be inverted
- **invert_alpha** - Whether to invert alpha channel also
- **color** - The inverted texture color

## **TexLayered**

---

Combine an unlimited number of textures.

### Parameters

- **compatibility_with** - This is used to differentiate between textures exported from different applications. The value means : 0 - 3ds Max (this is also the default), 1 - Maya, ...
- **alpha_from_intensity** - If 2 - the alpha is forced to 1.0f; 1 - the resulting alpha is the color intensity (if compatibility_with is 0) or the color luminance (if compatibility_with is 1); 0 - the alpha is taken from the bitmap alpha
- **invert** - If true, the resulting texture color will be inverted
- **invert_alpha** - If true and invert is on, the resulting texture alpha will be inverted too. If false, just the color will be inverted
- **color_mult** - A multiplier for the texture color
- **color_offset** - An additional offset for the texture color
- **alpha_mult** - A multiplier for the texture alpha
- **alpha_offset** - An additional offset for the texture alpha
- **nouvw_color** - The color when there are no valid uvw coordinates
- **color** - The resulting color
- **out_transparency** - The resulting transparency
- **out_alpha** - The resulting alpha
- **out_intensity** - The resulting intensity
- **textures** - Textures to layer
- **blend_modes** - 0:None, 1:Over, 2:In, 3:Out, 4:Add, 5:Subtract, 6:Multiply, 7:Difference, 8:Lighten, 9:Darken, 10:Saturate, 11:Desaturate, 12:Illuminate
- **alpha** - Texture or float for alpha coefficient


## **TexLuminance**

---

Returns a single float luminance (0.3R + 0.59G + 0.11B) from input color texture. Note that in V-Ray terms this is different from the "intensity" term, which is (0.33R + 0.33G + 0.33B).

### Parameters

- **input** - Input texture
- **luminance** - Output texture with float values


## **TexRaySwitch**

---

Use a different texture for different types of rays: shadow, GI, reflection, refraction and default.

### Parameters

- **default_texture** - This texture is used if texture is not set for specific ray type or if the ray type is unknown.
- **shadow_ray_texture** - This texture is used for shadow rays.
- **gi_ray_texture** - This texture is used for GI rays.
- **reflect_ray_texture** - This texture is used for reflection rays.
- **refract_ray_texture** - This texture is used for refraction rays.


## **TexRemap**

---

Remap an input texture color through some kind of user-defined curve.

The scene is "vrscenes/map_05 TexBitmap & TexRemap.vrscene".

![image](media://771599f3-0bef-4b34-8df1-393bed033ff5)


### Parameters

- **type** - type of conversion: 0:RemapValue, 1:RemapColor, 2:RemapHSV.
- **float_positions** - positions of the given float values
- **float_values** - the given float values
- **float_types** - interpolation types for the floats (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **color_positions** - the given float values
- **color_colors** - the given colors
- **color_types** - interpolation types for the colors (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **red_positions** - positions of the given values for the red channel
- **red_values** - the given values for the red channel
- **red_types** - interpolation types for the red channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **green_positions** - positions of the given values for the green channel
- **green_values** - the given values for the green channel
- **green_types** - interpolation types for the green channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **blue_positions** - positions of the given values for the blue channel
- **blue_values** - the given values for the blue channel
- **blue_types** - interpolation types for the blue channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **hue_positions** - positions of the given values for the hue channel
- **hue_values** - the given values for the hue channel
- **hue_types** - interpolation types for the hue channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **saturation_positions** - positions of the given values for the saturation channel
- **saturation_values** - the given values for the saturation channel
- **saturation_types** - interpolation types for the saturation channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **value_positions** - positions of the given values for the value channel
- **value_values** - the given values for the value channel
- **value_types** - interpolation types for the value channel (None - 0; Linear - 1; Smooth - 2; Spline - 3)
- **alpha_from_intensity** - If true, the resulting alpha is the color intensity; otherwise the alpha is taken from the colors
- **out_value** - the output value, depending on input_value and color params
- **out_color** - the output color, depending on input_value/input_color and float params