WorldKit
WorldKit copied to clipboard
Perlin noise octaves have incorrect offset.
When setting the offfset of Perlin noise the sub octaves are not offset by the correct amount. The following code (in PerlinNoise.hlsl) should be changed from:
float StandardPerlinNoise(uint id, float amplitude, float2 offset){
// Calculate vector
float2 pos = IndexToFloatVector(id, HeightMapResolution);
// Calculate x and y position
float x = float(pos.x) / HeightMapResolution;
float y = float(pos.y) / HeightMapResolution;
// Generate noise
return cnoise(float2(x * amplitude + offset.x, y * amplitude + offset.y));
}
to
float StandardPerlinNoise(uint id, float amplitude, float2 offset){
// Calculate vector
float2 pos = IndexToFloatVector(id, HeightMapResolution);
// Calculate x and y position
float x = (float(pos.x) + offset.x) / HeightMapResolution;
float y = (float(pos.y) + offset.y) / HeightMapResolution;
// Generate noise
return cnoise(float2(x * amplitude , y * amplitude));
}
so that sub octaves are correctly offset by the offset value.