-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding back the gpu based particles pt1.
- Loading branch information
Showing
22 changed files
with
2,457 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="Particles" inherits="GeometryInstance" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
GPU-based 3D particle emitter. | ||
</brief_description> | ||
<description> | ||
3D particle node used to create a variety of particle systems and effects. [Particles] features an emitter that generates some number of particles at a given rate. | ||
Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. | ||
[b]Note:[/b] [Particles] only work when using the GLES3 renderer. If using the GLES2 renderer, use [CPUParticles] instead. You can convert [Particles] to [CPUParticles] by selecting the node, clicking the [b]Particles[/b] menu at the top of the 3D editor viewport then choosing [b]Convert to CPUParticles[/b]. | ||
[b]Note:[/b] On macOS, [Particles] rendering is much slower than [CPUParticles] due to transform feedback being implemented on the CPU instead of the GPU. Consider using [CPUParticles] instead when targeting macOS. | ||
[b]Note:[/b] After working on a Particles node, remember to update its [member visibility_aabb] by selecting it, clicking the [b]Particles[/b] menu at the top of the 3D editor viewport then choose [b]Generate Visibility AABB[/b]. Otherwise, particles may suddenly disappear depending on the camera position and angle. | ||
</description> | ||
<tutorials> | ||
<link title="Controlling thousands of fish with Particles">$DOCS_URL/tutorials/performance/vertex_animation/controlling_thousands_of_fish.html</link> | ||
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> | ||
</tutorials> | ||
<methods> | ||
<method name="capture_aabb" qualifiers="const"> | ||
<return type="AABB" /> | ||
<description> | ||
Returns the axis-aligned bounding box that contains all the particles that are active in the current frame. | ||
</description> | ||
</method> | ||
<method name="get_draw_pass_mesh" qualifiers="const"> | ||
<return type="Mesh" /> | ||
<argument index="0" name="pass" type="int" /> | ||
<description> | ||
Returns the [Mesh] that is drawn at index [code]pass[/code]. | ||
</description> | ||
</method> | ||
<method name="restart"> | ||
<return type="void" /> | ||
<description> | ||
Restarts the particle emission, clearing existing particles. | ||
</description> | ||
</method> | ||
<method name="set_draw_pass_mesh"> | ||
<return type="void" /> | ||
<argument index="0" name="pass" type="int" /> | ||
<argument index="1" name="mesh" type="Mesh" /> | ||
<description> | ||
Sets the [Mesh] that is drawn at index [code]pass[/code]. | ||
</description> | ||
</method> | ||
</methods> | ||
<members> | ||
<member name="amount" type="int" setter="set_amount" getter="get_amount" default="8"> | ||
The number of particles emitted in one emission cycle (corresponding to the [member lifetime]). | ||
[b]Note:[/b] Changing [member amount] will reset the particle emission, therefore removing all particles that were already emitted before changing [member amount]. | ||
</member> | ||
<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles.DrawOrder" default="0"> | ||
Particle draw order. Uses [enum DrawOrder] values. | ||
</member> | ||
<member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> | ||
[Mesh] that is drawn for the first draw pass. | ||
</member> | ||
<member name="draw_pass_2" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> | ||
[Mesh] that is drawn for the second draw pass. | ||
</member> | ||
<member name="draw_pass_3" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> | ||
[Mesh] that is drawn for the third draw pass. | ||
</member> | ||
<member name="draw_pass_4" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> | ||
[Mesh] that is drawn for the fourth draw pass. | ||
</member> | ||
<member name="draw_passes" type="int" setter="set_draw_passes" getter="get_draw_passes" default="1"> | ||
The number of draw passes when rendering particles. | ||
</member> | ||
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting" default="true"> | ||
If [code]true[/code], particles are being emitted. | ||
</member> | ||
<member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio" default="0.0"> | ||
Time ratio between each emission. If [code]0[/code], particles are emitted continuously. If [code]1[/code], all particles are emitted simultaneously. | ||
</member> | ||
<member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps" default="0"> | ||
The particle system's frame rate is fixed to a value. For instance, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself. | ||
</member> | ||
<member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta" default="true"> | ||
If [code]true[/code], results in fractional delta calculation which has a smoother particles display effect. | ||
</member> | ||
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime" default="1.0"> | ||
The amount of time each particle will exist (in seconds). | ||
</member> | ||
<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates" default="true"> | ||
If [code]true[/code], particles use the parent node's coordinate space. If [code]false[/code], they use global coordinates. | ||
</member> | ||
<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot" default="false"> | ||
If [code]true[/code], only [code]amount[/code] particles will be emitted. | ||
</member> | ||
<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time" default="0.0"> | ||
Amount of time to preprocess the particles before animation starts. Lets you start the animation some time after particles have started emitting. | ||
</member> | ||
<member name="process_material" type="Material" setter="set_process_material" getter="get_process_material"> | ||
[Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial]. | ||
</member> | ||
<member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio" default="0.0"> | ||
Emission randomness ratio. | ||
</member> | ||
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> | ||
Speed scaling ratio. A value of [code]0[/code] can be used to pause the particles. | ||
</member> | ||
<member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb" default="AABB( -4, -4, -4, 8, 8, 8 )"> | ||
The [AABB] that determines the node's region which needs to be visible on screen for the particle system to be active. | ||
Grow the box if particles suddenly appear/disappear when the node enters/exits the screen. The [AABB] can be grown via code or with the [b]Particles → Generate AABB[/b] editor tool. | ||
[b]Note:[/b] If the [ParticlesMaterial] in use is configured to cast shadows, you may want to enlarge this AABB to ensure the shadow is updated when particles are off-screen. | ||
</member> | ||
</members> | ||
<signals> | ||
<signal name="finished"> | ||
<description> | ||
Emitted when all active particles have finished processing. When [member one_shot] is disabled, particles will process continuously, so this is never emitted. | ||
[b]Note:[/b] Due to the particles being computed on the GPU there might be a delay before the signal gets emitted. | ||
</description> | ||
</signal> | ||
</signals> | ||
<constants> | ||
<constant name="DRAW_ORDER_INDEX" value="0" enum="DrawOrder"> | ||
Particles are drawn in the order emitted. | ||
</constant> | ||
<constant name="DRAW_ORDER_LIFETIME" value="1" enum="DrawOrder"> | ||
Particles are drawn in order of remaining lifetime. | ||
</constant> | ||
<constant name="DRAW_ORDER_VIEW_DEPTH" value="2" enum="DrawOrder"> | ||
Particles are drawn in order of depth. | ||
</constant> | ||
<constant name="MAX_DRAW_PASSES" value="4"> | ||
Maximum number of draw passes supported. | ||
</constant> | ||
</constants> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="Particles2D" inherits="Node2D" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
GPU-based 2D particle emitter. | ||
</brief_description> | ||
<description> | ||
2D particle node used to create a variety of particle systems and effects. [Particles2D] features an emitter that generates some number of particles at a given rate. | ||
Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. | ||
[b]Note:[/b] [Particles2D] only work when using the GLES3 renderer. If using the GLES2 renderer, use [CPUParticles2D] instead. You can convert [Particles2D] to [CPUParticles2D] by selecting the node, clicking the [b]Particles[/b] menu at the top of the 2D editor viewport then choosing [b]Convert to CPUParticles2D[/b]. | ||
[b]Note:[/b] On macOS, [Particles2D] rendering is much slower than [CPUParticles2D] due to transform feedback being implemented on the CPU instead of the GPU. Consider using [CPUParticles2D] instead when targeting macOS. | ||
[b]Note:[/b] After working on a Particles node, remember to update its [member visibility_rect] by selecting it, clicking the [b]Particles[/b] menu at the top of the 2D editor viewport then choose [b]Generate Visibility Rect[/b]. Otherwise, particles may suddenly disappear depending on the camera position and angle. | ||
[b]Note:[/b] Unlike [CPUParticles2D], [Particles2D] currently ignore the texture region defined in [AtlasTexture]s. | ||
</description> | ||
<tutorials> | ||
<link title="Particle systems (2D)">$DOCS_URL/tutorials/2d/particle_systems_2d.html</link> | ||
<link title="2D Particles Demo">https://godotengine.org/asset-library/asset/118</link> | ||
<link title="2D Dodge The Creeps Demo (uses GPUParticles2D for the trail behind the player)">https://godotengine.org/asset-library/asset/515</link> | ||
</tutorials> | ||
<methods> | ||
<method name="capture_rect" qualifiers="const"> | ||
<return type="Rect2" /> | ||
<description> | ||
Returns a rectangle containing the positions of all existing particles. | ||
[b]Note:[/b] When using threaded rendering this method synchronizes the rendering thread. Calling it often may have a negative impact on performance. | ||
</description> | ||
</method> | ||
<method name="restart"> | ||
<return type="void" /> | ||
<description> | ||
Restarts all the existing particles. | ||
</description> | ||
</method> | ||
</methods> | ||
<members> | ||
<member name="amount" type="int" setter="set_amount" getter="get_amount" default="8"> | ||
The number of particles emitted in one emission cycle (corresponding to the [member lifetime]). | ||
[b]Note:[/b] Changing [member amount] will reset the particle emission, therefore removing all particles that were already emitted before changing [member amount]. | ||
</member> | ||
<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles2D.DrawOrder" default="0"> | ||
Particle draw order. Uses [enum DrawOrder] values. | ||
</member> | ||
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting" default="true"> | ||
If [code]true[/code], particles are being emitted. | ||
</member> | ||
<member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio" default="0.0"> | ||
How rapidly particles in an emission cycle are emitted. If greater than [code]0[/code], there will be a gap in emissions before the next cycle begins. | ||
</member> | ||
<member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps" default="0"> | ||
The particle system's frame rate is fixed to a value. For instance, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself. | ||
</member> | ||
<member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta" default="true"> | ||
If [code]true[/code], results in fractional delta calculation which has a smoother particles display effect. | ||
</member> | ||
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime" default="1.0"> | ||
The amount of time each particle will exist (in seconds). | ||
</member> | ||
<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates" default="true"> | ||
If [code]true[/code], particles use the parent node's coordinate space. If [code]false[/code], they use global coordinates. | ||
</member> | ||
<member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map"> | ||
Normal map to be used for the [member texture] property. | ||
[b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines. | ||
</member> | ||
<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot" default="false"> | ||
If [code]true[/code], only one emission cycle occurs. If set [code]true[/code] during a cycle, emission will stop at the cycle's end. | ||
</member> | ||
<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time" default="0.0"> | ||
Particle system starts as if it had already run for this many seconds. | ||
</member> | ||
<member name="process_material" type="Material" setter="set_process_material" getter="get_process_material"> | ||
[Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial]. | ||
</member> | ||
<member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio" default="0.0"> | ||
Emission lifetime randomness ratio. | ||
</member> | ||
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> | ||
Particle system's running speed scaling ratio. A value of [code]0[/code] can be used to pause the particles. | ||
</member> | ||
<member name="texture" type="Texture" setter="set_texture" getter="get_texture"> | ||
Particle texture. If [code]null[/code], particles will be squares. | ||
</member> | ||
<member name="visibility_rect" type="Rect2" setter="set_visibility_rect" getter="get_visibility_rect" default="Rect2( -100, -100, 200, 200 )"> | ||
The [Rect2] that determines the node's region which needs to be visible on screen for the particle system to be active. | ||
Grow the rect if particles suddenly appear/disappear when the node enters/exits the screen. The [Rect2] can be grown via code or with the [b]Particles → Generate Visibility Rect[/b] editor tool. | ||
</member> | ||
</members> | ||
<signals> | ||
<signal name="finished"> | ||
<description> | ||
Emitted when all active particles have finished processing. When [member one_shot] is disabled, particles will process continuously, so this is never emitted. | ||
[b]Note:[/b] Due to the particles being computed on the GPU there might be a delay before the signal gets emitted. | ||
</description> | ||
</signal> | ||
</signals> | ||
<constants> | ||
<constant name="DRAW_ORDER_INDEX" value="0" enum="DrawOrder"> | ||
Particles are drawn in the order emitted. | ||
</constant> | ||
<constant name="DRAW_ORDER_LIFETIME" value="1" enum="DrawOrder"> | ||
Particles are drawn in order of remaining lifetime. | ||
</constant> | ||
</constants> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.