class_opensimplexnoise.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/opensimplex/doc_classes/OpenSimplexNoise.xml.
  6. .. _class_OpenSimplexNoise:
  7. OpenSimplexNoise
  8. ================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Noise generator based on Open Simplex.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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:
  15. ::
  16. var noise = OpenSimplexNoise.new()
  17. # Configure
  18. noise.seed = randi()
  19. noise.octaves = 4
  20. noise.period = 20.0
  21. noise.persistence = 0.8
  22. # Sample
  23. print("Values:")
  24. print(noise.get_noise_2d(1.0, 1.0))
  25. print(noise.get_noise_3d(0.5, 3.0, 15.0))
  26. print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +---------------------------+-----------------------------------------------------------------+----------+
  33. | :ref:`float<class_float>` | :ref:`lacunarity<class_OpenSimplexNoise_property_lacunarity>` | ``2.0`` |
  34. +---------------------------+-----------------------------------------------------------------+----------+
  35. | :ref:`int<class_int>` | :ref:`octaves<class_OpenSimplexNoise_property_octaves>` | ``3`` |
  36. +---------------------------+-----------------------------------------------------------------+----------+
  37. | :ref:`float<class_float>` | :ref:`period<class_OpenSimplexNoise_property_period>` | ``64.0`` |
  38. +---------------------------+-----------------------------------------------------------------+----------+
  39. | :ref:`float<class_float>` | :ref:`persistence<class_OpenSimplexNoise_property_persistence>` | ``0.5`` |
  40. +---------------------------+-----------------------------------------------------------------+----------+
  41. | :ref:`int<class_int>` | :ref:`seed<class_OpenSimplexNoise_property_seed>` | ``0`` |
  42. +---------------------------+-----------------------------------------------------------------+----------+
  43. .. rst-class:: classref-reftable-group
  44. Methods
  45. -------
  46. .. table::
  47. :widths: auto
  48. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Image<class_Image>` | :ref:`get_image<class_OpenSimplexNoise_method_get_image>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`Vector2<class_Vector2>` noise_offset=Vector2( 0, 0 ) **)** |const| |
  50. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`float<class_float>` | :ref:`get_noise_1d<class_OpenSimplexNoise_method_get_noise_1d>` **(** :ref:`float<class_float>` x **)** |const| |
  52. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`float<class_float>` | :ref:`get_noise_2d<class_OpenSimplexNoise_method_get_noise_2d>` **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y **)** |const| |
  54. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`float<class_float>` | :ref:`get_noise_2dv<class_OpenSimplexNoise_method_get_noise_2dv>` **(** :ref:`Vector2<class_Vector2>` pos **)** |const| |
  56. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`float<class_float>` | :ref:`get_noise_3d<class_OpenSimplexNoise_method_get_noise_3d>` **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z **)** |const| |
  58. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`float<class_float>` | :ref:`get_noise_3dv<class_OpenSimplexNoise_method_get_noise_3dv>` **(** :ref:`Vector3<class_Vector3>` pos **)** |const| |
  60. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`float<class_float>` | :ref:`get_noise_4d<class_OpenSimplexNoise_method_get_noise_4d>` **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z, :ref:`float<class_float>` w **)** |const| |
  62. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Image<class_Image>` | :ref:`get_seamless_image<class_OpenSimplexNoise_method_get_seamless_image>` **(** :ref:`int<class_int>` size **)** |const| |
  64. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. .. rst-class:: classref-section-separator
  66. ----
  67. .. rst-class:: classref-descriptions-group
  68. Property Descriptions
  69. ---------------------
  70. .. _class_OpenSimplexNoise_property_lacunarity:
  71. .. rst-class:: classref-property
  72. :ref:`float<class_float>` **lacunarity** = ``2.0``
  73. .. rst-class:: classref-property-setget
  74. - void **set_lacunarity** **(** :ref:`float<class_float>` value **)**
  75. - :ref:`float<class_float>` **get_lacunarity** **(** **)**
  76. Difference in period between :ref:`octaves<class_OpenSimplexNoise_property_octaves>`.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_OpenSimplexNoise_property_octaves:
  80. .. rst-class:: classref-property
  81. :ref:`int<class_int>` **octaves** = ``3``
  82. .. rst-class:: classref-property-setget
  83. - void **set_octaves** **(** :ref:`int<class_int>` value **)**
  84. - :ref:`int<class_int>` **get_octaves** **(** **)**
  85. 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.
  86. \ **Note:** The maximum allowed value is 9.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_OpenSimplexNoise_property_period:
  90. .. rst-class:: classref-property
  91. :ref:`float<class_float>` **period** = ``64.0``
  92. .. rst-class:: classref-property-setget
  93. - void **set_period** **(** :ref:`float<class_float>` value **)**
  94. - :ref:`float<class_float>` **get_period** **(** **)**
  95. Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_OpenSimplexNoise_property_persistence:
  99. .. rst-class:: classref-property
  100. :ref:`float<class_float>` **persistence** = ``0.5``
  101. .. rst-class:: classref-property-setget
  102. - void **set_persistence** **(** :ref:`float<class_float>` value **)**
  103. - :ref:`float<class_float>` **get_persistence** **(** **)**
  104. 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.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_OpenSimplexNoise_property_seed:
  108. .. rst-class:: classref-property
  109. :ref:`int<class_int>` **seed** = ``0``
  110. .. rst-class:: classref-property-setget
  111. - void **set_seed** **(** :ref:`int<class_int>` value **)**
  112. - :ref:`int<class_int>` **get_seed** **(** **)**
  113. Seed used to generate random values, different seeds will generate different noise maps.
  114. .. rst-class:: classref-section-separator
  115. ----
  116. .. rst-class:: classref-descriptions-group
  117. Method Descriptions
  118. -------------------
  119. .. _class_OpenSimplexNoise_method_get_image:
  120. .. rst-class:: classref-method
  121. :ref:`Image<class_Image>` **get_image** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`Vector2<class_Vector2>` noise_offset=Vector2( 0, 0 ) **)** |const|
  122. Generate a noise image in :ref:`Image.FORMAT_L8<class_Image_constant_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.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_OpenSimplexNoise_method_get_noise_1d:
  126. .. rst-class:: classref-method
  127. :ref:`float<class_float>` **get_noise_1d** **(** :ref:`float<class_float>` x **)** |const|
  128. Returns the 1D noise value ``[-1,1]`` at the given x-coordinate.
  129. \ **Note:** This method actually returns the 2D noise value ``[-1,1]`` with fixed y-coordinate value 0.0.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_OpenSimplexNoise_method_get_noise_2d:
  133. .. rst-class:: classref-method
  134. :ref:`float<class_float>` **get_noise_2d** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y **)** |const|
  135. Returns the 2D noise value ``[-1,1]`` at the given position.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_OpenSimplexNoise_method_get_noise_2dv:
  139. .. rst-class:: classref-method
  140. :ref:`float<class_float>` **get_noise_2dv** **(** :ref:`Vector2<class_Vector2>` pos **)** |const|
  141. Returns the 2D noise value ``[-1,1]`` at the given position.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_OpenSimplexNoise_method_get_noise_3d:
  145. .. rst-class:: classref-method
  146. :ref:`float<class_float>` **get_noise_3d** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z **)** |const|
  147. Returns the 3D noise value ``[-1,1]`` at the given position.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_OpenSimplexNoise_method_get_noise_3dv:
  151. .. rst-class:: classref-method
  152. :ref:`float<class_float>` **get_noise_3dv** **(** :ref:`Vector3<class_Vector3>` pos **)** |const|
  153. Returns the 3D noise value ``[-1,1]`` at the given position.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_OpenSimplexNoise_method_get_noise_4d:
  157. .. rst-class:: classref-method
  158. :ref:`float<class_float>` **get_noise_4d** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z, :ref:`float<class_float>` w **)** |const|
  159. Returns the 4D noise value ``[-1,1]`` at the given position.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_OpenSimplexNoise_method_get_seamless_image:
  163. .. rst-class:: classref-method
  164. :ref:`Image<class_Image>` **get_seamless_image** **(** :ref:`int<class_int>` size **)** |const|
  165. Generate a tileable noise image in :ref:`Image.FORMAT_L8<class_Image_constant_FORMAT_L8>` format, based on the current noise parameters. Generated seamless images are always square (``size`` × ``size``).
  166. \ **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.
  167. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  168. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  169. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  170. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`