This project implements a Blueprint Function Library class, UNoiseGenerator
, to generate procedural noise textures. It supports multiple noise types, such as White Noise, Perlin Noise, and Voronoi Noise, with customizable parameters. The generated noise is stored as UTexture2D
assets in Unreal Engine.
- White Noise:
- Random values for each pixel.
- Perlin Noise:
- Gradient-based noise with octave and frequency control.
- Voronoi Noise:
- Generates a cell-like structure, influenced by randomly distributed nuclei.
The noise generator uses the following parameters for customization:
- Path: The folder where the generated texture will be stored.
- Name: The name of the generated asset.
- Noise Type: The type of noise (
WhiteNoise
,PerlinNoise
, orVoronoiNoise
). - Texture Size: Dimensions of the generated texture.
- Seed: Used for randomization.
- Octaves: Number of noise layers blended for detailed patterns.
- Frequency: Determines the scale of features in the noise.
- Input Parameters:
- The user specifies the input parameters using the Editor Utility Widget.
- Noise Generation:
- Depending on the selected noise type, the appropriate algorithm (e.g., Perlin, Voronoi) generates the texture data.
- Texture Creation:
- A
UTexture2D
asset is created in Unreal Engine and populated with the generated noise data.
- A
- Asset Saving:
- The texture is saved in the specified location in the project.
To use this utility in your Unreal Engine project:
- Include the
UNoiseGenerator
class in your project source files. - Set up an editor widget to provide the required input parameters.
- Use the
CreateNoise
function to generate textures.
Below is an example of how to call the CreateNoise
function:
UNoiseGenerator* NoiseGen = NewObject<UNoiseGenerator>();
UTexture2D* Texture = NoiseGen->CreateNoise(
TEXT("/Game/Textures"),
TEXT("MyNoiseTexture"),
ENoiseType::PerlinNoise,
512, // Width
512, // Height
12345, // Seed
4, // Octaves
0.01f // Frequency
);
- Generate project files and compile the code.
- Run the Editor Utility Widget.
- Fill the required parameters.
- Generate the noise.
One of each type of noise is provided in Content/Noise.
This project is intended for learning purposes and is free for personal and educational use.
The following images show the Editor Utility Widget and different noise textures: