ParticlesMaterial.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ParticlesMaterial" inherits="Material" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Particle properties for [Particles] and [Particles2D] nodes.
  5. </brief_description>
  6. <description>
  7. ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [Particles] and [Particles2D] emitter nodes.
  8. Some of this material's properties are applied to each particle when emitted, while others can have a [CurveTexture] applied to vary values over the lifetime of the particle.
  9. When a randomness ratio is applied to a property it is used to scale that property by a random amount. The random ratio is used to interpolate between [code]1.0[/code] and a random number less than one, the result is multiplied by the property to obtain the randomized property. For example a random ratio of [code]0.4[/code] would scale the original property between [code]0.4-1.0[/code] of its original value.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="get_flag" qualifiers="const">
  15. <return type="bool" />
  16. <argument index="0" name="flag" type="int" enum="ParticlesMaterial.Flags" />
  17. <description>
  18. Returns [code]true[/code] if the specified flag is enabled.
  19. </description>
  20. </method>
  21. <method name="get_param" qualifiers="const">
  22. <return type="float" />
  23. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  24. <description>
  25. Returns the value of the specified parameter.
  26. </description>
  27. </method>
  28. <method name="get_param_randomness" qualifiers="const">
  29. <return type="float" />
  30. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  31. <description>
  32. Returns the randomness ratio associated with the specified parameter.
  33. </description>
  34. </method>
  35. <method name="get_param_texture" qualifiers="const">
  36. <return type="Texture" />
  37. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  38. <description>
  39. Returns the [Texture] used by the specified parameter.
  40. </description>
  41. </method>
  42. <method name="set_flag">
  43. <return type="void" />
  44. <argument index="0" name="flag" type="int" enum="ParticlesMaterial.Flags" />
  45. <argument index="1" name="enable" type="bool" />
  46. <description>
  47. If [code]true[/code], enables the specified flag. See [enum Flags] for options.
  48. </description>
  49. </method>
  50. <method name="set_param">
  51. <return type="void" />
  52. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  53. <argument index="1" name="value" type="float" />
  54. <description>
  55. Sets the specified [enum Parameter].
  56. </description>
  57. </method>
  58. <method name="set_param_randomness">
  59. <return type="void" />
  60. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  61. <argument index="1" name="randomness" type="float" />
  62. <description>
  63. Sets the randomness ratio for the specified [enum Parameter].
  64. </description>
  65. </method>
  66. <method name="set_param_texture">
  67. <return type="void" />
  68. <argument index="0" name="param" type="int" enum="ParticlesMaterial.Parameter" />
  69. <argument index="1" name="texture" type="Texture" />
  70. <description>
  71. Sets the [Texture] for the specified [enum Parameter].
  72. </description>
  73. </method>
  74. </methods>
  75. <members>
  76. <member name="angle" type="float" setter="set_param" getter="get_param" default="0.0">
  77. Initial rotation applied to each particle, in degrees.
  78. [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
  79. </member>
  80. <member name="angle_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  81. Each particle's rotation will be animated along this [CurveTexture].
  82. </member>
  83. <member name="angle_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  84. Rotation randomness ratio.
  85. </member>
  86. <member name="angular_velocity" type="float" setter="set_param" getter="get_param" default="0.0">
  87. Initial angular velocity applied to each particle in [i]degrees[/i] per second. Sets the speed of rotation of the particle.
  88. [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
  89. </member>
  90. <member name="angular_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  91. Each particle's angular velocity will vary along this [CurveTexture].
  92. </member>
  93. <member name="angular_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  94. Angular velocity randomness ratio.
  95. </member>
  96. <member name="anim_offset" type="float" setter="set_param" getter="get_param" default="0.0">
  97. Particle animation offset.
  98. </member>
  99. <member name="anim_offset_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  100. Each particle's animation offset will vary along this [CurveTexture].
  101. </member>
  102. <member name="anim_offset_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  103. Animation offset randomness ratio.
  104. </member>
  105. <member name="anim_speed" type="float" setter="set_param" getter="get_param" default="0.0">
  106. Particle animation speed.
  107. </member>
  108. <member name="anim_speed_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  109. Each particle's animation speed will vary along this [CurveTexture].
  110. </member>
  111. <member name="anim_speed_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  112. Animation speed randomness ratio.
  113. </member>
  114. <member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
  115. Each particle's initial color. If the [Particles2D]'s or [Particles]'s [code]texture[/code] is defined, it will be multiplied by this color.
  116. [b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
  117. </member>
  118. <member name="color_initial_ramp" type="Texture" setter="set_color_initial_ramp" getter="get_color_initial_ramp">
  119. Each particle's initial color will vary along this [GradientTexture] (multiplied with [member color]).
  120. [b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
  121. </member>
  122. <member name="color_ramp" type="Texture" setter="set_color_ramp" getter="get_color_ramp">
  123. Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]).
  124. [b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
  125. </member>
  126. <member name="damping" type="float" setter="set_param" getter="get_param" default="0.0">
  127. The rate at which particles lose velocity.
  128. </member>
  129. <member name="damping_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  130. Damping will vary along this [CurveTexture].
  131. </member>
  132. <member name="damping_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  133. Damping randomness ratio.
  134. </member>
  135. <member name="direction" type="Vector3" setter="set_direction" getter="get_direction" default="Vector3( 1, 0, 0 )">
  136. Unit vector specifying the particles' emission direction.
  137. </member>
  138. <member name="emission_box_extents" type="Vector3" setter="set_emission_box_extents" getter="get_emission_box_extents">
  139. The box's extents if [code]emission_shape[/code] is set to [constant EMISSION_SHAPE_BOX].
  140. </member>
  141. <member name="emission_color_texture" type="Texture" setter="set_emission_color_texture" getter="get_emission_color_texture">
  142. Particle color will be modulated by color determined by sampling this texture at the same point as the [member emission_point_texture].
  143. [b]Note:[/b] [member emission_color_texture] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_color_texture] will have no visible effect.
  144. </member>
  145. <member name="emission_normal_texture" type="Texture" setter="set_emission_normal_texture" getter="get_emission_normal_texture">
  146. Particle velocity and rotation will be set by sampling this texture at the same point as the [member emission_point_texture]. Used only in [constant EMISSION_SHAPE_DIRECTED_POINTS]. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.
  147. </member>
  148. <member name="emission_point_count" type="int" setter="set_emission_point_count" getter="get_emission_point_count">
  149. The number of emission points if [code]emission_shape[/code] is set to [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
  150. </member>
  151. <member name="emission_point_texture" type="Texture" setter="set_emission_point_texture" getter="get_emission_point_texture">
  152. Particles will be emitted at positions determined by sampling this texture at a random position. Used with [constant EMISSION_SHAPE_POINTS] and [constant EMISSION_SHAPE_DIRECTED_POINTS]. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.
  153. </member>
  154. <member name="emission_ring_axis" type="Vector3" setter="set_emission_ring_axis" getter="get_emission_ring_axis">
  155. The axis of the ring when using the emitter [constant EMISSION_SHAPE_RING].
  156. </member>
  157. <member name="emission_ring_height" type="float" setter="set_emission_ring_height" getter="get_emission_ring_height">
  158. The height of the ring when using the emitter [constant EMISSION_SHAPE_RING].
  159. </member>
  160. <member name="emission_ring_inner_radius" type="float" setter="set_emission_ring_inner_radius" getter="get_emission_ring_inner_radius">
  161. The inner radius of the ring when using the emitter [constant EMISSION_SHAPE_RING].
  162. </member>
  163. <member name="emission_ring_radius" type="float" setter="set_emission_ring_radius" getter="get_emission_ring_radius">
  164. The radius of the ring when using the emitter [constant EMISSION_SHAPE_RING].
  165. </member>
  166. <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="ParticlesMaterial.EmissionShape" default="0">
  167. Particles will be emitted inside this region. Use [enum EmissionShape] constants for values.
  168. </member>
  169. <member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius">
  170. The sphere's radius if [code]emission_shape[/code] is set to [constant EMISSION_SHAPE_SPHERE].
  171. </member>
  172. <member name="flag_align_y" type="bool" setter="set_flag" getter="get_flag" default="false">
  173. Align Y axis of particle with the direction of its velocity.
  174. </member>
  175. <member name="flag_disable_z" type="bool" setter="set_flag" getter="get_flag" default="false">
  176. If [code]true[/code], particles will not move on the z axis.
  177. </member>
  178. <member name="flag_rotate_y" type="bool" setter="set_flag" getter="get_flag" default="false">
  179. If [code]true[/code], particles rotate around Y axis by [member angle].
  180. </member>
  181. <member name="flatness" type="float" setter="set_flatness" getter="get_flatness" default="0.0">
  182. Amount of [member spread] along the Y axis.
  183. </member>
  184. <member name="gravity" type="Vector3" setter="set_gravity" getter="get_gravity" default="Vector3( 0, -9.8, 0 )">
  185. Gravity applied to every particle.
  186. </member>
  187. <member name="hue_variation" type="float" setter="set_param" getter="get_param" default="0.0">
  188. Initial hue variation applied to each particle.
  189. </member>
  190. <member name="hue_variation_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  191. Each particle's hue will vary along this [CurveTexture].
  192. </member>
  193. <member name="hue_variation_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  194. Hue variation randomness ratio.
  195. </member>
  196. <member name="initial_velocity" type="float" setter="set_param" getter="get_param" default="0.0">
  197. Initial velocity magnitude for each particle. Direction comes from [member spread] and the node's orientation.
  198. </member>
  199. <member name="initial_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  200. Initial velocity randomness ratio.
  201. </member>
  202. <member name="lifetime_randomness" type="float" setter="set_lifetime_randomness" getter="get_lifetime_randomness" default="0.0">
  203. Particle lifetime randomness ratio.
  204. </member>
  205. <member name="linear_accel" type="float" setter="set_param" getter="get_param" default="0.0">
  206. Linear acceleration applied to each particle in the direction of motion.
  207. </member>
  208. <member name="linear_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  209. Each particle's linear acceleration will vary along this [CurveTexture].
  210. </member>
  211. <member name="linear_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  212. Linear acceleration randomness ratio.
  213. </member>
  214. <member name="orbit_velocity" type="float" setter="set_param" getter="get_param">
  215. Orbital velocity applied to each particle. Makes the particles circle around origin. Specified in number of full rotations around origin per second.
  216. [b]Note:[/b] Only available when [member flag_disable_z] is [code]true[/code].
  217. </member>
  218. <member name="orbit_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  219. Each particle's orbital velocity will vary along this [CurveTexture].
  220. </member>
  221. <member name="orbit_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
  222. Orbital velocity randomness ratio.
  223. </member>
  224. <member name="radial_accel" type="float" setter="set_param" getter="get_param" default="0.0">
  225. Radial acceleration applied to each particle. Makes particle accelerate away from origin.
  226. </member>
  227. <member name="radial_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  228. Each particle's radial acceleration will vary along this [CurveTexture].
  229. </member>
  230. <member name="radial_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  231. Radial acceleration randomness ratio.
  232. </member>
  233. <member name="scale" type="float" setter="set_param" getter="get_param" default="1.0">
  234. Initial scale applied to each particle. This can be set to a negative value to flip the particle on all axes.
  235. </member>
  236. <member name="scale_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  237. Each particle's scale will vary along this [CurveTexture].
  238. </member>
  239. <member name="scale_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  240. Scale randomness ratio.
  241. </member>
  242. <member name="spread" type="float" setter="set_spread" getter="get_spread" default="45.0">
  243. Each particle's initial direction range from [code]+spread[/code] to [code]-spread[/code] degrees.
  244. </member>
  245. <member name="tangential_accel" type="float" setter="set_param" getter="get_param" default="0.0">
  246. Tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion.
  247. </member>
  248. <member name="tangential_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
  249. Each particle's tangential acceleration will vary along this [CurveTexture].
  250. </member>
  251. <member name="tangential_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0">
  252. Tangential acceleration randomness ratio.
  253. </member>
  254. <member name="trail_color_modifier" type="GradientTexture" setter="set_trail_color_modifier" getter="get_trail_color_modifier">
  255. Trail particles' color will vary along this [GradientTexture].
  256. </member>
  257. <member name="trail_divisor" type="int" setter="set_trail_divisor" getter="get_trail_divisor" default="1">
  258. Emitter will emit [code]amount[/code] divided by [code]trail_divisor[/code] particles. The remaining particles will be used as trail(s).
  259. </member>
  260. <member name="trail_size_modifier" type="CurveTexture" setter="set_trail_size_modifier" getter="get_trail_size_modifier">
  261. Trail particles' size will vary along this [CurveTexture].
  262. </member>
  263. </members>
  264. <constants>
  265. <constant name="PARAM_INITIAL_LINEAR_VELOCITY" value="0" enum="Parameter">
  266. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set initial velocity properties.
  267. </constant>
  268. <constant name="PARAM_ANGULAR_VELOCITY" value="1" enum="Parameter">
  269. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angular velocity properties.
  270. </constant>
  271. <constant name="PARAM_ORBIT_VELOCITY" value="2" enum="Parameter">
  272. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set orbital velocity properties.
  273. </constant>
  274. <constant name="PARAM_LINEAR_ACCEL" value="3" enum="Parameter">
  275. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set linear acceleration properties.
  276. </constant>
  277. <constant name="PARAM_RADIAL_ACCEL" value="4" enum="Parameter">
  278. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set radial acceleration properties.
  279. </constant>
  280. <constant name="PARAM_TANGENTIAL_ACCEL" value="5" enum="Parameter">
  281. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set tangential acceleration properties.
  282. </constant>
  283. <constant name="PARAM_DAMPING" value="6" enum="Parameter">
  284. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set damping properties.
  285. </constant>
  286. <constant name="PARAM_ANGLE" value="7" enum="Parameter">
  287. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angle properties.
  288. </constant>
  289. <constant name="PARAM_SCALE" value="8" enum="Parameter">
  290. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set scale properties.
  291. </constant>
  292. <constant name="PARAM_HUE_VARIATION" value="9" enum="Parameter">
  293. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set hue variation properties.
  294. </constant>
  295. <constant name="PARAM_ANIM_SPEED" value="10" enum="Parameter">
  296. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation speed properties.
  297. </constant>
  298. <constant name="PARAM_ANIM_OFFSET" value="11" enum="Parameter">
  299. Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation offset properties.
  300. </constant>
  301. <constant name="PARAM_MAX" value="12" enum="Parameter">
  302. Represents the size of the [enum Parameter] enum.
  303. </constant>
  304. <constant name="FLAG_ALIGN_Y_TO_VELOCITY" value="0" enum="Flags">
  305. Use with [method set_flag] to set [member flag_align_y].
  306. </constant>
  307. <constant name="FLAG_ROTATE_Y" value="1" enum="Flags">
  308. Use with [method set_flag] to set [member flag_rotate_y].
  309. </constant>
  310. <constant name="FLAG_DISABLE_Z" value="2" enum="Flags">
  311. Use with [method set_flag] to set [member flag_disable_z].
  312. </constant>
  313. <constant name="FLAG_MAX" value="3" enum="Flags">
  314. Represents the size of the [enum Flags] enum.
  315. </constant>
  316. <constant name="EMISSION_SHAPE_POINT" value="0" enum="EmissionShape">
  317. All particles will be emitted from a single point.
  318. </constant>
  319. <constant name="EMISSION_SHAPE_SPHERE" value="1" enum="EmissionShape">
  320. Particles will be emitted in the volume of a sphere.
  321. </constant>
  322. <constant name="EMISSION_SHAPE_BOX" value="2" enum="EmissionShape">
  323. Particles will be emitted in the volume of a box.
  324. </constant>
  325. <constant name="EMISSION_SHAPE_POINTS" value="3" enum="EmissionShape">
  326. Particles will be emitted at a position determined by sampling a random point on the [member emission_point_texture]. Particle color will be modulated by [member emission_color_texture].
  327. </constant>
  328. <constant name="EMISSION_SHAPE_DIRECTED_POINTS" value="4" enum="EmissionShape">
  329. Particles will be emitted at a position determined by sampling a random point on the [member emission_point_texture]. Particle velocity and rotation will be set based on [member emission_normal_texture]. Particle color will be modulated by [member emission_color_texture].
  330. </constant>
  331. <constant name="EMISSION_SHAPE_RING" value="5" enum="EmissionShape">
  332. Particles will be emitted in a ring or cylinder.
  333. </constant>
  334. <constant name="EMISSION_SHAPE_MAX" value="6" enum="EmissionShape">
  335. Represents the size of the [enum EmissionShape] enum.
  336. </constant>
  337. </constants>
  338. </class>