Is "perlin:get2d({x = pos.x, y = pos.z})" from -1 to 1 or from 0 to 1?

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Is "perlin:get2d({x = pos.x, y = pos.z})" from -1 to 1 or from 0 to 1?

by paramat » Tue Dec 11, 2012 02:59

Sorry to ask, i've searched online for hours.
If for example ...
perlin = minetest.env:get_perlin(SEEDDIFF, 3, 0.5, 150)
What range of values does ...
perlin:get2d({x = pos.x, y = pos.z})
... give? -1 to 1 or 0 to 1?
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Dec 11, 2012 10:38

Just add an math.abs() arround it and you can be sure its not under 0.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Wed Dec 12, 2012 03:36

Okay thanks i appreciate a reply. I'm adapting the conifers mod to my needs by spawning by perlin not altitude, i eventually managed to have perlin value output to the terminal using print ... and yes it is -1 to 1 as i hoped.

EDIT hmmm ... actually i see it occasionally exceeds the -1 to 1 range.
Last edited by paramat on Fri Dec 14, 2012 17:45, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re:

by Hybrid Dog » Fri Jun 05, 2015 14:50

sorry for posting to an old topic

paramat wrote:hmmm ... actually i see it occasionally exceeds the -1 to 1 range.

Image

l've got a problem, it even exceeded to -1.7 (which remembers me to approximately sqrt(3)). And l use perlin noise for the top of the nether forest, so l need to know where it begins.
What is the range of perlin noise?
Attachments
screenshot_20150521_164408.png
screenshot_20150521_164408.png (25.36 KiB) Viewed 898 times
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: Is "perlin:get2d({x = pos.x, y = pos.z})" from -1 to 1 o

by srifqi » Fri Jun 05, 2015 16:17

Looks like Minetest's PerlinNoise is buggy. You can use clamp function:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function clamp(value, min, max)
    if value<min then return min end
    if value>max then return max end
    return value;
end
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Is "perlin:get2d({x = pos.x, y = pos.z})" from -1 to 1 o

by Hybrid Dog » Fri Jun 05, 2015 17:32

srifqi wrote:Looks like Minetest's PerlinNoise is buggy. You can use clamp function:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function clamp(value, min, max)
    if value<min then return min end
    if value>max then return max end
    return value;
end

this would make a flat top, l currently use another fix
https://github.com/HybridDog/minetest-n ... 5c1dcdR486
 


Return to WIP Mods

Who is online

Users browsing this forum: Google [Bot] and 19 guests

cron