Files
2026-06-22 16:18:34 +02:00

35 lines
1.4 KiB
C#

using System;
using UnityEngine;
namespace Game.WorldGen
{
/// <summary>
/// One height/slope texture band. Paints <see cref="layer"/> where the terrain height
/// (in world meters) and slope fall in range, with a smooth fade at the edges so adjacent
/// bands blend instead of hard-cutting. Rules are weighted + normalised per pixel.
/// You can still refine everything by hand with Unity's paint tool afterwards.
/// </summary>
[Serializable]
public class SplatRule
{
public TerrainLayer layer;
[Tooltip("Lowest terrain height (world meters) where this layer appears.")]
public float minHeightMeters = 0f;
[Tooltip("Highest terrain height (world meters) where this layer appears.")]
public float maxHeightMeters = 1000f;
[Tooltip("Soft fade width at the height edges, in meters. 0 = hard cut. Bigger = smoother blend.")]
public float heightFadeMeters = 10f;
[Range(0f, 90f), Tooltip("Min slope in degrees (0 = flat).")]
public float minSlopeDeg = 0f;
[Range(0f, 90f), Tooltip("Max slope in degrees (90 = vertical).")]
public float maxSlopeDeg = 90f;
[Range(0f, 45f), Tooltip("Soft fade width at the slope edges, in degrees.")]
public float slopeFadeDeg = 6f;
[Range(0.01f, 4f), Tooltip("Relative strength when competing with other rules on the same pixel.")]
public float weight = 1f;
}
}