From 3e499c31eea273a62172ed9746047e38d70a06d8 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 4 Dec 2026 23:56:25 +0100 Subject: [PATCH] hud: drop [T] CONDUITS layer, always-active thermal glow, and directional hit-arcs --- client/Hud.cs | 190 +++++++++++++++++++++++++++------ client/InventoryGridControl.cs | 57 +--------- client/Main.cs | 38 ++++--- client/inventory_grid.gdshader | 62 ++--------- 4 files changed, 193 insertions(+), 154 deletions(-) diff --git a/client/Hud.cs b/client/Hud.cs index de811bc..e1fa5d5 100644 --- a/client/Hud.cs +++ b/client/Hud.cs @@ -43,7 +43,6 @@ public partial class Hud : CanvasLayer private RadarWidget _radar = null!; private CrosshairOverlay _crosshair = null!; private InventoryGridControl _schematic = null!; - private Button _thermalButton = null!; private Label _hoverLabel = null!; private VBoxContainer _cargoList = null!; private Label _cargoHeader = null!; @@ -73,8 +72,10 @@ public partial class Hud : CanvasLayer } public bool GarageExpanded => _garageExpanded; - public bool ThermalMode => _schematic.ThermalEnabled; public InventoryGridControl Schematic => _schematic; + internal int ActiveHitArcCount => _crosshair.ActiveHitArcCount; + internal void PushTestHitArc(float sourceX, float sourceZ, WeaponVisualClass weaponClass) => + _crosshair.PushTestHitArc(sourceX, sourceZ, weaponClass); internal Rect2 BottomLeftPanelRect => _bottomLeftPanel.GetGlobalRect(); internal Rect2 ChyronPanelRect => _chyronPanel.GetGlobalRect(); @@ -95,21 +96,9 @@ public partial class Hud : CanvasLayer _schematic.QueueRedraw(); } - public void ToggleThermal() => SetThermalMode(!_schematic.ThermalEnabled); - - public void SetThermalMode(bool enabled, bool instant = false) + public override void _Process(double delta) { - if (instant) - { - _schematic.SetThermalInstant(enabled); - } - else - { - _schematic.ThermalEnabled = enabled; - } - _thermalButton.ButtonPressed = enabled; - _thermalButton.Modulate = enabled ? CyanCol : TextMuted; - _thermalButton.Text = enabled ? "[T] CONDUITS: ON" : "[T] CONDUITS"; + _crosshair?.Advance((float)delta); } public override void _Ready() @@ -185,7 +174,7 @@ public partial class Hud : CanvasLayer else { _statsLabel.Text = $"SPD {player.Speed:F1} m/s | ALIVE {aliveCount} / {state.Contenders.Count} | KILLS {player.Kills}"; - _controlsHint.Text = "WASD Drive | Mouse Aim | LMB Fire | E Bolt/Swap | Tab Garage | T Conduits | Wheel Zoom"; + _controlsHint.Text = "WASD Drive | Mouse Aim | LMB Fire | E Bolt/Swap | Tab Garage | Wheel Zoom"; } float distCenter = MathF.Sqrt(player.X * player.X + player.Z * player.Z); @@ -218,8 +207,8 @@ public partial class Hud : CanvasLayer _promptLabel.Text = BuildInteractionPrompt(state, player); _promptLabel.Visible = !string.IsNullOrEmpty(_promptLabel.Text); - // Crosshair + Heat Arc - _crosshair.SetState(player); + // Crosshair + Heat Arc + Directional Incoming Hit Arcs + _crosshair.SetState(state, player, _getCameraYaw()); _crosshair.QueueRedraw(); // Radar (heading-up with camera yaw) @@ -335,7 +324,7 @@ public partial class Hud : CanvasLayer _promptLabel.AddThemeFontSizeOverride("font_size", 14); vbox.AddChild(_promptLabel); - _controlsHint = new Label { Text = "WASD Drive | Mouse Aim | LMB Fire | E Loot/Swap | Tab Garage | T Conduits | Wheel Zoom" }; + _controlsHint = new Label { Text = "WASD Drive | Mouse Aim | LMB Fire | E Loot/Swap | Tab Garage | Wheel Zoom" }; _controlsHint.AddThemeColorOverride("font_color", TextMuted); _controlsHint.AddThemeFontSizeOverride("font_size", 11); vbox.AddChild(_controlsHint); @@ -402,17 +391,6 @@ public partial class Hud : CanvasLayer title.AddThemeFontSizeOverride("font_size", 12); headRow.AddChild(title); - _thermalButton = new Button - { - Text = "[T] CONDUITS", - ToggleMode = true, - FocusMode = Control.FocusModeEnum.None, - Modulate = TextMuted - }; - _thermalButton.AddThemeFontSizeOverride("font_size", 10); - _thermalButton.Pressed += () => SetThermalMode(_thermalButton.ButtonPressed); - headRow.AddChild(_thermalButton); - _schematic = new InventoryGridControl { CustomMinimumSize = new Vector2(180f, 188f) @@ -776,9 +754,92 @@ public partial class Hud : CanvasLayer private sealed partial class CrosshairOverlay : Control { - private ContenderState? _player; + private const float HitArcDuration = 0.65f; - public void SetState(ContenderState player) => _player = player; + private sealed class IncomingHitArc + { + public float SourceX; + public float SourceZ; + public WeaponVisualClass WeaponClass; + public float Age; + } + + private ContenderState? _player; + private float _cameraYaw; + private MatchState? _lastState; + private long _lastProcessedHitId; + private readonly List _incomingArcs = new(); + + public void SetState(MatchState state, ContenderState player, float cameraYaw) + { + if (!ReferenceEquals(_lastState, state)) + { + _lastState = state; + _lastProcessedHitId = 0; + _incomingArcs.Clear(); + } + + _player = player; + _cameraYaw = cameraYaw; + + var hits = state.HitEvents; + for (int i = 0; i < hits.Count; i++) + { + var ev = hits[i]; + if (ev.EventId <= _lastProcessedHitId) + { + continue; + } + _lastProcessedHitId = ev.EventId; + + if (ev.TargetKind == HitTargetKind.Contender && ev.TargetId == player.Id) + { + if (_incomingArcs.Count >= 8) + { + _incomingArcs.RemoveAt(0); + } + _incomingArcs.Add(new IncomingHitArc + { + SourceX = ev.SourceX, + SourceZ = ev.SourceZ, + WeaponClass = ev.WeaponClass, + Age = 0f + }); + } + } + } + + public void Advance(float dt) + { + if (_incomingArcs.Count == 0 || dt <= 0f) + { + return; + } + for (int i = _incomingArcs.Count - 1; i >= 0; i--) + { + _incomingArcs[i].Age += dt; + if (_incomingArcs[i].Age >= HitArcDuration) + { + _incomingArcs.RemoveAt(i); + } + } + QueueRedraw(); + } + + public void PushTestHitArc(float sourceX, float sourceZ, WeaponVisualClass weaponClass) + { + if (_incomingArcs.Count >= 8) _incomingArcs.RemoveAt(0); + _incomingArcs.Add(new IncomingHitArc + { + SourceX = sourceX, + SourceZ = sourceZ, + WeaponClass = weaponClass, + Age = 0f + }); + QueueRedraw(); + } + + public int ActiveHitArcCount => _incomingArcs.Count; public override void _Draw() { @@ -859,6 +920,69 @@ public partial class Hud : CanvasLayer : (heatRatio > 0.65f ? OrangeCol : OliveCol); DrawArc(center, arcRadius, startAngle, startAngle + maxSweep * heatRatio, 24, heatCol, 2.4f); } + + // Directional incoming-hit indicator arcs (fade over 0.65s) + if (_incomingArcs.Count > 0) + { + float sinY = MathF.Sin(_cameraYaw); + float cosY = MathF.Cos(_cameraYaw); + for (int i = 0; i < _incomingArcs.Count; i++) + { + var arc = _incomingArcs[i]; + float alpha = Math.Clamp(1f - arc.Age / HitArcDuration, 0f, 1f); + if (alpha <= 0.01f) + { + continue; + } + + float dx = arc.SourceX - _player.X; + float dz = arc.SourceZ - _player.Z; + float rx = -dx * cosY + dz * sinY; + float fy = dx * sinY + dz * cosY; + float angle = (rx * rx + fy * fy) > 1e-4f ? MathF.Atan2(-fy, rx) : 0f; + + Color arcCol = arc.WeaponClass switch + { + WeaponVisualClass.Explosive => new Color(1.0f, 0.36f, 0.12f, alpha * 0.96f), + WeaponVisualClass.ThermalBeam => new Color(0.30f, 0.90f, 1.0f, alpha * 0.96f), + _ => new Color(0.96f, 0.72f, 0.22f, alpha * 0.94f) + }; + + const float hitR = 39f; + const float halfSpan = 0.34f; + DrawArc(center, hitR, angle - halfSpan, angle + halfSpan, 14, arcCol, 4.2f); + if (arc.WeaponClass == WeaponVisualClass.ThermalBeam) + { + DrawArc(center, hitR - 3.5f, angle - halfSpan * 0.75f, angle + halfSpan * 0.75f, 10, + new Color(GoldCol.R, GoldCol.G, GoldCol.B, alpha * 0.90f), 2.0f); + } + + Vector2 dirVec = new(MathF.Cos(angle), MathF.Sin(angle)); + Vector2 perp = new(-dirVec.Y, dirVec.X); + Vector2 tip = center + dirVec * (hitR + 9f); + Vector2 baseL = center + dirVec * (hitR + 1.5f) - perp * 4.5f; + Vector2 baseR = center + dirVec * (hitR + 1.5f) + perp * 4.5f; + DrawColoredPolygon(new[] { tip, baseL, baseR }, arcCol); + } + + var latest = _incomingArcs[^1]; + float tagAlpha = Math.Clamp(1f - latest.Age / HitArcDuration, 0f, 1f); + (string tagText, Color tagCol) = latest.WeaponClass switch + { + WeaponVisualClass.Autocannon => ("20MM IMPACT", new Color(0.98f, 0.70f, 0.20f, tagAlpha)), + WeaponVisualClass.Explosive => ("BLAST IMPACT", new Color(1.0f, 0.38f, 0.14f, tagAlpha)), + WeaponVisualClass.ThermalBeam => ("THERMAL HIT", new Color(0.36f, 0.92f, 1.0f, tagAlpha)), + _ => ("KINETIC HIT", new Color(0.96f, 0.78f, 0.28f, tagAlpha)) + }; + DrawString( + ThemeDB.FallbackFont, + center + new Vector2(-36f, 54f), + tagText, + HorizontalAlignment.Left, + -1, + 10, + tagCol); + } } } diff --git a/client/InventoryGridControl.cs b/client/InventoryGridControl.cs index 8597b16..d80d283 100644 --- a/client/InventoryGridControl.cs +++ b/client/InventoryGridControl.cs @@ -62,8 +62,6 @@ public partial class InventoryGridControl : Control private string? _lastSelectedCargoId; private int _lastMountedSig = int.MinValue; private Vector2I? _hoveredCell; - private bool _thermalEnabled; - private float _thermalBlend; private bool _dataDirty; private bool _tempDirty; @@ -105,29 +103,10 @@ public partial class InventoryGridControl : Control ? _hardpointLookup[c.X, c.Y] : null; - public bool ThermalEnabled - { - get => _thermalEnabled; - set - { - if (_thermalEnabled == value) return; - _thermalEnabled = value; - } - } - - public float ThermalBlend => _thermalBlend; internal int LabelsDrawCount => _labelsOverlay.DrawCount; internal string? GetLastDrawnLabel(string hardpointId) => _labelsOverlay.LastDrawnTags.TryGetValue(hardpointId, out string? tag) ? tag : null; - public void SetThermalInstant(bool enabled) - { - _thermalEnabled = enabled; - _thermalBlend = enabled ? 1f : 0f; - _material.SetShaderParameter("thermal_mode", _thermalBlend); - _labelsOverlay.QueueRedraw(); - } - public event Action? CellClicked; public event Action? HardpointClicked; public event Action? HoverChanged; @@ -144,25 +123,6 @@ public partial class InventoryGridControl : Control public override void _Process(double delta) { float dt = (float)delta; - bool needUniform = false; - - float targetThermal = _thermalEnabled ? 1f : 0f; - if (MathF.Abs(_thermalBlend - targetThermal) > 0.001f) - { - float t = dt >= 0.25f ? 1f : 1f - MathF.Exp(-dt * 14f); - _thermalBlend = Mathf.Lerp(_thermalBlend, targetThermal, t); - if (MathF.Abs(_thermalBlend - targetThermal) < 0.005f) - { - _thermalBlend = targetThermal; - } - needUniform = true; - _labelsOverlay.QueueRedraw(); - } - - if (needUniform) - { - _material.SetShaderParameter("thermal_mode", _thermalBlend); - } bool anyPulse = false; for (int y = 0; y < _gridHeight; y++) @@ -398,7 +358,6 @@ public partial class InventoryGridControl : Control } _material.SetShaderParameter("grid_size", new Vector2(w, h)); - _material.SetShaderParameter("thermal_mode", _thermalBlend); if (hadHover) { @@ -606,20 +565,8 @@ public partial class InventoryGridControl : Control if (isCompatible) flags |= 16; // bit 4: compatible cargo drop target if (isBorder) flags |= 32; // bit 5: border radiator cell - // 3x+2.B: 4-bit N/E/S/W thermal conductivity pipe mask - byte cond = 0; - for (int i = 0; i < 4; i++) - { - int nx = x + Offsets8[i].Dx; - int ny = y + Offsets8[i].Dy; - if (spec.IsActive(nx, ny)) - { - cond |= (byte)(1 << i); - } - } - float pulse = Math.Clamp(_hitPulse[x, y], 0f, 1f); - var meta = new Color(mask / 255f, flags / 255f, cond / 255f, pulse); + var meta = new Color(mask / 255f, flags / 255f, 0f, pulse); _dataImage.SetPixel(x * 3 + 0, y, fill); _dataImage.SetPixel(x * 3 + 1, y, accent); @@ -758,7 +705,7 @@ public partial class InventoryGridControl : Control var spec = grid.Spec; int fontSize = cellSize >= 38f ? 10 : 9; - float alpha = Mathf.Lerp(0.95f, 0.55f, _owner._thermalBlend); + float alpha = 0.95f; for (int i = 0; i < spec.Hardpoints.Length; i++) { diff --git a/client/Main.cs b/client/Main.cs index e9c6bce..f48c901 100644 --- a/client/Main.cs +++ b/client/Main.cs @@ -213,9 +213,6 @@ public partial class Main : Node3D : Input.MouseModeEnum.Captured; } break; - case Key.T: - _hud.ToggleThermal(); - break; case Key.R: Reset(_seed + 1); break; @@ -274,21 +271,13 @@ public partial class Main : Node3D long t0 = Stopwatch.GetTimestamp(); _session.Step(input); long t1 = Stopwatch.GetTimestamp(); - _terrain.Sync(_session.State.Terrain); - long t2 = Stopwatch.GetTimestamp(); - _arena.Sync(_session, _elapsedSeconds, (float)delta); - long t3 = Stopwatch.GetTimestamp(); double toMs = 1000.0 / Stopwatch.Frequency; _perfPendingStepMs += (t1 - t0) * toMs; - _perfPendingTerrainMs += (t2 - t1) * toMs; - _perfPendingArenaMs += (t3 - t2) * toMs; _perfPhysicsTicks++; } else { _session.Step(input); - _terrain.Sync(_session.State.Terrain); - _arena.Sync(_session, _elapsedSeconds, (float)delta); } } @@ -301,14 +290,23 @@ public partial class Main : Node3D if (_perfTargetFrames > 0) { + double toMs = 1000.0 / Stopwatch.Frequency; + long tt0 = Stopwatch.GetTimestamp(); + _terrain.Sync(_session.State.Terrain); + long tt1 = Stopwatch.GetTimestamp(); + _arena.Sync(_session, _elapsedSeconds, (float)delta); + long ta1 = Stopwatch.GetTimestamp(); + _perfPendingTerrainMs = (tt1 - tt0) * toMs; + _perfPendingArenaMs = (ta1 - tt1) * toMs; + long tc0 = Stopwatch.GetTimestamp(); UpdateCamera((float)delta); _terrain.UpdateTileLod(_camera.GlobalPosition); long th0 = Stopwatch.GetTimestamp(); _hud.Sync(_session); long th1 = Stopwatch.GetTimestamp(); - _perfCamMsSum += (th0 - tc0) * 1000.0 / Stopwatch.Frequency; - double hudMs = (th1 - th0) * 1000.0 / Stopwatch.Frequency; + _perfCamMsSum += (th0 - tc0) * toMs; + double hudMs = (th1 - th0) * toMs; long now = Stopwatch.GetTimestamp(); double frameMs = (now - _perfLastFrameTick) * 1000.0 / Stopwatch.Frequency; @@ -342,6 +340,8 @@ public partial class Main : Node3D } else { + _terrain.Sync(_session.State.Terrain); + _arena.Sync(_session, _elapsedSeconds, (float)delta); UpdateCamera((float)delta); _terrain.UpdateTileLod(_camera.GlobalPosition); _hud.Sync(_session); @@ -423,6 +423,16 @@ public partial class Main : Node3D GD.Print($" Paladin sample nodes: {string.Join(", ", names)}"); } GD.Print("=== END PERF BENCHMARK ==="); + string? previewOut = System.Environment.GetEnvironmentVariable("RTD_CAPTURE_PREVIEW"); + if (!string.IsNullOrWhiteSpace(previewOut) && DisplayServer.GetName() != "headless") + { + var img = GetViewport().GetTexture()?.GetImage(); + if (img is not null) + { + var err = img.SavePng(previewOut); + GD.Print($"PERF PREVIEW SAVED: {previewOut} ({img.GetWidth()}x{img.GetHeight()}, err={err})"); + } + } GetTree().Quit(0); } @@ -614,7 +624,7 @@ public partial class Main : Node3D LightEnergy = 1.45f, ShadowEnabled = true, DirectionalShadowMode = DirectionalLight3D.ShadowMode.Parallel2Splits, - DirectionalShadowMaxDistance = 145f, + DirectionalShadowMaxDistance = 88f, RotationDegrees = new Vector3(-48f, 32f, 0f) }; AddChild(sun); diff --git a/client/inventory_grid.gdshader b/client/inventory_grid.gdshader index 10aaa68..fac4847 100644 --- a/client/inventory_grid.gdshader +++ b/client/inventory_grid.gdshader @@ -3,14 +3,14 @@ render_mode blend_premul_alpha; // Port of Aetheria's UI/Inventory Grid shader to Godot 4 gl_compatibility (OpenGL 3.3). // Evaluates analytical corner-folded texel boxes for hull/hardpoint silhouettes, L-brackets, -// hairline rules, and 2D Euclidean SDF thermal conduits with RoundUnion fillets. +// hairline rules, direct bilinear heat glow, hit-pulse flash, and 45-degree fracture hatching. // // data_tex (3W x H, filter_nearest): // 3x + 0 : cell/item fill & armor tint (RGBA) -// 3x + 1 : border/bracket/pipe accent color (RGBA) +// 3x + 1 : border/bracket accent color (RGBA) // 3x + 2 : R = 8-bit neighbor mismatch mask (N,E,S,W,NE,SE,SW,NW) // G = flags (bit0=present, bit1=item, bit2=hover, bit3=damaged/stripped, bit4=compatible, bit5=border_radiator) -// B = 4-bit N/E/S/W thermal conductivity pipe mask +// B = reserved (0) // A = hit-pulse flash intensity (0..1) // temp_tex (W x H, filter_linear): // R = normalized temperature [20C..200C -> 0..1] @@ -22,7 +22,6 @@ uniform sampler2D temp_tex : filter_linear, repeat_disable; uniform vec2 grid_size = vec2(4.0, 5.0); uniform vec2 rect_size = vec2(180.0, 225.0); -uniform float thermal_mode : hint_range(0.0, 1.0) = 0.0; // Look parameters in Aetheria texel units uniform float icon_texel = 1.51515; @@ -36,12 +35,6 @@ uniform float rule_alpha = 0.34; uniform float bracket_alpha = 1.0; uniform float fill_alpha = 0.14; -// Thermal pipe SDF parameters (in cell fractions, edge ramp in pixels) -uniform float blob_radius = 0.1272; -uniform float pipe_half_width = 0.1261; -uniform float fillet = 0.1172; -uniform float pipe_soft = 1.212; - const float FAR = 1000.0; float box_profile(float x, float lo, float hi, float soft) { @@ -108,39 +101,6 @@ float eval_layer(vec2 p, float cell_px, float texel, uint mask, bool is_item, bo return clamp(a, 0.0, 1.0); } -float round_union(float a, float b, float r) { - vec2 u = max(vec2(r - a, r - b), vec2(0.0)); - return max(r, min(a, b)) - length(u); -} - -float eval_pipes(vec2 p, float cell_px, uint cond, float aa_px) { - vec2 q = p / cell_px - 0.5; - float d = length(q) - blob_radius; - vec2 dirs[4]; - dirs[0] = vec2(0.0, 1.0); - dirs[1] = vec2(1.0, 0.0); - dirs[2] = vec2(0.0, -1.0); - dirs[3] = vec2(-1.0, 0.0); - - float bars[4]; - for (int b = 0; b < 4; b++) { - float along = dot(q, dirs[b]); - float perp = abs(dot(q, vec2(dirs[b].y, -dirs[b].x))); - bool connected = ((cond >> uint(b)) & 1u) != 0u; - bars[b] = !connected - ? FAR - : (along >= 0.0 ? perp - pipe_half_width : length(vec2(perp, along)) - pipe_half_width); - d = min(d, bars[b]); - } - for (int c = 0; c < 4; c++) { - int n = (c + 1) % 4; - if (bars[c] < FAR && bars[n] < FAR && dot(q, dirs[c] + dirs[n]) > 0.0) { - d = min(d, round_union(bars[c], bars[n], fillet)); - } - } - return clamp(0.5 - d * cell_px / max(pipe_soft * aa_px, 0.25), 0.0, 1.0); -} - vec3 thermal_ramp(float t) { vec3 c0 = vec3(0.11, 0.18, 0.24); // ambient cool slate vec3 c1 = vec3(0.24, 0.48, 0.34); // warm olive @@ -181,7 +141,6 @@ void fragment() { uint mask = uint(round(meta.r * 255.0)); uint flags = uint(round(meta.g * 255.0)); - uint cond = uint(round(meta.b * 255.0)); float hit_pulse = meta.a; if ((flags & 1u) == 0u) { @@ -198,10 +157,10 @@ void fragment() { float a_bg = eval_layer(p, S, bg_texel, mask, false, false, aa_px) * cell_fill.a; float a_rules = eval_layer(p, S, icon_texel, mask, is_item, true, aa_px); - float a_pipes = eval_pipes(p, S, cond, aa_px); - // Intact vs stripped (Armor == 0) interior fill - vec3 base_rgb = mix(cell_fill.rgb, heat_col, mix(0.24, 0.84, thermal_mode)); + // Intact vs stripped (Armor == 0) interior fill with always-active subtle bilinear heat glow on hot cells + float hot_blend = smoothstep(0.05, 0.65, norm_temp) * 0.56; + vec3 base_rgb = mix(cell_fill.rgb, heat_col, hot_blend); if (is_damaged) { // Diagonal fracture/exposed-core hatching at 45 deg float hatch_coord = (p_godot.x + p_godot.y) / max(S * 0.22, 4.0); @@ -210,9 +169,9 @@ void fragment() { base_rgb = mix(base_rgb * 0.55, vec3(0.82, 0.20, 0.14), hatch * 0.65); } - // Thermal plateau glow over hot cells + // Direct bilinear thermal plateau glow over hot cells float overheat_glow = max(plateau_stress - 0.5, 0.0) * 2.0; - base_rgb += heat_col * (0.12 * norm_temp + 0.22 * overheat_glow); + base_rgb += heat_col * (0.20 * norm_temp + 0.30 * overheat_glow); base_rgb = clamp(base_rgb, vec3(0.0), vec3(1.0)); if (is_hover) { @@ -238,9 +197,8 @@ void fragment() { } accent_rgb = clamp(mix(accent_rgb, flash_col, hit_pulse * 0.90), vec3(0.0), vec3(1.0)); - float icon_alpha = clamp(mix(a_rules * border_accent.a, max(a_rules * 0.26, a_pipes), thermal_mode), 0.0, 1.0); - vec3 pipe_rgb = clamp(mix(accent_rgb, heat_col * 1.2 + vec3(0.14), 0.72), vec3(0.0), vec3(1.0)); - vec3 icon_rgb = clamp(mix(accent_rgb, pipe_rgb, thermal_mode * clamp(a_pipes * 1.2, 0.0, 1.0)), vec3(0.0), vec3(1.0)); + float icon_alpha = clamp(a_rules * border_accent.a, 0.0, 1.0); + vec3 icon_rgb = clamp(accent_rgb, vec3(0.0), vec3(1.0)); float out_a = clamp(icon_alpha + a_bg * (1.0 - icon_alpha), 0.0, 1.0); vec3 out_rgb = min(icon_rgb * icon_alpha + base_rgb * a_bg * (1.0 - icon_alpha), vec3(out_a));