From 3a4a2198edbdd5222eac2746881ceda3b96fbe48 Mon Sep 17 00:00:00 2001 From: Hendrik Brucker Date: Sun, 4 Jul 2021 02:14:31 +0200 Subject: [PATCH] Fix color properties of particle nodes/material --- doc/classes/CPUParticles2D.xml | 2 +- doc/classes/CPUParticles3D.xml | 4 ++-- doc/classes/ParticlesMaterial.xml | 2 +- scene/2d/cpu_particles_2d.cpp | 4 ---- scene/3d/cpu_particles_3d.cpp | 4 ---- scene/resources/particles_material.cpp | 6 +----- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml index 9620e9abd1d..22f070b73b0 100644 --- a/doc/classes/CPUParticles2D.xml +++ b/doc/classes/CPUParticles2D.xml @@ -152,7 +152,7 @@ Each particle's initial color. If [member texture] is defined, it will be multiplied by this color. - Each particle's color will vary along this [Gradient]. + Each particle's color will vary along this [Gradient] (multiplied with [member color]). The rate at which particles lose velocity. diff --git a/doc/classes/CPUParticles3D.xml b/doc/classes/CPUParticles3D.xml index 7509775d20f..d7a89eef113 100644 --- a/doc/classes/CPUParticles3D.xml +++ b/doc/classes/CPUParticles3D.xml @@ -148,10 +148,10 @@ Animation speed randomness ratio. - Unused for 3D particles. + Each particle's initial color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code]. - Unused for 3D particles. + Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]). The rate at which particles lose velocity. diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index e8fde21032a..52430b3f455 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -145,7 +145,7 @@ Each particle's initial color. If the [GPUParticles2D]'s [code]texture[/code] is defined, it will be multiplied by this color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code]. - Each particle's color will vary along this [GradientTexture]. + Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]). The rate at which particles lose velocity. diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 24f3301ce12..a341ba69ac3 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -463,10 +463,6 @@ Vector2 CPUParticles2D::get_gravity() const { } void CPUParticles2D::_validate_property(PropertyInfo &property) const { - if (property.name == "color" && color_ramp.is_valid()) { - property.usage = PROPERTY_USAGE_NONE; - } - if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) { property.usage = PROPERTY_USAGE_NONE; } diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 6dc865ec0ee..178a269f177 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -434,10 +434,6 @@ Vector3 CPUParticles3D::get_gravity() const { } void CPUParticles3D::_validate_property(PropertyInfo &property) const { - if (property.name == "color" && color_ramp.is_valid()) { - property.usage = PROPERTY_USAGE_NONE; - } - if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) { property.usage = PROPERTY_USAGE_NONE; } diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index e95df31ccce..208b2a4590c 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -569,7 +569,7 @@ void ParticlesMaterial::_update_shader() { code += " vec4(1.250, -1.050, -0.203, 0.0),\n"; code += " vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_s;\n"; if (color_ramp.is_valid()) { - code += " COLOR = hue_rot_mat * textureLod(color_ramp, vec2(tv, 0.0), 0.0);\n"; + code += " COLOR = hue_rot_mat * textureLod(color_ramp, vec2(tv, 0.0), 0.0) * color_value;\n"; } else { code += " COLOR = hue_rot_mat * color_value;\n"; } @@ -1040,10 +1040,6 @@ RID ParticlesMaterial::get_shader_rid() const { } void ParticlesMaterial::_validate_property(PropertyInfo &property) const { - if (property.name == "color" && color_ramp.is_valid()) { - property.usage = PROPERTY_USAGE_NONE; - } - if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) { property.usage = PROPERTY_USAGE_NONE; }