Tiling Simplex Noise?

I was interested (as an amateur) in the generation of pseudo-random noise, in particular the Perlin and Simplex algorithms. Simplex has the advantage of speed (especially with higher measurements), but Perlin can be easily cut. I was wondering if anyone knows about the mosaic bonding algorithm? Fixed size is fine, overall is better; pseudocode is excellent, c / C ++ is better.

+3
source share
4 answers

It would seem that this issue was reasonably resolved here , with a detailed description of the idea of ​​a working solution here . Fantastic answer to a long-standing problem!

+2
source

, Perlin, . , , mod 256 ( 255, , ) ( ) , . HLSL:

uint3 iIdx0 = p0SI % 256;
uint3 iIdx1 = (p0SI + pI1) % 256;
uint3 iIdx2 = (p0SI + pI2) % 256;
uint3 iIdx3 = (p0SI + 1.0f) % 256;
uint iGI0 = gPerm[ iIdx0.x + gPerm[ iIdx0.y + gPerm[ iIdx0.z ] ] ] % 12;
uint iGI1 = gPerm[ iIdx1.x + gPerm[ iIdx1.y + gPerm[ iIdx1.z ] ] ] % 12;
uint iGI2 = gPerm[ iIdx2.x + gPerm[ iIdx2.y + gPerm[ iIdx2.z ] ] ] % 12;
uint iGI3 = gPerm[ iIdx3.x + gPerm[ iIdx3.y + gPerm[ iIdx3.z ] ] ] % 12;

p0SI - 0, pI2 PI2 - 1 2, . , HLSL- , , , 1.0f (1.0,1.0,1.0). , , . - , , . .

: , , , - . , 256 , .

+3

.

:

Ftileable(x, y) = ( 
       F(x, y) * (w - x) * (h - y) + 
       F(x - w, y) * (x) * (h - y) + 
       F(x - w, y - h) * (x) * (y) + 
       F(x, y - h) * (w - x) * (y)
) / (wh)

F() - . , x, y : x [0, w), y [0, h). - tileX = x - Math.Floor(x/w) * w fmod().

, , 2 ^ D D. .

: http://webstaff.itn.liu.se/~stegu/TNM022-2005/perlinnoiselinks/perlin-noise-math-faq.html

+1

, - Google.

x y (ortonormal) , , ( 2D), (% 255 - ) , , " ", .

, , - "" , X Y "", "", .

, , SimplexNoise.java, , , :

var F2 = 0.5*(Math.sqrt(3.0)-1.0);
var s = (xin+yin)*F2; // Hairy factor for 2D
var i = Math.floor(xin+s);
var j = Math.floor(yin+s);

" " :

var G2 = (3.0-Math.sqrt(3.0))/6.0;
var t = (xin+yin)*G2;
xin-=t;
yin-=t;

, - (.. : D), , , .

, " " , , " " . , Perlin, , , .

+1

Source: https://habr.com/ru/post/1715732/


All Articles