- Home /
How to distort Voronoi using LibNoise
Hi, first, sorry for bad English. ;) (I need at least one answer (I now this question can be hard to ask, but please, try to answer, thanks :) ), so I will try to explain as clear as possible, if you don't understand something, you can ask me by comments ^^)
Well, I'm making some tests with LibNoise, and well, now I want to distort Voronoi.
The explanation (of all the thing I made)
First, I started searching "Voronoi Libnoise" in Google, and I found this image:
Then, I started to read the website, the tutorial says this:
DistortedVoronoiBiome(X, Z) := VoronoiBiome(X + PerlinX(X, Z), Z + PerlinZ(X, Z))
That means that mixing Perlin in the Voronoi Algorithm you get something like the image #1...
So having this information, I started searching in LibNoise how to do this, and I found Turbulence class (that uses Perlin Noise), and this what I did:
Texture2D tex;
int size = 512;
float power = 1;
void Start() {
Generate();
}
void OnGUI() {
if(tex != null) {
//Display tex...
}
}
void Generate() {
tex = new Texture2D(size, size);
var gen = new Voronoi();
var mod = new LibNoise.Operator.Turbulence(power, gen);
for(int i = 0; i < size; i++) {
for(int j = 0; j < size; j++) {
float c = Mathf.Abs(((float)mod.GetValue((double)i, (double)j, 0)));
tex.SetPixel(i, j, new Color(c, c, c));
}
}
tex.Apply();
}
The problem
The problem is that I don't get the desired effect, I only get this:
The cell's shape don't change, only the border of the cells get granulated, so, I need to know how can I make something like the image #1...
Other things I tried
I tried, other classes like Displace and Terrace, without luck (I only get the same effect), maybe I'm not using it correctly, so I need some help about how can I figure this out...
Any suggestions?
Thanks in advance. ^^
Bye.
Your answer
Follow this Question
Related Questions
I need no perspective distortion for some part of screen 0 Answers
Android Splash Screen Stretches 1 Answer
Blurred texture on range 1 Answer
How to measure fisheye lens distortion? 0 Answers
[libnoise port] spherical texture is one pixel too wide 0 Answers