View Full Version : for math experts who can explain in plain english
I've been on a quest to develop everything procedurally. Now that I have learned how to use 3d modelers and paint programs, I want to challenge myself even more.
Anyways... I have been reading up on Perlin Noise and in a couple of places I have read that if you generate images in the power of 2, for instance-- 512 x 512, that Perlin Noise automatically becomes perfectly tile-able, but not so in non squared formats.
I don't so see why this is so, can anyone explain it in an easy to understand manner?
danbaron
18-06-2010, 00:02
[font=courier new][size=8pt]I looked at it a little, here.
http://www.programmersheaven.com/2/perlin
For 2D, it talks about a point, and its four neighbors. Using the analogy of a chessboard, I guess that an interior black square's four neighbors, would be the four red squares adjacent to it.
As far as I know, an area is perfectly tileable for a particular pattern, if the entire area can be covered, just by repeating the pattern. But, in that case, any m x n area, is perfectly tileable using the chessboard pattern, not only areas of the form, 2n x 2n.
(I already looked at your Ken Perlin link (just below). I didn't see anything about, "perfectly tileable". But, maybe I didn't look closely enough.)
||
||
\/
The relevant concepts, "Perlin Noise", "perfectly tileable", are not clear enough in my head, for me to say anything that might be helpful.
:oops: :x
Sorry Dan I should have put these links in:
http://www.noisemachine.com/talk1/2.html this is Ken Perlin's site where he explains it. Use the arrows at the top left of the page to move from page to page.
danbaron
18-06-2010, 01:23
[font=courier new][size=8pt]I revised my previous post, above, to address your last post.
Dan :twisted:
Charles Pegge
18-06-2010, 07:34
Tiling:
For tile-ability, the pattern at each pair of edges (top and bottom, left and right) must have matching patterns.
As the number of tiles increase, the grid structure would begin to become visible.
But this can be resolved by randomising the vertices of the grid slightly to make the shape of each tile different.
Since the pattern is `stretched` over each tile in the grid, the pattern matching at the edges is conserved.
Have I got this right?
Charles
danbaron
18-06-2010, 08:04
[font=courier new][size=8pt]I'm ignorant, Charles. But, I think I might see what you are saying (maybe not), --> there cannot be any interior, "seams".
I do know, that, when I was a boy, I would sit on the toilet in the bathroom, staring at the tiles on the floor. If I tried to stare at the entire floor at once, instead of focusing on an individual area, then, after a few seconds, the image of the floor would seem to rise about a foot into the air. I don't know why. But, it was fun to do.
Anyway, here is more.
http://en.wikipedia.org/wiki/Penrose_tiling
:oops: :x :twisted:
Dan
I understand and know how to make textures tile-able manually. I just didn't understand how the noise function automatically is tile-able on powers of 2 image sizes. Being random noise-- why it works out mathematically to be so on images of those dimensions? That is the mystery :)
http://www.devmag.org.za/articles/48-HOW-TO-USE-PERLIN-NOISE-IN-YOUR-GAMES/4/
Charles Pegge
19-06-2010, 00:33
It's because the data is deterministic and only appears to be random. For any given starting value you will always end up with the same pattern.
But I am sure there are also some clever symmetry tweaks to get the edges matching.
Charles
D.J.Peters
24-06-2010, 14:23
my english is bad :oops:
but i try it ;)
if you use a power of 2 arrays the mask (value-1) all bits are allways 1
xtil = x and (power_of_2-1) ' 128-1 = 127 (111_1111) ,64-1 = 63 (11_1111) ...
now with a mask value not power of 2 (some bits are 0)
x_not_til = x and (not_power_of_2-1) ' 123-1 = 122 (111_1010) , 62-1 = 61 (11_1101)
you can replace AND with MOD (%) it will work if the mask is a power of 2 (but not in the other case)
Joshy
Thanks Joshy, that is really neat. Is the mask (the value -1), is that just something that is always there in bit operations?
I will do some reading now to see what I find out, I want to really understand this stuff as I work on my own engine.