Reference: Document //noise2d

This commit is contained in:
Starbeamrainbowlabs 2021-07-06 01:08:36 +01:00
parent 40173b2647
commit a42e296f4e
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 48 additions and 1 deletions

View file

@ -488,6 +488,53 @@ Usage examples:
``` ```
## `//noise2d [<key_1> [<value_1>]] [<key_2> [<value_2>]] ...]`
Applies 2D noise to the terrain in the defined region. Like `//erode`, this command accepts a number of different key-value parameters and provides a number of different underlying algorithms.
Parameter | Type | Default Value | Description
------------|-----------|---------------|-----------------------
algorithm | `string` | perlin | The 2D noise algorithm to apply - see below.
apply | `string|integer` | 5 | How to apply the noise to the terrain - see below.
scalex | `float` | 1 | The scale of the noise on the x axis.
scaley | `float` | 1 | The scale of the noise on the y axis.
scalez | `float` | 1 | The scale of the noise on the z axis.
offsetx | `float` | 1 | The offset to add to the x axis before calling the noise function.
offsety | `float` | 0 | The offset to add to the y axis before calling the noise function.
offsetz | `float` | 0 | The offset to add to the z axis before calling the noise function.
exponent | `float` | 0 | Raise the generated noise value (with a range of 0 to 1) to this power. Generally results in sharper peaks.
multiply | `float` | 1 | Multiply the generated noise value by this number
add | `float` | 0 | Add this number to the generated noise value.
Different values of the `apply` parameter result in the generated noise values being applied in different ways:
- An integer indicates that the noise should be rescaled to a given amplitude (equal parts of the range above and below 0) before being added to the terrain heightmap.`
- The exact string `add`: Noise values are added to each heightmap pixel.
- The exact string `multiply`: Each heightmap pixel is multiplied by the corresponding noise value.
The following algorithms are currently available:
Algorithm | Description
------------|--------------------------
`perlin` | Perlin noise. Functional, but currently contains artefacts I'm having difficulty tracking down.
`sin` | A sine wave created with `math.sin()`.
When specifying algorithm names, the `algorithm` parameter name is optional. For example, the following are both equivalent:
```
//noise2d offsetx 4 perlin scale 0.2
//noise2d offsetx 4 algorithm perlin scale 0.2
```
Example invocations:
```
//noise2d sin scale 0.5
//noise2d offsetx 20 perlin
//noise2d sin exponent 4
```
## `//count` ## `//count`
Counts all the nodes in the defined region and returns the result along with calculated percentages (note that if the chat window used a monospace font, the returned result would be a perfect table. If someone has a ~~hack~~ solution to make the columns line up neatly, please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new) :D) Counts all the nodes in the defined region and returns the result along with calculated percentages (note that if the chat window used a monospace font, the returned result would be a perfect table. If someone has a ~~hack~~ solution to make the columns line up neatly, please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new) :D)

View file

@ -10,7 +10,7 @@ function worldeditadditions.noise.params_apply_default(params)
-- different effects: -- different effects:
-- - The exact string "add": Noise values are added to each heightmap pixel. -- - The exact string "add": Noise values are added to each heightmap pixel.
-- - The exact string "multiply": Each heightmap pixel is multiplied by the corresponding noise value. -- - The exact string "multiply": Each heightmap pixel is multiplied by the corresponding noise value.
-- - A string in the form of digits followed by a percent sign (e.g. "40%"), then the noise will is remapped from the range 0 - 1 to the range -1 - +1, and then for each pixel in the heightmap will be altered at most the given percentage of the total height of the defined region. -- - A string in the form of digits followed, then the noise will is remapped from the range 0 - 1 to the range -1 - +1 and multiplied by this number / 2, and then for each pixel in the heightmap the corresponding noise value will be added to it.
apply = 5, apply = 5,
-- The backend noise algorithm to use -- The backend noise algorithm to use
algorithm = "perlin", algorithm = "perlin",