diff --git a/assets/textures/TrailParticle.png b/assets/textures/TrailParticle.png deleted file mode 100644 index 8d2c68ea957..00000000000 --- a/assets/textures/TrailParticle.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a605cbbf1e276d7e20dba35d898833f9df26b45aab70a0198dcd8fffd29cba1 -size 3736 diff --git a/assets/textures/TrailParticle.png.import b/assets/textures/TrailParticle.png.import deleted file mode 100644 index c824e607be9..00000000000 --- a/assets/textures/TrailParticle.png.import +++ /dev/null @@ -1,42 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://dufk485jxbiin" -path.s3tc="res://.godot/imported/TrailParticle.png-5f501eb2997a563343275ee00dc94c86.s3tc.ctex" -path.etc2="res://.godot/imported/TrailParticle.png-5f501eb2997a563343275ee00dc94c86.etc2.ctex" -metadata={ -"imported_formats": ["s3tc_bptc", "etc2_astc"], -"vram_texture": true -} - -[deps] - -source_file="res://assets/textures/TrailParticle.png" -dest_files=["res://.godot/imported/TrailParticle.png-5f501eb2997a563343275ee00dc94c86.s3tc.ctex", "res://.godot/imported/TrailParticle.png-5f501eb2997a563343275ee00dc94c86.etc2.ctex"] - -[params] - -compress/mode=2 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=true -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=0 diff --git a/shaders/CurrentsParticles.gdshader b/shaders/CurrentsParticles.gdshader index 8c3076b8d96..5b71267f9e1 100644 --- a/shaders/CurrentsParticles.gdshader +++ b/shaders/CurrentsParticles.gdshader @@ -1,5 +1,4 @@ shader_type particles; -render_mode disable_velocity; uniform vec3 emissionBoxExtents; uniform vec4 colorValue : source_color; @@ -20,6 +19,8 @@ uniform float brightness; const float currentsTimescale = 0.25f; const float positionScaling = 0.9f; +uniform float particleDepthVariation = 1.0f; + // Generates a random float and modifies the seed float RandFromSeed(inout uint seed) { int k; @@ -55,11 +56,18 @@ void start() { TRANSFORM[3].xyz = vec3(RandFromSeed(altSeed) * 2.0 - 1.0, RandFromSeed(altSeed) * 2.0 - 1.0, RandFromSeed(altSeed) * 2.0 - 1.0) * emissionBoxExtents; TRANSFORM = EMISSION_TRANSFORM * TRANSFORM; - float visibleScale = RandFromSeed(altSeed) * 0.75f + 0.625f; + + float backgroundFactor = RandFromSeed(altSeed) * particleDepthVariation; + float adjustedBackgroundFactor = pow(backgroundFactor, 3.0f); + TRANSFORM[3].y -= adjustedBackgroundFactor * 80.0f; + float visibleScale = RandFromSeed(altSeed) * 0.75f + 0.625f + + adjustedBackgroundFactor * 35.0f; + TRANSFORM[0].xyz *= visibleScale; TRANSFORM[1].xyz *= visibleScale; TRANSFORM[2].xyz *= visibleScale; - CUSTOM.w = RandFromSeed(altSeed) * 0.2f + 0.8f; + + CUSTOM.w = 1.0f - backgroundFactor * 0.9f; CUSTOM.z = gameTime + LIFETIME * 0.5f; } @@ -92,12 +100,11 @@ void process() { current *= 10.0f * speed; } - VELOCITY = mix(vec3(current.x, 0.0f, current.y), VELOCITY, 1.0f - DELTA * 5.0f); - - TRANSFORM[3].xyz += VELOCITY * DELTA; + VELOCITY = mix(VELOCITY, vec3(current.x, 0.0f, current.y), DELTA * 5.0f); + VELOCITY *= CUSTOM.w * 0.05f + 0.95f; vec4 finalColor = colorValue; - finalColor.rgb *= CUSTOM.w; + finalColor.rgba *= CUSTOM.w; finalColor.a *= texture(alphaCurve, vec2(lifetimePercent)).r; if (speed != 0.0) { diff --git a/simulation_parameters/microbe_stage/backgrounds.json b/simulation_parameters/microbe_stage/backgrounds.json index 758e5a3102f..30db85f66d1 100644 --- a/simulation_parameters/microbe_stage/backgrounds.json +++ b/simulation_parameters/microbe_stage/backgrounds.json @@ -95,8 +95,7 @@ "res://assets/textures/background/Thrive_vent1.png", "res://assets/textures/background/Thrive_vent2.png", "res://assets/textures/background/Thrive_vent3.png" - ], - "ParticleEffect": "res://src/microbe_stage/particles/background/Vent.tscn" + ] }, "banana": { "Textures": [ diff --git a/simulation_parameters/microbe_stage/biomes.json b/simulation_parameters/microbe_stage/biomes.json index 1d85be45385..df9fa503e42 100644 --- a/simulation_parameters/microbe_stage/biomes.json +++ b/simulation_parameters/microbe_stage/biomes.json @@ -36,7 +36,7 @@ "r": 0.434, "g": 0.505, "b": 0.498, - "a": 0.75 + "a": 1.0 } }, "CompoundCloudBrightness": 1.3, @@ -230,7 +230,13 @@ "Speed": 0.6, "Chaoticness": 0.5, "InverseScale": 1.0, - "ParticleCount": 900 + "ParticleCount": 900, + "Colour": { + "r": 1.0, + "g": 0.49, + "b": 0.09, + "a": 1 + } }, "ActiveMusicContexts": [ "PatchVents" @@ -757,7 +763,7 @@ "r": 0.434, "g": 0.505, "b": 0.498, - "a": 0.8 + "a": 1.0 } }, "ActiveMusicContexts": [ @@ -1148,7 +1154,13 @@ "Speed": 0.75, "Chaoticness": 0.75, "InverseScale": 0.8, - "ParticleCount": 1000 + "ParticleCount": 1000, + "Colour": { + "r": 0.24, + "g": 0.605, + "b": 0.776, + "a": 1.0 + } }, "GasVolume": 1, "Conditions": { @@ -1369,7 +1381,13 @@ "Speed": 0.65, "Chaoticness": 0.65, "InverseScale": 0.9, - "ParticleCount": 800 + "ParticleCount": 800, + "Colour": { + "r": 0.035, + "g": 0.159, + "b": 0.209, + "a": 1.0 + } }, "GasVolume": 1, "Conditions": { @@ -1646,7 +1664,7 @@ "r": 0.32, "g": 0.4, "b": 0.39, - "a": 0.75 + "a": 1.0 } }, "GasVolume": 1, @@ -1957,7 +1975,7 @@ "r": 0.434, "g": 0.505, "b": 0.498, - "a": 0.75 + "a": 1.0 } }, "CompoundCloudBrightness": 2.5, @@ -2345,7 +2363,13 @@ "Speed": 0.5, "Chaoticness": 1.0, "InverseScale": 1.0, - "ParticleCount": 1000 + "ParticleCount": 1000, + "Colour": { + "r": 0.544, + "g": 0.592, + "b": 0.881, + "a": 1.0 + } }, "GasVolume": 1, "Conditions": { @@ -2985,7 +3009,7 @@ "r": 0.434, "g": 0.505, "b": 0.498, - "a": 0.75 + "a": 1.0 } }, "EnvironmentColour": { @@ -3429,7 +3453,13 @@ "Speed": 0.75, "Chaoticness": 0.75, "InverseScale": 0.8, - "ParticleCount": 900 + "ParticleCount": 900, + "Colour": { + "r": 0.45, + "g": 0.7, + "b": 0.9, + "a": 1.0 + } }, "GasVolume": 1, "Conditions": { @@ -3876,7 +3906,7 @@ "r": 0.434, "g": 0.505, "b": 0.498, - "a": 0.5 + "a": 1.0 } }, "CompoundCloudBrightness": 2.2, diff --git a/src/microbe_stage/Background.cs b/src/microbe_stage/Background.cs index b9f5149b1d7..cf5f0ec0946 100644 --- a/src/microbe_stage/Background.cs +++ b/src/microbe_stage/Background.cs @@ -11,11 +11,10 @@ public class Background : IRegistryType [JsonRequired] public List Textures = null!; - [JsonRequired] - public string ParticleEffect = null!; + public string? ParticleEffect; [JsonIgnore] - public PackedScene ParticleEffectScene = null!; + public PackedScene? ParticleEffectScene; public string InternalName { get; set; } = null!; @@ -26,12 +25,6 @@ public void Check(string name) throw new InvalidRegistryDataException(name, GetType().Name, "Background needs 4 layers"); } - - if (string.IsNullOrEmpty(ParticleEffect)) - { - throw new InvalidRegistryDataException(name, GetType().Name, - "ParticleEffect is missing"); - } } /// @@ -52,8 +45,8 @@ public void Resolve(SimulationParameters parameters) } } #endif - - ParticleEffectScene = GD.Load(ParticleEffect); + if (ParticleEffect != null) + ParticleEffectScene = GD.Load(ParticleEffect); } public void ApplyTranslations() diff --git a/src/microbe_stage/BackgroundPlane.cs b/src/microbe_stage/BackgroundPlane.cs index eb80eca0ab3..05b32bd48ca 100644 --- a/src/microbe_stage/BackgroundPlane.cs +++ b/src/microbe_stage/BackgroundPlane.cs @@ -133,6 +133,9 @@ public void SetBackground(Background background) backgroundParticles?.DetachAndQueueFree(); + if (background.ParticleEffectScene == null) + return; + backgroundParticles = background.ParticleEffectScene.Instantiate(); backgroundParticles.Rotation = Rotation; backgroundParticles.LocalCoords = false; diff --git a/src/microbe_stage/FluidCurrentDisplay.cs b/src/microbe_stage/FluidCurrentDisplay.cs index c76dfd1ca35..83464f8d166 100644 --- a/src/microbe_stage/FluidCurrentDisplay.cs +++ b/src/microbe_stage/FluidCurrentDisplay.cs @@ -13,6 +13,7 @@ public partial class FluidCurrentDisplay : GpuParticles3D private readonly StringName inverseScaleParameterName = new("inverseScale"); private readonly StringName brightnessParameterName = new("brightness"); private readonly StringName colorParameterName = new("colorValue"); + private readonly StringName particleDepthVariationParameterName = new("particleDepthVariation"); #pragma warning disable CA2213 [Export] @@ -79,10 +80,12 @@ public void ApplyBiome(Biome biome) if (biome.WaterCurrents.UseTrails) { DrawPass1 = trailedParticleMesh; + material.SetShaderParameter(particleDepthVariationParameterName, 0.0f); } else { DrawPass1 = normalParticleMesh; + material.SetShaderParameter(particleDepthVariationParameterName, 1.0f); } Amount = biome.WaterCurrents.ParticleCount; @@ -113,6 +116,7 @@ protected override void Dispose(bool disposing) inverseScaleParameterName.Dispose(); brightnessParameterName.Dispose(); colorParameterName.Dispose(); + particleDepthVariationParameterName.Dispose(); } base.Dispose(disposing); diff --git a/src/microbe_stage/FluidCurrentDisplay.tscn b/src/microbe_stage/FluidCurrentDisplay.tscn index a98bdb05f34..5d70608b019 100644 --- a/src/microbe_stage/FluidCurrentDisplay.tscn +++ b/src/microbe_stage/FluidCurrentDisplay.tscn @@ -26,6 +26,7 @@ shader_parameter/speed = 1.0 shader_parameter/chaoticness = 0.0 shader_parameter/inverseScale = 1.0 shader_parameter/brightness = 1.0 +shader_parameter/particleDepthVariation = 1.0 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mse0a"] transparency = 1