Files
godot-docs/classes/class_fastnoiselite.rst
2022-07-27 13:59:06 +02:00

565 lines
27 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/noise/doc_classes/FastNoiseLite.xml.
.. _class_FastNoiseLite:
FastNoiseLite
=============
**Inherits:** :ref:`Noise<class_Noise>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Generates noise using the FastNoiseLite library.
Description
-----------
This class generates noise using the FastNoiseLite library, which is a collection of several noise algorithms including Cellular, Perlin, Value, and more.
Most generated noise values are in the range of ``[-1,1]``, however not always. Some of the cellular noise algorithms return results above ``1``.
Properties
----------
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`CellularDistanceFunction<enum_FastNoiseLite_CellularDistanceFunction>` | :ref:`cellular_distance_function<class_FastNoiseLite_property_cellular_distance_function>` | ``0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`cellular_jitter<class_FastNoiseLite_property_cellular_jitter>` | ``0.45`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`CellularReturnType<enum_FastNoiseLite_CellularReturnType>` | :ref:`cellular_return_type<class_FastNoiseLite_property_cellular_return_type>` | ``1`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`domain_warp_amplitude<class_FastNoiseLite_property_domain_warp_amplitude>` | ``30.0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`bool<class_bool>` | :ref:`domain_warp_enabled<class_FastNoiseLite_property_domain_warp_enabled>` | ``false`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`domain_warp_fractal_gain<class_FastNoiseLite_property_domain_warp_fractal_gain>` | ``0.5`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`domain_warp_fractal_lacunarity<class_FastNoiseLite_property_domain_warp_fractal_lacunarity>` | ``6.0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`int<class_int>` | :ref:`domain_warp_fractal_octaves<class_FastNoiseLite_property_domain_warp_fractal_octaves>` | ``5`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`DomainWarpFractalType<enum_FastNoiseLite_DomainWarpFractalType>` | :ref:`domain_warp_fractal_type<class_FastNoiseLite_property_domain_warp_fractal_type>` | ``1`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`domain_warp_frequency<class_FastNoiseLite_property_domain_warp_frequency>` | ``0.05`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`DomainWarpType<enum_FastNoiseLite_DomainWarpType>` | :ref:`domain_warp_type<class_FastNoiseLite_property_domain_warp_type>` | ``0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`fractal_gain<class_FastNoiseLite_property_fractal_gain>` | ``0.5`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`fractal_lacunarity<class_FastNoiseLite_property_fractal_lacunarity>` | ``2.0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`int<class_int>` | :ref:`fractal_octaves<class_FastNoiseLite_property_fractal_octaves>` | ``5`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`fractal_ping_pong_strength<class_FastNoiseLite_property_fractal_ping_pong_strength>` | ``2.0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`FractalType<enum_FastNoiseLite_FractalType>` | :ref:`fractal_type<class_FastNoiseLite_property_fractal_type>` | ``1`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`fractal_weighted_strength<class_FastNoiseLite_property_fractal_weighted_strength>` | ``0.0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`float<class_float>` | :ref:`frequency<class_FastNoiseLite_property_frequency>` | ``0.01`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`NoiseType<enum_FastNoiseLite_NoiseType>` | :ref:`noise_type<class_FastNoiseLite_property_noise_type>` | ``1`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`offset<class_FastNoiseLite_property_offset>` | ``Vector3(0, 0, 0)`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
| :ref:`int<class_int>` | :ref:`seed<class_FastNoiseLite_property_seed>` | ``0`` |
+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+----------------------+
Enumerations
------------
.. _enum_FastNoiseLite_NoiseType:
.. _class_FastNoiseLite_constant_TYPE_VALUE:
.. _class_FastNoiseLite_constant_TYPE_VALUE_CUBIC:
.. _class_FastNoiseLite_constant_TYPE_PERLIN:
.. _class_FastNoiseLite_constant_TYPE_CELLULAR:
.. _class_FastNoiseLite_constant_TYPE_SIMPLEX:
.. _class_FastNoiseLite_constant_TYPE_SIMPLEX_SMOOTH:
enum **NoiseType**:
- **TYPE_VALUE** = **5** --- A lattice of points are assigned random values then interpolated based on neighboring values.
- **TYPE_VALUE_CUBIC** = **4** --- Similar to Value noise, but slower. Has more variance in peaks and valleys.
Cubic noise can be used to avoid certain artifacts when using value noise to create a bumpmap. In general, you should always use this mode if the value noise is being used for a heightmap or bumpmap.
- **TYPE_PERLIN** = **3** --- A lattice of random gradients. Their dot products are interpolated to obtain values in between the lattices.
- **TYPE_CELLULAR** = **2** --- Cellular includes both Worley noise and Voronoi diagrams which creates various regions of the same value.
- **TYPE_SIMPLEX** = **0** --- As opposed to :ref:`TYPE_PERLIN<class_FastNoiseLite_constant_TYPE_PERLIN>`, gradients exist in a simplex lattice rather than a grid lattice, avoiding directional artifacts.
- **TYPE_SIMPLEX_SMOOTH** = **1** --- Modified, higher quality version of :ref:`TYPE_SIMPLEX<class_FastNoiseLite_constant_TYPE_SIMPLEX>`, but slower.
----
.. _enum_FastNoiseLite_FractalType:
.. _class_FastNoiseLite_constant_FRACTAL_NONE:
.. _class_FastNoiseLite_constant_FRACTAL_FBM:
.. _class_FastNoiseLite_constant_FRACTAL_RIDGED:
.. _class_FastNoiseLite_constant_FRACTAL_PING_PONG:
enum **FractalType**:
- **FRACTAL_NONE** = **0** --- No fractal noise.
- **FRACTAL_FBM** = **1** --- Method using Fractional Brownian Motion to combine octaves into a fractal.
- **FRACTAL_RIDGED** = **2** --- Method of combining octaves into a fractal resulting in a "ridged" look.
- **FRACTAL_PING_PONG** = **3** --- Method of combining octaves into a fractal with a ping pong effect.
----
.. _enum_FastNoiseLite_CellularDistanceFunction:
.. _class_FastNoiseLite_constant_DISTANCE_EUCLIDEAN:
.. _class_FastNoiseLite_constant_DISTANCE_EUCLIDEAN_SQUARED:
.. _class_FastNoiseLite_constant_DISTANCE_MANHATTAN:
.. _class_FastNoiseLite_constant_DISTANCE_HYBRID:
enum **CellularDistanceFunction**:
- **DISTANCE_EUCLIDEAN** = **0** --- Euclidean distance to the nearest point.
- **DISTANCE_EUCLIDEAN_SQUARED** = **1** --- Squared Euclidean distance to the nearest point.
- **DISTANCE_MANHATTAN** = **2** --- Manhattan distance (taxicab metric) to the nearest point.
- **DISTANCE_HYBRID** = **3** --- Blend of :ref:`DISTANCE_EUCLIDEAN<class_FastNoiseLite_constant_DISTANCE_EUCLIDEAN>` and :ref:`DISTANCE_MANHATTAN<class_FastNoiseLite_constant_DISTANCE_MANHATTAN>` to give curved cell boundaries
----
.. _enum_FastNoiseLite_CellularReturnType:
.. _class_FastNoiseLite_constant_RETURN_CELL_VALUE:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE2:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE2_ADD:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE2_SUB:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE2_MUL:
.. _class_FastNoiseLite_constant_RETURN_DISTANCE2_DIV:
enum **CellularReturnType**:
- **RETURN_CELL_VALUE** = **0** --- The cellular distance function will return the same value for all points within a cell.
- **RETURN_DISTANCE** = **1** --- The cellular distance function will return a value determined by the distance to the nearest point.
- **RETURN_DISTANCE2** = **2** --- The cellular distance function returns the distance to the second-nearest point.
- **RETURN_DISTANCE2_ADD** = **3** --- The distance to the nearest point is added to the distance to the second-nearest point.
- **RETURN_DISTANCE2_SUB** = **4** --- The distance to the nearest point is subtracted from the distance to the second-nearest point.
- **RETURN_DISTANCE2_MUL** = **5** --- The distance to the nearest point is multiplied with the distance to the second-nearest point.
- **RETURN_DISTANCE2_DIV** = **6** --- The distance to the nearest point is divided by the distance to the second-nearest point.
----
.. _enum_FastNoiseLite_DomainWarpType:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_SIMPLEX:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_SIMPLEX_REDUCED:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_BASIC_GRID:
enum **DomainWarpType**:
- **DOMAIN_WARP_SIMPLEX** = **0** --- The domain is warped using the simplex noise algorithm.
- **DOMAIN_WARP_SIMPLEX_REDUCED** = **1** --- The domain is warped using a simplified version of the simplex noise algorithm.
- **DOMAIN_WARP_BASIC_GRID** = **2** --- The domain is warped using a simple noise grid (not as smooth as the other methods, but more performant).
----
.. _enum_FastNoiseLite_DomainWarpFractalType:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_FRACTAL_NONE:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_FRACTAL_PROGRESSIVE:
.. _class_FastNoiseLite_constant_DOMAIN_WARP_FRACTAL_INDEPENDENT:
enum **DomainWarpFractalType**:
- **DOMAIN_WARP_FRACTAL_NONE** = **0** --- No fractal noise for warping the space.
- **DOMAIN_WARP_FRACTAL_PROGRESSIVE** = **1** --- Warping the space progressively, octave for octave, resulting in a more "liquified" distortion.
- **DOMAIN_WARP_FRACTAL_INDEPENDENT** = **2** --- Warping the space independently for each octave, resulting in a more chaotic distortion.
Property Descriptions
---------------------
.. _class_FastNoiseLite_property_cellular_distance_function:
- :ref:`CellularDistanceFunction<enum_FastNoiseLite_CellularDistanceFunction>` **cellular_distance_function**
+-----------+---------------------------------------+
| *Default* | ``0`` |
+-----------+---------------------------------------+
| *Setter* | set_cellular_distance_function(value) |
+-----------+---------------------------------------+
| *Getter* | get_cellular_distance_function() |
+-----------+---------------------------------------+
Determines how the distance to the nearest/second-nearest point is computed. See :ref:`CellularDistanceFunction<enum_FastNoiseLite_CellularDistanceFunction>` for options.
----
.. _class_FastNoiseLite_property_cellular_jitter:
- :ref:`float<class_float>` **cellular_jitter**
+-----------+----------------------------+
| *Default* | ``0.45`` |
+-----------+----------------------------+
| *Setter* | set_cellular_jitter(value) |
+-----------+----------------------------+
| *Getter* | get_cellular_jitter() |
+-----------+----------------------------+
Maximum distance a point can move off of its grid position. Set to ``0`` for an even grid.
----
.. _class_FastNoiseLite_property_cellular_return_type:
- :ref:`CellularReturnType<enum_FastNoiseLite_CellularReturnType>` **cellular_return_type**
+-----------+---------------------------------+
| *Default* | ``1`` |
+-----------+---------------------------------+
| *Setter* | set_cellular_return_type(value) |
+-----------+---------------------------------+
| *Getter* | get_cellular_return_type() |
+-----------+---------------------------------+
Return type from cellular noise calculations. See :ref:`CellularReturnType<enum_FastNoiseLite_CellularReturnType>`.
----
.. _class_FastNoiseLite_property_domain_warp_amplitude:
- :ref:`float<class_float>` **domain_warp_amplitude**
+-----------+----------------------------------+
| *Default* | ``30.0`` |
+-----------+----------------------------------+
| *Setter* | set_domain_warp_amplitude(value) |
+-----------+----------------------------------+
| *Getter* | get_domain_warp_amplitude() |
+-----------+----------------------------------+
Sets the maximum warp distance from the origin.
----
.. _class_FastNoiseLite_property_domain_warp_enabled:
- :ref:`bool<class_bool>` **domain_warp_enabled**
+-----------+--------------------------------+
| *Default* | ``false`` |
+-----------+--------------------------------+
| *Setter* | set_domain_warp_enabled(value) |
+-----------+--------------------------------+
| *Getter* | is_domain_warp_enabled() |
+-----------+--------------------------------+
If enabled, another FastNoiseLite instance is used to warp the space, resulting in a distortion of the noise.
----
.. _class_FastNoiseLite_property_domain_warp_fractal_gain:
- :ref:`float<class_float>` **domain_warp_fractal_gain**
+-----------+-------------------------------------+
| *Default* | ``0.5`` |
+-----------+-------------------------------------+
| *Setter* | set_domain_warp_fractal_gain(value) |
+-----------+-------------------------------------+
| *Getter* | get_domain_warp_fractal_gain() |
+-----------+-------------------------------------+
Determines the strength of each subsequent layer of the noise which is used to warp the space.
A low value places more emphasis on the lower frequency base layers, while a high value puts more emphasis on the higher frequency layers.
----
.. _class_FastNoiseLite_property_domain_warp_fractal_lacunarity:
- :ref:`float<class_float>` **domain_warp_fractal_lacunarity**
+-----------+-------------------------------------------+
| *Default* | ``6.0`` |
+-----------+-------------------------------------------+
| *Setter* | set_domain_warp_fractal_lacunarity(value) |
+-----------+-------------------------------------------+
| *Getter* | get_domain_warp_fractal_lacunarity() |
+-----------+-------------------------------------------+
Octave lacunarity of the fractal noise which warps the space. Increasing this value results in higher octaves producing noise with finer details and a rougher appearance.
----
.. _class_FastNoiseLite_property_domain_warp_fractal_octaves:
- :ref:`int<class_int>` **domain_warp_fractal_octaves**
+-----------+----------------------------------------+
| *Default* | ``5`` |
+-----------+----------------------------------------+
| *Setter* | set_domain_warp_fractal_octaves(value) |
+-----------+----------------------------------------+
| *Getter* | get_domain_warp_fractal_octaves() |
+-----------+----------------------------------------+
The number of noise layers that are sampled to get the final value for the fractal noise which warps the space.
----
.. _class_FastNoiseLite_property_domain_warp_fractal_type:
- :ref:`DomainWarpFractalType<enum_FastNoiseLite_DomainWarpFractalType>` **domain_warp_fractal_type**
+-----------+-------------------------------------+
| *Default* | ``1`` |
+-----------+-------------------------------------+
| *Setter* | set_domain_warp_fractal_type(value) |
+-----------+-------------------------------------+
| *Getter* | get_domain_warp_fractal_type() |
+-----------+-------------------------------------+
The method for combining octaves into a fractal which is used to warp the space. See :ref:`DomainWarpFractalType<enum_FastNoiseLite_DomainWarpFractalType>`.
----
.. _class_FastNoiseLite_property_domain_warp_frequency:
- :ref:`float<class_float>` **domain_warp_frequency**
+-----------+----------------------------------+
| *Default* | ``0.05`` |
+-----------+----------------------------------+
| *Setter* | set_domain_warp_frequency(value) |
+-----------+----------------------------------+
| *Getter* | get_domain_warp_frequency() |
+-----------+----------------------------------+
Frequency of the noise which warps the space. Low frequency results in smooth noise while high frequency results in rougher, more granular noise.
----
.. _class_FastNoiseLite_property_domain_warp_type:
- :ref:`DomainWarpType<enum_FastNoiseLite_DomainWarpType>` **domain_warp_type**
+-----------+-----------------------------+
| *Default* | ``0`` |
+-----------+-----------------------------+
| *Setter* | set_domain_warp_type(value) |
+-----------+-----------------------------+
| *Getter* | get_domain_warp_type() |
+-----------+-----------------------------+
Sets the warp algorithm. See :ref:`DomainWarpType<enum_FastNoiseLite_DomainWarpType>`.
----
.. _class_FastNoiseLite_property_fractal_gain:
- :ref:`float<class_float>` **fractal_gain**
+-----------+-------------------------+
| *Default* | ``0.5`` |
+-----------+-------------------------+
| *Setter* | set_fractal_gain(value) |
+-----------+-------------------------+
| *Getter* | get_fractal_gain() |
+-----------+-------------------------+
Determines the strength of each subsequent layer of noise in fractal noise.
A low value places more emphasis on the lower frequency base layers, while a high value puts more emphasis on the higher frequency layers.
----
.. _class_FastNoiseLite_property_fractal_lacunarity:
- :ref:`float<class_float>` **fractal_lacunarity**
+-----------+-------------------------------+
| *Default* | ``2.0`` |
+-----------+-------------------------------+
| *Setter* | set_fractal_lacunarity(value) |
+-----------+-------------------------------+
| *Getter* | get_fractal_lacunarity() |
+-----------+-------------------------------+
Frequency multiplier between subsequent octaves. Increasing this value results in higher octaves producing noise with finer details and a rougher appearance.
----
.. _class_FastNoiseLite_property_fractal_octaves:
- :ref:`int<class_int>` **fractal_octaves**
+-----------+----------------------------+
| *Default* | ``5`` |
+-----------+----------------------------+
| *Setter* | set_fractal_octaves(value) |
+-----------+----------------------------+
| *Getter* | get_fractal_octaves() |
+-----------+----------------------------+
The number of noise layers that are sampled to get the final value for fractal noise types.
----
.. _class_FastNoiseLite_property_fractal_ping_pong_strength:
- :ref:`float<class_float>` **fractal_ping_pong_strength**
+-----------+---------------------------------------+
| *Default* | ``2.0`` |
+-----------+---------------------------------------+
| *Setter* | set_fractal_ping_pong_strength(value) |
+-----------+---------------------------------------+
| *Getter* | get_fractal_ping_pong_strength() |
+-----------+---------------------------------------+
Sets the strength of the fractal ping pong type.
----
.. _class_FastNoiseLite_property_fractal_type:
- :ref:`FractalType<enum_FastNoiseLite_FractalType>` **fractal_type**
+-----------+-------------------------+
| *Default* | ``1`` |
+-----------+-------------------------+
| *Setter* | set_fractal_type(value) |
+-----------+-------------------------+
| *Getter* | get_fractal_type() |
+-----------+-------------------------+
The method for combining octaves into a fractal. See :ref:`FractalType<enum_FastNoiseLite_FractalType>`.
----
.. _class_FastNoiseLite_property_fractal_weighted_strength:
- :ref:`float<class_float>` **fractal_weighted_strength**
+-----------+--------------------------------------+
| *Default* | ``0.0`` |
+-----------+--------------------------------------+
| *Setter* | set_fractal_weighted_strength(value) |
+-----------+--------------------------------------+
| *Getter* | get_fractal_weighted_strength() |
+-----------+--------------------------------------+
Higher weighting means higher octaves have less impact if lower octaves have a large impact.
----
.. _class_FastNoiseLite_property_frequency:
- :ref:`float<class_float>` **frequency**
+-----------+----------------------+
| *Default* | ``0.01`` |
+-----------+----------------------+
| *Setter* | set_frequency(value) |
+-----------+----------------------+
| *Getter* | get_frequency() |
+-----------+----------------------+
The frequency for all noise types. Low frequency results in smooth noise while high frequency results in rougher, more granular noise.
----
.. _class_FastNoiseLite_property_noise_type:
- :ref:`NoiseType<enum_FastNoiseLite_NoiseType>` **noise_type**
+-----------+-----------------------+
| *Default* | ``1`` |
+-----------+-----------------------+
| *Setter* | set_noise_type(value) |
+-----------+-----------------------+
| *Getter* | get_noise_type() |
+-----------+-----------------------+
The noise algorithm used. See :ref:`NoiseType<enum_FastNoiseLite_NoiseType>`.
----
.. _class_FastNoiseLite_property_offset:
- :ref:`Vector3<class_Vector3>` **offset**
+-----------+----------------------+
| *Default* | ``Vector3(0, 0, 0)`` |
+-----------+----------------------+
| *Setter* | set_offset(value) |
+-----------+----------------------+
| *Getter* | get_offset() |
+-----------+----------------------+
Translate the noise input coordinates by the given :ref:`Vector3<class_Vector3>`.
----
.. _class_FastNoiseLite_property_seed:
- :ref:`int<class_int>` **seed**
+-----------+-----------------+
| *Default* | ``0`` |
+-----------+-----------------+
| *Setter* | set_seed(value) |
+-----------+-----------------+
| *Getter* | get_seed() |
+-----------+-----------------+
The random number seed for all noise types.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`