summaryrefslogtreecommitdiff
path: root/modules/opensimplex/doc_classes/OpenSimplexNoise.xml
blob: 604b07b645748081605aa2d49763266f0eadf5e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?xml version="1.0" encoding="UTF-8" ?>
<class name="OpenSimplexNoise" inherits="Resource" version="4.0">
	<brief_description>
		Noise generator based on Open Simplex.
	</brief_description>
	<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:
		[codeblock]
		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))
		[/codeblock]
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="get_image" qualifiers="const">
			<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)" />
			<description>
				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.
			</description>
		</method>
		<method name="get_noise_1d" qualifiers="const">
			<return type="float" />
			<argument index="0" name="x" type="float" />
			<description>
				Returns the 1D noise value [code][-1,1][/code] at the given x-coordinate.
				[b]Note:[/b] This method actually returns the 2D noise value [code][-1,1][/code] with fixed y-coordinate value 0.0.
			</description>
		</method>
		<method name="get_noise_2d" qualifiers="const">
			<return type="float" />
			<argument index="0" name="x" type="float" />
			<argument index="1" name="y" type="float" />
			<description>
				Returns the 2D noise value [code][-1,1][/code] at the given position.
			</description>
		</method>
		<method name="get_noise_2dv" qualifiers="const">
			<return type="float" />
			<argument index="0" name="pos" type="Vector2" />
			<description>
				Returns the 2D noise value [code][-1,1][/code] at the given position.
			</description>
		</method>
		<method name="get_noise_3d" qualifiers="const">
			<return type="float" />
			<argument index="0" name="x" type="float" />
			<argument index="1" name="y" type="float" />
			<argument index="2" name="z" type="float" />
			<description>
				Returns the 3D noise value [code][-1,1][/code] at the given position.
			</description>
		</method>
		<method name="get_noise_3dv" qualifiers="const">
			<return type="float" />
			<argument index="0" name="pos" type="Vector3" />
			<description>
				Returns the 3D noise value [code][-1,1][/code] at the given position.
			</description>
		</method>
		<method name="get_noise_4d" qualifiers="const">
			<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" />
			<description>
				Returns the 4D noise value [code][-1,1][/code] at the given position.
			</description>
		</method>
		<method name="get_seamless_image" qualifiers="const">
			<return type="Image" />
			<argument index="0" name="size" type="int" />
			<description>
				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]).
				[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.
			</description>
		</method>
	</methods>
	<members>
		<member name="lacunarity" type="float" setter="set_lacunarity" getter="get_lacunarity" default="2.0">
			Difference in period between [member octaves].
		</member>
		<member name="octaves" type="int" setter="set_octaves" getter="get_octaves" default="3">
			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.
		</member>
		<member name="period" type="float" setter="set_period" getter="get_period" default="64.0">
			Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
		</member>
		<member name="persistence" type="float" setter="set_persistence" getter="get_persistence" default="0.5">
			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.
		</member>
		<member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
			Seed used to generate random values, different seeds will generate different noise maps.
		</member>
	</members>
</class>