Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable interpolation and use variable FPS in GPUParticles by default #70777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions doc/classes/GPUParticles2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
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="30">
The particle system's frame rate is fixed to a value. For example, 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.
If set to a value higher than [code]0[/code], fixes particle system's simulation frame rate to the specified value. For example, changing the value to [code]2[/code] will make the particles render at 2 frames per second. If set to [code]0[/code], particles will be simulated every rendered frame. Simulating particles every rendered frame looks the smoothest with [member interpolate] disabled, but it will cause physics simulation to vary depending on rendering FPS. This can be noticeable for particles with collision enabled.
[b]Note:[/b] This does not slow down the simulation of the particle system itself (see [member speed_scale] instead).
</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="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="true">
Enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is lower than the screen refresh rate.
<member name="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="false">
If [code]true[/code], enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is greater than [code]0[/code] but lower than the screen refresh rate.
[b]Note:[/b] Not all particle properties (such as color and scale curves) are interpolated yet.
</member>
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime" default="1.0">
Amount of time each particle will exist.
Expand Down
10 changes: 6 additions & 4 deletions doc/classes/GPUParticles3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@
<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="30">
The particle system's frame rate is fixed to a value. For example, 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 name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps" default="0">
If set to a value higher than [code]0[/code], fixes particle system's simulation frame rate to the specified value. For example, changing the value to [code]2[/code] will make the particles render at 2 frames per second. If set to [code]0[/code], particles will be simulated every rendered frame. Simulating particles every rendered frame looks the smoothest with [member interpolate] disabled, but it will cause physics simulation to vary depending on rendering FPS. This can be noticeable for particles with collision enabled.
[b]Note:[/b] This does not slow down the simulation of the particle system itself (see [member speed_scale] instead).
</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="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="true">
Enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is lower than the screen refresh rate.
<member name="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="false">
If [code]true[/code], enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is greater than [code]0[/code] but lower than the screen refresh rate.
[b]Note:[/b] Not all particle properties (such as color and scale curves) are interpolated yet.
</member>
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime" default="1.0">
Amount of time each particle will exist.
Expand Down
4 changes: 2 additions & 2 deletions drivers/gles3/storage/particles_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class ParticlesStorage : public RendererParticlesStorage {

double speed_scale = 1.0;

int fixed_fps = 30;
bool interpolate = true;
int fixed_fps = 0;
bool interpolate = false;
bool fractional_delta = false;
double frame_remainder = 0;
real_t collision_base_size = 0.01;
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/gpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ GPUParticles2D::GPUParticles2D() {
set_lifetime(1);
set_fixed_fps(0);
set_fractional_delta(true);
set_interpolate(true);
set_interpolate(false);
set_pre_process_time(0);
set_explosiveness_ratio(0);
set_randomness_ratio(0);
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/gpu_particles_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GPUParticles2D : public Node2D {
bool local_coords = false;
int fixed_fps = 0;
bool fractional_delta = false;
bool interpolate = true;
bool interpolate = false;
#ifdef TOOLS_ENABLED
bool show_visibility_rect = false;
#endif
Expand Down
4 changes: 2 additions & 2 deletions scene/3d/gpu_particles_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ GPUParticles3D::GPUParticles3D() {
set_one_shot(false);
set_amount(8);
set_lifetime(1);
set_fixed_fps(30);
set_fixed_fps(0);
set_fractional_delta(true);
set_interpolate(true);
set_interpolate(false);
set_pre_process_time(0);
set_explosiveness_ratio(0);
set_randomness_ratio(0);
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/gpu_particles_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class GPUParticles3D : public GeometryInstance3D {
bool local_coords = false;
int fixed_fps = 0;
bool fractional_delta = false;
bool interpolate = true;
bool interpolate = false;
NodePath sub_emitter;
real_t collision_base_size = 0.01;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class ParticlesStorage : public RendererParticlesStorage {

double speed_scale = 1.0;

int fixed_fps = 30;
bool interpolate = true;
int fixed_fps = 0;
bool interpolate = false;
bool fractional_delta = false;
double frame_remainder = 0;
real_t collision_base_size = 0.01;
Expand Down