I'm trying to do some simple noise applied to a mesh inside of an IJobFor, but I'm getting a seam and I assume its due to incorrect calculation of x and/or y and the index. Any tips?
public struct HeightmapNoiseForJob : IJobFor
{
public TerrainData Data;
public NativeArray<HeightMap> HeightMap;
public void Execute(int index)
{
var x = (int)math.floor(index % Data.Size);
var y = (int)math.floor(index / Data.Size);
var offset = Data.NoiseData.Offset;
var seed = Data.NoiseData.Seed;
var noiseScale = Data.NoiseData.Scale;
if(math.ceil(noiseScale) != noiseScale)
noiseScale += 0.0001f;
var height = Data.NoiseData.Height;
var noiseMod = 1;
var inputX = x * noiseScale + seed + offset.x;
var inputY = y * noiseScale + seed + offset.y;
var value = Mathf.PerlinNoise(inputX, inputY);
value *= height;
HeightMap[index] = value;
}