Skip to main content

Blend

Overview of the Blend Generator The Blend Generator in Map Generator serves as a powerful tool for merging two or more maps together using various blend algorithms. It operates similarly to the layer blending mode in graphic editors like Photoshop, where each layer contributes to the final result, with the bottom "Base" map acting as the background layer.

Use Cases:

  1. Combining Textures: Blend maps to create complex textures, such as merging a green grass mask texture with a random noise mask.

  2. Layering Effects: Apply various blending algorithms and opacities to achieve specific visual effects in your terrain or texture maps.

Properties: Each layer (excluding the Base layer) in the Blend Generator possesses two key properties:

  1. Algorithm: Determines how the layers are blended together.

  2. Opacity: Controls the opaqueness or transparency of the blending layer. A value of 0 makes the blending result invisible, while higher values increase the visibility of the effect.

Blend Algorithms:

  1. Mix: Simply blends two maps using the opacity value. The formula is { return b; }.

  2. Add: Adds the Blend layer to the Base layer, resulting in the sum of the layers, i.e., { a + b; }.

  3. Subtract: Subtracts the Blend layer from the Base layer, creating the difference { a - b; }.

  4. Multiply: Multiplies the two layers. Note that the result is often less than the input values due to values typically being less than 1, i.e., { a * b; }.

  5. Divide: The inverse of Multiply. Exercise caution as the result can often exceed 1, i.e., { a / b; }.

  6. Difference: Computes the delta value between two layers, i.e., { Mathf.Abs(a - b); }.

  7. Min: Selects the minimum value between both layers, i.e., { Mathf.Min(a, b); }. Useful for obtaining cleaner results.

  8. Max: Determines the maximum value between both layers. Experiment with Min and Max blend algorithms for potentially valuable outcomes, i.e., { Mathf.Max(a, b); }.

  9. Overlay: While typically used for image processing, Overlay can also be applied to blending height or splat maps for unique effects. The formula for Overlay is as follows:

csharpCopy code if (a > 0.5f) return 1 - 2 (1 - a) (1 - b); elsereturn 2 a b;

The Blend Generator empowers map creators to seamlessly combine maps using a variety of blending algorithms and opacities, enabling the creation of intricate textures and visual effects within their projects.