:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/opensimplex/doc_classes/OpenSimplexNoise.xml. .. _class_OpenSimplexNoise: OpenSimplexNoise ================ **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` Noise generator based on Open Simplex. .. rst-class:: classref-introduction-group Description ----------- This resource allows you to configure and sample a fractal noise space. Here is a brief usage example that configures an OpenSimplexNoise and gets samples at various positions and dimensions: :: var noise = OpenSimplexNoise.new() # Configure noise.seed = randi() noise.octaves = 4 noise.period = 20.0 noise.persistence = 0.8 # Sample print("Values:") print(noise.get_noise_2d(1.0, 1.0)) print(noise.get_noise_3d(0.5, 3.0, 15.0)) print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0)) .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------+-----------------------------------------------------------------+----------+ | :ref:`float` | :ref:`lacunarity` | ``2.0`` | +---------------------------+-----------------------------------------------------------------+----------+ | :ref:`int` | :ref:`octaves` | ``3`` | +---------------------------+-----------------------------------------------------------------+----------+ | :ref:`float` | :ref:`period` | ``64.0`` | +---------------------------+-----------------------------------------------------------------+----------+ | :ref:`float` | :ref:`persistence` | ``0.5`` | +---------------------------+-----------------------------------------------------------------+----------+ | :ref:`int` | :ref:`seed` | ``0`` | +---------------------------+-----------------------------------------------------------------+----------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Image` | :ref:`get_image` **(** :ref:`int` width, :ref:`int` height, :ref:`Vector2` noise_offset=Vector2( 0, 0 ) **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_1d` **(** :ref:`float` x **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_2d` **(** :ref:`float` x, :ref:`float` y **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_2dv` **(** :ref:`Vector2` pos **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_3d` **(** :ref:`float` x, :ref:`float` y, :ref:`float` z **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_3dv` **(** :ref:`Vector3` pos **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_noise_4d` **(** :ref:`float` x, :ref:`float` y, :ref:`float` z, :ref:`float` w **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Image` | :ref:`get_seamless_image` **(** :ref:`int` size **)** |const| | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_OpenSimplexNoise_property_lacunarity: .. rst-class:: classref-property :ref:`float` **lacunarity** = ``2.0`` .. rst-class:: classref-property-setget - void **set_lacunarity** **(** :ref:`float` value **)** - :ref:`float` **get_lacunarity** **(** **)** Difference in period between :ref:`octaves`. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_property_octaves: .. rst-class:: classref-property :ref:`int` **octaves** = ``3`` .. rst-class:: classref-property-setget - void **set_octaves** **(** :ref:`int` value **)** - :ref:`int` **get_octaves** **(** **)** Number of OpenSimplex noise layers that are sampled to get the fractal noise. Higher values result in more detailed noise but take more time to generate. \ **Note:** The maximum allowed value is 9. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_property_period: .. rst-class:: classref-property :ref:`float` **period** = ``64.0`` .. rst-class:: classref-property-setget - void **set_period** **(** :ref:`float` value **)** - :ref:`float` **get_period** **(** **)** Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance). .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_property_persistence: .. rst-class:: classref-property :ref:`float` **persistence** = ``0.5`` .. rst-class:: classref-property-setget - void **set_persistence** **(** :ref:`float` value **)** - :ref:`float` **get_persistence** **(** **)** Contribution factor of the different octaves. A ``persistence`` value of 1 means all the octaves have the same contribution, a value of 0.5 means each octave contributes half as much as the previous one. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_property_seed: .. rst-class:: classref-property :ref:`int` **seed** = ``0`` .. rst-class:: classref-property-setget - void **set_seed** **(** :ref:`int` value **)** - :ref:`int` **get_seed** **(** **)** Seed used to generate random values, different seeds will generate different noise maps. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_OpenSimplexNoise_method_get_image: .. rst-class:: classref-method :ref:`Image` **get_image** **(** :ref:`int` width, :ref:`int` height, :ref:`Vector2` noise_offset=Vector2( 0, 0 ) **)** |const| Generate a noise image in :ref:`Image.FORMAT_L8` format with the requested ``width`` and ``height``, based on the current noise parameters. If ``noise_offset`` is specified, then the offset value is used as the coordinates of the top-left corner of the generated noise. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_1d: .. rst-class:: classref-method :ref:`float` **get_noise_1d** **(** :ref:`float` x **)** |const| Returns the 1D noise value ``[-1,1]`` at the given x-coordinate. \ **Note:** This method actually returns the 2D noise value ``[-1,1]`` with fixed y-coordinate value 0.0. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_2d: .. rst-class:: classref-method :ref:`float` **get_noise_2d** **(** :ref:`float` x, :ref:`float` y **)** |const| Returns the 2D noise value ``[-1,1]`` at the given position. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_2dv: .. rst-class:: classref-method :ref:`float` **get_noise_2dv** **(** :ref:`Vector2` pos **)** |const| Returns the 2D noise value ``[-1,1]`` at the given position. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_3d: .. rst-class:: classref-method :ref:`float` **get_noise_3d** **(** :ref:`float` x, :ref:`float` y, :ref:`float` z **)** |const| Returns the 3D noise value ``[-1,1]`` at the given position. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_3dv: .. rst-class:: classref-method :ref:`float` **get_noise_3dv** **(** :ref:`Vector3` pos **)** |const| Returns the 3D noise value ``[-1,1]`` at the given position. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_noise_4d: .. rst-class:: classref-method :ref:`float` **get_noise_4d** **(** :ref:`float` x, :ref:`float` y, :ref:`float` z, :ref:`float` w **)** |const| Returns the 4D noise value ``[-1,1]`` at the given position. .. rst-class:: classref-item-separator ---- .. _class_OpenSimplexNoise_method_get_seamless_image: .. rst-class:: classref-method :ref:`Image` **get_seamless_image** **(** :ref:`int` size **)** |const| Generate a tileable noise image in :ref:`Image.FORMAT_L8` format, based on the current noise parameters. Generated seamless images are always square (``size`` × ``size``). \ **Note:** Seamless noise has a lower contrast compared to non-seamless noise. This is due to the way noise uses higher dimensions for generating seamless noise. .. |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.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`