From: Pieter-Jan Briers Date: Tue, 24 Jun 2025 20:47:29 +0000 (+0200) Subject: Fix displacement map rendering in UI (#38042) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=f5071238cefe9d276fdcc871f8d9f069ddff0ce6;p=space-station-14.git Fix displacement map rendering in UI (#38042) Fix displacement map rendering 918709cb4742d02e9822a651cf8e74727ba997de changed the way humans work to completely remove the stencil mask thing for clothing cutouts, in favor of displacement maps. Except it didn't actually remove the stencil parameters from the shader prototype, so this caused the shader to render incorrectly in SpriteView instances. I introduced a new DisplacedDraw shader that doesn't have the stencil in use, as removing the old one would probably be a more annoying breaking change. Fixes #37629 --- diff --git a/Content.Client/Holopad/HolopadSystem.cs b/Content.Client/Holopad/HolopadSystem.cs index f219e1577d..9fc0815516 100644 --- a/Content.Client/Holopad/HolopadSystem.cs +++ b/Content.Client/Holopad/HolopadSystem.cs @@ -107,7 +107,7 @@ public sealed class HolopadSystem : SharedHolopadSystem // Remove shading from all layers (except displacement maps) for (var i = 0; i < hologramSprite.AllLayers.Count(); i++) { - if (_sprite.TryGetLayer((hologram, hologramSprite), i, out var layer, false) && layer.ShaderPrototype != "DisplacedStencilDraw") + if (_sprite.TryGetLayer((hologram, hologramSprite), i, out var layer, false) && layer.ShaderPrototype != "DisplacedDraw") hologramSprite.LayerSetShader(i, "unshaded"); } diff --git a/Content.Shared/DisplacementMap/DisplacementData.cs b/Content.Shared/DisplacementMap/DisplacementData.cs index 7bd5b580e1..6564f720a8 100644 --- a/Content.Shared/DisplacementMap/DisplacementData.cs +++ b/Content.Shared/DisplacementMap/DisplacementData.cs @@ -10,5 +10,5 @@ public sealed partial class DisplacementData public Dictionary SizeMaps = new(); [DataField] - public string? ShaderOverride = "DisplacedStencilDraw"; + public string? ShaderOverride = "DisplacedDraw"; } diff --git a/Resources/Prototypes/Shaders/displacement.yml b/Resources/Prototypes/Shaders/displacement.yml index 5c90738008..70c9dce6f7 100644 --- a/Resources/Prototypes/Shaders/displacement.yml +++ b/Resources/Prototypes/Shaders/displacement.yml @@ -8,3 +8,10 @@ func: NotEqual params: displacementSize: 127 + +- type: shader + id: DisplacedDraw + kind: source + path: "/Textures/Shaders/displacement.swsl" + params: + displacementSize: 127