OpenSimplexNoise.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="OpenSimplexNoise" inherits="Resource" version="3.4">
  3. <brief_description>
  4. Noise generator based on Open Simplex.
  5. </brief_description>
  6. <description>
  7. 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:
  8. [codeblock]
  9. var noise = OpenSimplexNoise.new()
  10. # Configure
  11. noise.seed = randi()
  12. noise.octaves = 4
  13. noise.period = 20.0
  14. noise.persistence = 0.8
  15. # Sample
  16. print("Values:")
  17. print(noise.get_noise_2d(1.0, 1.0))
  18. print(noise.get_noise_3d(0.5, 3.0, 15.0))
  19. print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))
  20. [/codeblock]
  21. </description>
  22. <tutorials>
  23. </tutorials>
  24. <methods>
  25. <method name="get_image" qualifiers="const">
  26. <return type="Image" />
  27. <argument index="0" name="width" type="int" />
  28. <argument index="1" name="height" type="int" />
  29. <argument index="2" name="noise_offset" type="Vector2" default="Vector2( 0, 0 )" />
  30. <description>
  31. Generate a noise image in [constant Image.FORMAT_L8] format with the requested [code]width[/code] and [code]height[/code], based on the current noise parameters. If [code]noise_offset[/code] is specified, then the offset value is used as the coordinates of the top-left corner of the generated noise.
  32. </description>
  33. </method>
  34. <method name="get_noise_1d" qualifiers="const">
  35. <return type="float" />
  36. <argument index="0" name="x" type="float" />
  37. <description>
  38. Returns the 1D noise value [code][-1,1][/code] at the given x-coordinate.
  39. [b]Note:[/b] This method actually returns the 2D noise value [code][-1,1][/code] with fixed y-coordinate value 0.0.
  40. </description>
  41. </method>
  42. <method name="get_noise_2d" qualifiers="const">
  43. <return type="float" />
  44. <argument index="0" name="x" type="float" />
  45. <argument index="1" name="y" type="float" />
  46. <description>
  47. Returns the 2D noise value [code][-1,1][/code] at the given position.
  48. </description>
  49. </method>
  50. <method name="get_noise_2dv" qualifiers="const">
  51. <return type="float" />
  52. <argument index="0" name="pos" type="Vector2" />
  53. <description>
  54. Returns the 2D noise value [code][-1,1][/code] at the given position.
  55. </description>
  56. </method>
  57. <method name="get_noise_3d" qualifiers="const">
  58. <return type="float" />
  59. <argument index="0" name="x" type="float" />
  60. <argument index="1" name="y" type="float" />
  61. <argument index="2" name="z" type="float" />
  62. <description>
  63. Returns the 3D noise value [code][-1,1][/code] at the given position.
  64. </description>
  65. </method>
  66. <method name="get_noise_3dv" qualifiers="const">
  67. <return type="float" />
  68. <argument index="0" name="pos" type="Vector3" />
  69. <description>
  70. Returns the 3D noise value [code][-1,1][/code] at the given position.
  71. </description>
  72. </method>
  73. <method name="get_noise_4d" qualifiers="const">
  74. <return type="float" />
  75. <argument index="0" name="x" type="float" />
  76. <argument index="1" name="y" type="float" />
  77. <argument index="2" name="z" type="float" />
  78. <argument index="3" name="w" type="float" />
  79. <description>
  80. Returns the 4D noise value [code][-1,1][/code] at the given position.
  81. </description>
  82. </method>
  83. <method name="get_seamless_image" qualifiers="const">
  84. <return type="Image" />
  85. <argument index="0" name="size" type="int" />
  86. <description>
  87. Generate a tileable noise image in [constant Image.FORMAT_L8] format, based on the current noise parameters. Generated seamless images are always square ([code]size[/code] × [code]size[/code]).
  88. [b]Note:[/b] 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.
  89. </description>
  90. </method>
  91. </methods>
  92. <members>
  93. <member name="lacunarity" type="float" setter="set_lacunarity" getter="get_lacunarity" default="2.0">
  94. Difference in period between [member octaves].
  95. </member>
  96. <member name="octaves" type="int" setter="set_octaves" getter="get_octaves" default="3">
  97. 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.
  98. [b]Note:[/b] The maximum allowed value is 9.
  99. </member>
  100. <member name="period" type="float" setter="set_period" getter="get_period" default="64.0">
  101. Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
  102. </member>
  103. <member name="persistence" type="float" setter="set_persistence" getter="get_persistence" default="0.5">
  104. Contribution factor of the different octaves. A [code]persistence[/code] 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. </member>
  106. <member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
  107. Seed used to generate random values, different seeds will generate different noise maps.
  108. </member>
  109. </members>
  110. <constants>
  111. </constants>
  112. </class>