From 94474fcd3e42222c5f79a8911affa8fb53796c82 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 15:04:15 +0100 Subject: [PATCH] Gate Bokusho page projection longitudinally --- .../Render/BokushoBrushSimulation.cs | 4 +++- src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Aquarium.Engine.Contracts/Render/BokushoBrushSimulation.cs b/src/Aquarium.Engine.Contracts/Render/BokushoBrushSimulation.cs index 0942c13..f3f9d08 100644 --- a/src/Aquarium.Engine.Contracts/Render/BokushoBrushSimulation.cs +++ b/src/Aquarium.Engine.Contracts/Render/BokushoBrushSimulation.cs @@ -422,10 +422,12 @@ public static class BokushoBrushSimulation var tangentDistance = Vector2.Dot(delta, sampleTangent) / MathF.Max(tip.W, 0.001f); var ellipse = MathF.Sqrt(normalDistance * normalDistance + tangentDistance * tangentDistance); var tipContact = MathF.Max(SmoothStep(1.0f, 0.0f, ellipse), sweepContact * 0.86f); + var longitudinalGate = SmoothStep(1.0f, 0.0f, MathF.Abs(tangentDistance) * 0.62f); var contribution = canvas[index] * tipContact * (0.03f + contactCore * 0.97f) - * (1.0f - MathF.Abs(sampleDelta) * 0.045f) + * (0.18f + longitudinalGate * 0.82f) + * (1.0f - MathF.Abs(sampleDelta) * 0.070f) * (0.82f + sweepContact * 0.24f); pigmentPeak = MathF.Max(pigmentPeak, contribution); pigmentFlow += contribution; diff --git a/src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl b/src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl index 406abd1..66085f1 100644 --- a/src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl +++ b/src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl @@ -319,11 +319,13 @@ float bokushoStrokePageHeight(float2 world, BokushoBrushStroke stroke, uint stro float tangentDistance = dot(delta, sampleTangent) / max(tip.w, 0.001); float ellipse = sqrt(normalDistance * normalDistance + tangentDistance * tangentDistance); float tipContact = max(smoothstep(1.0, 0.0, ellipse), sweepContact * 0.86); + float longitudinalGate = smoothstep(1.0, 0.0, abs(tangentDistance) * 0.62); float pigment = BokushoCanvasField[((strokeIndex * tuftCount) + tuftIndex) * sampleCount + sampleIndex]; float contribution = pigment * tipContact * (0.03 + contactCore * 0.97) - * (1.0 - abs((float)sampleDelta) * 0.045) + * (0.18 + longitudinalGate * 0.82) + * (1.0 - abs((float)sampleDelta) * 0.070) * (0.82 + sweepContact * 0.24); pigmentPeak = max(pigmentPeak, contribution); pigmentFlow += contribution;