Imain purpose is to provide real-time previews of how each noise layer—or their combinations—appears in 2D space, making it easier to debug, fine-tune, and design procedural terrains.
Loading may take some time...
Click Window -> Noise Visualizer 2D to open the tool
Draw ProceduralSurface to the window
Click each layer to preview, or click Show All Layers to preview the combined effect
Zoom and pan controls for detailed inspection of noise patterns.
Customizable color gradients for better noise pattern visualization.
Layer editing capabilities and combined multi-layer preview functionality.
NoiseVisualizer 2D Key Features
- Integration with ProceduralSurface — Targets a specific ProceduralSurface instance and inspects its private noiseLayers field via reflection. Supports all noise types under ProceduralSurface.NoiseType.
- 2D Texture Preview — Samples noise values into a Texture2D grid; each pixel represents an (x,z) position in noise space. Values are normalized to [0, 1] and mapped via Color.Lerp(lowColor, highColor).
- Layer Control — Lists every noise layer with toggle and preview buttons to visualize single or combined layers.
- Combined Preview with Noise-Modulated Weights — Each layer’s contribution is scaled by its weight (possibly modulated via NoiseLayer.GetWeight), reproducing the same weighted blending logic used at runtime in CombinedSurfaceJob.
- Interactive Navigation — Zoom (scroll wheel / slider 0.2×–2×), pan (right-click drag), and reset view controls.
- Customization — User-defined low/high colors (default black→white) and adjustable resolution (previewSize = 256).
Generating a Layer Preview — For each pixel (x,y): map into noise space, call GenerateNoiseValue(layer, position), normalize via Mathf.InverseLerp(-0.5, 0.5, value), and map to Color.Lerp(lowColor, highColor).
▼ Click to see the detailed Code (GenerateLayerPreview)
private void GenerateLayerPreview(NoiseLayer layer)
{
for (int y = 0; y < previewSize; y++)
{
for (int x = 0; x < previewSize; x++)
{
float nx = (x / (float)previewSize) * 10;
float ny = (y / (float)previewSize) * 10;
nx = (nx * zoom) + panOffset.x;
ny = (ny * zoom) + panOffset.y;
float noiseValue = GenerateNoiseValue(layer, new Vector3(nx, 0, ny));
Color color = Color.Lerp(lowColor, highColor, noiseValue);
pixels[y * previewSize + x] = color;
}
}
previewTexture.SetPixels(pixels);
previewTexture.Apply();
}
▼ Click to see the detailed Code (GenerateCombinedPreview)
private void GenerateCombinedPreview(List layers)
{
for (int y = 0; y < previewSize; y++)
{
for (int x = 0; x < previewSize; x++)
{
float nx = (x / (float)previewSize) * 10f;
float ny = (y / (float)previewSize) * 10f;
nx = (nx * zoom) + panOffset.x;
ny = (ny * zoom) + panOffset.y;
float combinedNoise = 0f;
float totalWeight = 0f;
foreach (var layer in layers)
if (layer.enabled)
totalWeight += layer.GetWeight(new Vector3(nx, 0f, ny));
foreach (var layer in layers)
if (layer.enabled)
combinedNoise += GenerateNoiseValue(layer, new Vector3(nx, 0f, ny))
* (layer.GetWeight(new Vector3(nx, 0f, ny)) / totalWeight);
combinedNoise = Mathf.Max(combinedNoise, targetSurface.minHeight);
Color color = Color.Lerp(lowColor, highColor, combinedNoise);
pixels[y * previewSize + x] = color;
}
}
previewTexture.SetPixels(pixels);
previewTexture.Apply();
}
- Aid — See each noise layer before applying it to the 3D mesh.
- Authoring Tool — Easily tune frequency, octaves, and persistence.
- Consistency — Uses the same noise generators as CombinedSurfaceJob for matching runtime results.
- Interactivity & UX — Zoom, pan, toggle and color customization ensure fluid workflow.
- Iterative Design — Evolved from single-layer to multi-layer previews with real-time feedback and GIF demos.