is there a simple way to save generated fractal to image? i want to look how i looks
im generating fractal heighmaps, but i need them also in image format, for minimaps and etc
ImageRaster (in core) and/or ImagePainter (plugin available through the sdk).
ok, first i understand that i have to set every pixel of hte image manualy, is that correct?
second:
[java]public void test1() {
FractalSum fractal = new FractalSum();
fractal.setRoughness(0.7f);
fractal.setFrequency(1.0f);
fractal.setAmplitude(1.1f);
fractal.setLacunarity(2.12f);
fractal.setOctaves(8);
fractal.setScale(0.02125f);
fractal.addModulator(new NoiseModulator() {
@Override
public float value(float... in) {
return ShaderUtils.clamp(in[0] * 0.7f + 0.5f, 0, 1);
}
});
FilteredBasis ground = new FilteredBasis(fractal);
PerturbFilter perturb = new PerturbFilter();
perturb.setMagnitude(0.319f);
OptimizedErode therm = new OptimizedErode();
therm.setRadius(5);
therm.setTalus(0.061f);
SmoothFilter smooth = new SmoothFilter();
smooth.setRadius(10);
smooth.setEffect(0.9f);
IterativeFilter iterate = new IterativeFilter();
iterate.addPreFilter(perturb);
iterate.addPostFilter(smooth);
iterate.setFilter(therm);
iterate.setIterations(1);
ground.addPreFilter(iterate);
TerrainGrid terrain = new TerrainGrid("terrain", 33, 257, new FractalTileLoader(ground, 256f));
float a[] = terrain.getHeightMap();
int size = a.length;
for (int i=0; i<size; i++) {
System.out.println(a[i]);
}
}[/java]
i create this fractal heightmap, but when trying to print height values i get 0.0, am i doing something wrong?
To set the image then yes. Iโm not familiar with the fractal heighmap stuff tho so canโt help you there.