# Perlin Noise API Code

**URL:** <https://forum.babylonjs.com/t/perlin-noise-api-code/6983>\
**Category:** Questions\
**Created:** [November 14, 2019, 8:54am UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983 "2019-11-14T08:54:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [November 14, 2019, 8:54am UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983/1 "2019-11-14T08:54:16Z")

</div>

Hey guys… I have been looking for some type of JS API for generating perlin nose

Unity has **float Mathf.PerlinNoise(float x, float y)**

Do we have anyway using code to generate perlin noise ???

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [November 14, 2019, 9:32am UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983/2 "2019-11-14T09:32:22Z")

</div>

There’s one in the shaders folder [Babylon.js/noise.fragment.fx at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/noise.fragment.fx)

and one in the procedural textures library [Babylon.js/proceduralTexturesLibrary/src/perlinNoise at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/tree/master/proceduralTexturesLibrary/src/perlinNoise)

---

<div class="post-metadata">

**Author:** ![aFalcon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/afalcon/32/7015_2.png) [@aFalcon](https://forum.babylonjs.com/u/aFalcon)\
**Post date:** [November 14, 2019, 4:27pm UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983/3 "2019-11-14T16:27:07Z")

</div>

@MackeyK24, I saw @nasimiasl and @Pryme8 using PERLIN in shaders.

One was in the sandDune PG, and the other in this volumetric fog link…

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [November 14, 2019, 4:29pm UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983/4 "2019-11-14T16:29:15Z")

</div>

> <https://github.com/Pryme8/Das_Noise/blob/gh-pages/js/dN.1.1.22.js>

Should be in a working state… its beeeeen a long time.

just glancing over it, I was reworking this and only perlin2 and worly2 are accessible, but the code for more is there.

---

<div class="post-metadata">

**Author:** ![aFalcon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/afalcon/32/7015_2.png) [@aFalcon](https://forum.babylonjs.com/u/aFalcon)\
**Post date:** [November 14, 2019, 4:34pm UTC](https://forum.babylonjs.com/t/perlin-noise-api-code/6983/5 "2019-11-14T16:34:20Z")

</div>

Wowza! No way… really? Nice!  
🏆

Looking…

That MATH makes my day… like VITAMINS.

Check out:

```auto
dN.lerp = function(a, b, t) {
    return (1-t)*a + t*b;
  }

```

🌟 Then in Perlin3

```auto

    return lerp(
        lerp(
         lerp(n000, n100, u),
          lerp(n001, n101, u), w),
        lerp(
         lerp(n010, n110, u),
          lerp(n011, n111, u), w),
       v);
  };

```

LuvIt!

Looks like lots of Matrix Math, is as far as I can decipher. Maybe I way off.

🦅 : )
