5

I have a terrain generated of a Perlin Fractal Noise pattern that generates quite remarkable terrain. The problem I'm having is some veird lines going across both X and Z coordinates, I'm thinking it has to do with the fractal generation but as I generated a 2D picture of it I couln't see any artefacts. Artefact lines

The generation of the terrain is done by splitting up the terrain into chunks, which in turn are splitted up into tiles that depending on resolution has a size.

With each tile I calculate four corners in a similar manner for each corner piece:

float corner1 = mapHeight * fractal( x * tileSize +( posX * (mapSize) ) , z * tileSize +( posZ * (mapSize)) ,25000,0.5,16);

The fractal function:

float fractal(int x,int y,float gridSubs,float gain,int octaves){
  float total = 0;
  float freq = 1.0/gridSubs;
  float amp = gain;

  for(int f=0;f<octaves;f++){
    total += noise(x*freq,y*freq)*amp;
    freq *= 2.0;
    amp *= gain;
  }
  return total;
}

EDIT: I haven't really gotten a good answer as to why this is happening but one possibility is that I had some strange values for the vertices position(though I shouldn't have).

I am still trying out a few ways to render the landscape efficently without clogging my GPU with vertices. With a few tests the artefacts are minimal and as far as I know might have to do with how the simple ligthing works in Processing, I will update this if I still cannot find a way around this.

If someone still knows a simple way to reduce the impact they make on the landscape or just have a good suggestion then please post below :)

Patrick Dahlin
  • 286
  • 2
  • 5
  • 19
  • Not a real solution (more a visual hack to reduce the artifacts), apply some blur to your height map before deploying the terrain, that may let you bypass the real problem while you track it down – higuaro May 08 '14 at 14:08
  • 1
    I'm not sure exactly how your code is set up, but that looks like a discontinuity between tiles. To illustrate: If you rendered a single image of 2D noise with fixed dimensions and then tiled that image, it would have discontinuities where each image borders the next. Is there any place you're doing a modulo function (or similar) on your x,z coordinates? – Anna Dickinson May 08 '14 at 14:23

2 Answers2

0

My first impulse is to ask why you're manually computing octaves, instead of using noiseDetail?

http://www.processing.org/reference/noiseDetail_.html

If you just want more total amplitude out of your noise, multiply the output of noise by some scalar >1. If you want more detail to exist within that amplitude, increase noiseDetail.

The artifacts you're seeing are a necessary part of the fact that you're using octave-aligned perlin noise generated from the same seed and just stacking it up with no smoothing. And on top of that, some implementation-specific interpolation between generated values is going on behind the scenes. Either DO perlin noise yourself, or use the built-in perlin noise, don't try to do both.

Falkreon
  • 598
  • 5
  • 14
0

Seeing your picture, I am not sure but it smells / feels like a type casting issue.