<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://olddev.minetest.org/index.php?action=history&amp;feed=atom&amp;title=PerlinNoiseMap</id>
	<title>PerlinNoiseMap - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://olddev.minetest.org/index.php?action=history&amp;feed=atom&amp;title=PerlinNoiseMap"/>
	<link rel="alternate" type="text/html" href="https://olddev.minetest.org/index.php?title=PerlinNoiseMap&amp;action=history"/>
	<updated>2026-04-15T06:45:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.7</generator>
	<entry>
		<id>https://olddev.minetest.org/index.php?title=PerlinNoiseMap&amp;diff=136&amp;oldid=prev</id>
		<title>&gt;Wuzzy: Remove &quot;incomplete&quot; template (this page must be deleted anyway)</title>
		<link rel="alternate" type="text/html" href="https://olddev.minetest.org/index.php?title=PerlinNoiseMap&amp;diff=136&amp;oldid=prev"/>
		<updated>2022-05-24T09:39:27Z</updated>

		<summary type="html">&lt;p&gt;Remove &amp;quot;incomplete&amp;quot; template (this page must be deleted anyway)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{UnofficialLua}}&lt;br /&gt;
{{DISPLAYTITLE:PerlinNoiseMap minetest.get_perlin_map}}&lt;br /&gt;
A fast, bulk perlin noise generator&lt;br /&gt;
Can be created via&lt;br /&gt;
* &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;PerlinNoiseMap(noiseparams, size)&amp;lt;/source&amp;gt;&lt;br /&gt;
* &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;minetest.get_perlin_map(noiseparams, size)&amp;lt;/source&amp;gt;&lt;br /&gt;
The latter function must not be called until after the world is finished initializing, so it must be called during some kind of callback rather than at the top level mod initialization code. The first constructor, on the other hand, may be called at any time since it does not depend on the world's seed.&lt;br /&gt;
== Methods ==&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible sortable&amp;quot;&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;get2dMap(pos)&amp;lt;/source&amp;gt;&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.x&amp;lt;/source&amp;gt; '''x''' &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.y&amp;lt;/source&amp;gt; 2d array of 2d noise values starting at &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pos={x=,y=}&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;get3dMap(pos)&amp;lt;/source&amp;gt;&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.x&amp;lt;/source&amp;gt; '''x''' &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.y&amp;lt;/source&amp;gt; '''x''' &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.z&amp;lt;/source&amp;gt; 3d array of 3d noise values starting at &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pos={x=,y=,z=}&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;get2dMap_flat(pos)&amp;lt;/source&amp;gt;&lt;br /&gt;
| Flat &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.x&amp;lt;/source&amp;gt; * &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;size.y&amp;lt;/source&amp;gt; element array of 2d noise values starting at &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pos={x=,y=}&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;get3dMap_flat(pos)&amp;lt;/source&amp;gt;&lt;br /&gt;
| Same as get2dMap_flat, but 3d noise&lt;br /&gt;
|}&lt;br /&gt;
== Noise Params ==&lt;br /&gt;
Here's an example of the noiseparams:&lt;br /&gt;
&amp;lt;source&amp;gt;local testparam = {&lt;br /&gt;
   offset = 0,&lt;br /&gt;
   scale = 1,&lt;br /&gt;
   spread = {x=2048, y=2048, z=2048},&lt;br /&gt;
   seed = 1337,&lt;br /&gt;
   octaves = 6,&lt;br /&gt;
   persist = 0.6&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
* spread: defines how fast the (ex.) terrain high changes (frequency)&lt;br /&gt;
* seed: every seed generates a different perlin map&lt;br /&gt;
* octaves: higher value, higher details&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;source&amp;gt;minetest.register_on_generated(function(minp, maxp, seed)&lt;br /&gt;
   local vm, emin, emax = minetest.get_mapgen_object(&amp;quot;voxelmanip&amp;quot;)&lt;br /&gt;
   local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}&lt;br /&gt;
   local data = vm:get_data()&lt;br /&gt;
   &lt;br /&gt;
   --get side length of the current mapgen block&lt;br /&gt;
   local side_length = maxp.x - minp.x + 1&lt;br /&gt;
   local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}&lt;br /&gt;
   local perlin_map = minetest.get_perlin_map(testparam, map_lengths_xyz):get2dMap_flat(minp)&lt;br /&gt;
&lt;br /&gt;
   --loop&lt;br /&gt;
   local perlin_index = 1&lt;br /&gt;
   for z = minp.z, maxp.z do&lt;br /&gt;
      for y = minp.y, maxp.y do&lt;br /&gt;
         local vi = area:index(minp.x, y, z)&lt;br /&gt;
         for x = minp.x, maxp.x do&lt;br /&gt;
             print(&amp;quot;Some spam value: &amp;quot;..tostring(perlin_map[vi])&lt;br /&gt;
             --more efficient coding - x++&lt;br /&gt;
             perlin_index = perlin_index + 1&lt;br /&gt;
             vi = vi + 1&lt;br /&gt;
         end&lt;br /&gt;
         --go back, one side_length&lt;br /&gt;
         perlin_index = perlin_index - side_length&lt;br /&gt;
      end&lt;br /&gt;
      --go forward, one side_length&lt;br /&gt;
      perlin_index = perlin_index + side_length&lt;br /&gt;
   end&lt;br /&gt;
end)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[PerlinNoise]]&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
[https://forum.minetest.net/viewtopic.php?f=6&amp;amp;t=8157 Minetest forum thread: &amp;quot;minetest.get_perlin() and minetest.get_perlin_map() Return nil&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
[[Category:Objects]]&lt;br /&gt;
[[Category:Mapgen]]&lt;/div&gt;</summary>
		<author><name>&gt;Wuzzy</name></author>
	</entry>
</feed>