2018-08-25 06:25:06 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 21:18:53 +08:00
<class name= "OpenSimplexNoise" inherits= "Resource" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2018-08-25 06:25:06 +08:00
<brief_description >
Noise generator based on Open Simplex.
</brief_description>
<description >
2018-09-28 19:30:07 +08:00
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:
2018-08-25 06:25:06 +08:00
[codeblock]
2018-09-28 19:30:07 +08:00
var noise = OpenSimplexNoise.new()
2018-08-25 06:25:06 +08:00
# Configure
noise.seed = randi()
noise.octaves = 4
noise.period = 20.0
2018-09-21 15:33:05 +08:00
noise.persistence = 0.8
2018-09-20 02:05:55 +08:00
# Sample
2018-08-25 06:25:06 +08:00
print("Values:")
2018-09-20 02:05:55 +08:00
print(noise.get_noise_2d(1.0, 1.0))
print(noise.get_noise_3d(0.5, 3.0, 15.0))
2018-09-20 17:03:23 +08:00
print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))
2018-08-25 06:25:06 +08:00
[/codeblock]
</description>
<tutorials >
</tutorials>
<methods >
2020-12-04 22:54:48 +08:00
<method name= "get_image" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Image" />
<argument index= "0" name= "width" type= "int" />
<argument index= "1" name= "height" type= "int" />
<argument index= "2" name= "noise_offset" type= "Vector2" default= "Vector2(0, 0)" />
2018-08-25 06:25:06 +08:00
<description >
2021-05-18 12:51:05 +08:00
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.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_1d" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "x" type= "float" />
2019-04-15 20:49:41 +08:00
<description >
2019-06-17 15:52:48 +08:00
Returns the 1D noise value [code][-1,1][/code] at the given x-coordinate.
2019-06-22 07:04:47 +08:00
[b]Note:[/b] This method actually returns the 2D noise value [code][-1,1][/code] with fixed y-coordinate value 0.0.
2019-04-15 20:49:41 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_2d" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "x" type= "float" />
<argument index= "1" name= "y" type= "float" />
2018-08-25 06:25:06 +08:00
<description >
2018-09-20 03:00:10 +08:00
Returns the 2D noise value [code][-1,1][/code] at the given position.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_2dv" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "pos" type= "Vector2" />
2018-08-25 06:25:06 +08:00
<description >
2018-09-20 03:00:10 +08:00
Returns the 2D noise value [code][-1,1][/code] at the given position.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_3d" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "x" type= "float" />
<argument index= "1" name= "y" type= "float" />
<argument index= "2" name= "z" type= "float" />
2018-08-25 06:25:06 +08:00
<description >
2018-09-20 03:00:10 +08:00
Returns the 3D noise value [code][-1,1][/code] at the given position.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_3dv" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "pos" type= "Vector3" />
2018-08-25 06:25:06 +08:00
<description >
2018-09-20 03:00:10 +08:00
Returns the 3D noise value [code][-1,1][/code] at the given position.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_noise_4d" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
<argument index= "0" name= "x" type= "float" />
<argument index= "1" name= "y" type= "float" />
<argument index= "2" name= "z" type= "float" />
<argument index= "3" name= "w" type= "float" />
2018-08-25 06:25:06 +08:00
<description >
2018-09-20 03:00:10 +08:00
Returns the 4D noise value [code][-1,1][/code] at the given position.
2018-08-25 06:25:06 +08:00
</description>
</method>
2020-12-04 22:54:48 +08:00
<method name= "get_seamless_image" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Image" />
<argument index= "0" name= "size" type= "int" />
2018-08-25 06:25:06 +08:00
<description >
2021-01-07 11:01:21 +08:00
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]).
2020-11-03 01:47:08 +08:00
[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.
2018-08-25 06:25:06 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "lacunarity" type= "float" setter= "set_lacunarity" getter= "get_lacunarity" default= "2.0" >
2018-08-25 06:25:06 +08:00
Difference in period between [member octaves].
</member>
2019-06-29 18:38:01 +08:00
<member name= "octaves" type= "int" setter= "set_octaves" getter= "get_octaves" default= "3" >
2020-01-31 06:49:17 +08:00
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.
[b]Note:[/b] The maximum allowed value is 9.
2018-08-25 06:25:06 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "period" type= "float" setter= "set_period" getter= "get_period" default= "64.0" >
2018-09-21 21:34:11 +08:00
Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
2018-08-25 06:25:06 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "persistence" type= "float" setter= "set_persistence" getter= "get_persistence" default= "0.5" >
2018-09-21 21:34:11 +08:00
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.
2018-08-25 06:25:06 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "seed" type= "int" setter= "set_seed" getter= "get_seed" default= "0" >
2018-08-25 06:25:06 +08:00
Seed used to generate random values, different seeds will generate different noise maps.
</member>
</members>
</class>