Tool 6: Create Difference Map

The “CreateDiffMap” tool is a very versatile tool that allows you to perform operations on each pixel of your selected textures. It has the basic math types along with difference types and interpolation types. The operations can be limited to masked areas. The results can be inverted, scaled and ramped.

The mask system includes support for rdMasks which contain random scale and rotation matched to the masks noise layer. The noise creation tool will be included in version 1.1 of rdTexTools.


Area1: Texture Details

The options here are for specifying the new textures size, re-size interpolation type (if any) and the Output name.

Texture Size Specify the size of your DiffMap texture here.

Resize Technique The same as the re-size interpolation types.

Texture Format The pixel format to use for the new texture – if you specify a grey-scale format here, the output of the Difference will be an averaged channel output. If you specify a RGB format the output of the Difference is each channels difference in their output channel.

Output Folder The folder where you want your new texture. This defaults to the current folder in the content browser if the tool was opened from there, or the location of the current texture in the Texture Editor if opened from there.

Output Name The name for your new texture. If the file exists, the name will be drawn in red and the overwrite tickbox will be enabled.

Channels You can select which of the textures channels to use to calculate the difference with by ticking them in this section.

Tolerance This is the amount of tolerance for detecting a “difference”. This defaults to 0.001 – but for 8bit data the finest resolution per channel is 0.0039, for 6bit channels it’s 0.015 and for 5bit channels it’s 0.031. For Float formats the accuracy is much higher – like 0.000015 for a 16bit float.


Area2: Textures and Mask

These options specify the source textures.

Texture 1 The base source texture.

Repeats You can use the default “Fit to Texture” which fits the source textures to the output size, or repeat the texture x times in the output texture. This can be used to create tiled sub-textures for mixing with DeTile routines (see the MS Landscape tutorial and the DeTiling tutorial).

Texture 2 The comparison source texture – or

Solid Color A constant color to use as the comparison to Texture1

Mask Optional Mask texture for output with a drop-down option to select the channel to use if it’s an RGB texture, or specify that it’s an rdMask that contains scale and rotation data too.

Mask Scale The scale at which your optional Mask is used at. If you specify 0.5 as the scale, the mask will be twice as big (and only cover 1/4 of the texture). If you specify 2.0 the mask will be repeated twice…

Wrap Mask You can either wrap rotated/scaled source pixels around the sides (option is ticked) or just read the clipped edges and use those pixel colors.

Rot Amount The scale of any source data rotation used with rdMask random rotation. The default is 2PI which gives 360 degrees – using small numbers such as 0.1 – 0.5 when using smooth rotation maps gives a nice smooth curve to the source texture data while using the full 6.283 is good for the hard rotations.

Scale Amount The amount of scale to apply to the source data. 0.0 is no scale, 0.5 is normal, 0.25 is twice as big, 1.0 is half the size.

With Wrapping ticked

With Wrapping un-ticked

For more information on using rdMasks, see the Using rdMasks tutorial or the Removing Tile Patterns tutorial.


Area3: Difference Type

The option here specifies the type of processing to do for the difference map.

Difference Type The following types of process are supported:

  • None – just passes through the first texture source data
  • Difference – creates a mask with pixel values expressing the difference between the two textures or texture and solid color. ( 0.5=unchanged, less is darker, more is lighter)
  • HueDifference – the same as the Difference type but using HSV calculations rather than RGB. ( R=H,G=S,B=V – 0.5=unchanged, less is darker, more is lighter)
  • Color Mask – draws white pixels where the texture matches the second texture or solid color and black where it does not. (unchanged=0.0, changed=1.0)
  • Soft Color Mask – Similar to the Color Mask but renders the amount of difference down to black. (unchanged=1.0, changed=variation amount (1.0-0.0)
  • Greater – Renders white when the texture1 pixel value is greater than texture2 or the solid color, black when less.
  • Soft Greater – The same as Greater but maps the variation rather than just black and white.
  • Less – Renders white when the texture1 pixel value is less than texture2 or the solid color, black when greater.
  • Soft Less – The same as Less but maps the variation rather than just black and white.
  • Subtraction Map (Texture1-Texture2)
  • Addition Map (Texture1+Texture2)
  • DiffAddition Map (Texture1+(Texture2-0.5))
  • Multiplication Map (Texture1*Texture2) – Decreases the amount (is between 0.0 and 1.0)
  • Division Map (Texture1/Texture2) – Increases the amount
  • Interpolate Map (Texture2) – passes through texture 1 or 2 depending on the mask

Area4: Results Settings

Invert This option inverts the result data – if it was 1.0 it will now be 0.0 etc.

Scale Scales the data by the specified amount

Ramp Ramps the data up or down by the specified amount


Area5: Misc Settings

Open new Texture Having this option ticked will open the newly created texture into the Texture Editor and give it focus.

Don’t Close Win Keep the CreateDiffMap Window open after you have created a difference map.

Stats This displays the stats collected when you click the “Stats” button. It’s an easy way to find how different two textures are, down to the channels. Useful when comparing outputs from original and optimized textures.

The results you see depend on the source textures format and which channels you have selected.

For an RGB texture, the stats will display with both RGB and HSV details of the differences.

For an RGB texture with one of the channels (not including alpha), the stats will display with only RGB details of the differences along with the selected channels individual details.

For a Greyscale texture or an RGB with only one channel selected, the stats will display the details of the single greyscale value.