Constrain Bokusho release fleck projection

This commit is contained in:
Meta Vens 2026-06-13 19:48:11 +01:00
commit 88c8c33faf
2 changed files with 18 additions and 10 deletions

View file

@ -546,13 +546,16 @@ public static class BokushoBrushSimulation
var fleckSeedPoint = contactPoint * 61.0f + new Vector2(sampleIndex * 0.17f, tuftIndex * 0.23f);
var fleckSeed = HashNoiseCell(fleckSeedPoint, paperKey, 0xF1E57A2Du);
var fleckGate = islandGate * SmoothStep(0.44f - releasePigment * 0.18f, 0.88f, fleckSeed) * (1.0f + releasePigment * 1.35f);
var fleckGate = islandGate
* SmoothStep(0.44f - releasePigment * 0.18f, 0.88f, fleckSeed)
* SmoothStep(0.56f, 1.0f, laneEdge)
* (1.0f + releasePigment * 1.15f);
if (fleckGate > 0.0f)
{
var fleckSide = fleckSeed < 0.86f ? side : -side;
var fleckCenter = contactPoint
+ sampleNormal * fleckSide * tip.Z * (2.30f + laneEdge * 1.05f + fleckSeed * 0.55f)
+ sampleTangent * (fleckSeed - 0.5f) * tip.W * 0.50f;
+ sampleNormal * fleckSide * tip.Z * (1.92f + laneEdge * 0.82f + fleckSeed * 0.36f)
+ sampleTangent * (fleckSeed - 0.5f) * tip.W * 0.42f;
var fleckRadius = MathF.Max(tip.Z * (0.12f + laneEdge * 0.05f), 0.030f);
var fleckDistance = MathF.Sqrt(Vector2.DistanceSquared(world, fleckCenter));
var fleckContact = SmoothStep(1.0f, 0.0f, fleckDistance / fleckRadius);
@ -580,13 +583,14 @@ public static class BokushoBrushSimulation
var satelliteSeed = HashNoiseCell(satelliteSeedPoint, paperKey, 0x5A771EAFu);
var satelliteGate = islandGate
* releasePigment
* SmoothStep(0.66f, 1.0f, laneEdge)
* SmoothStep(0.36f, 0.86f, satelliteSeed);
if (satelliteGate > 0.0f)
{
var satelliteSide = satelliteSeed < 0.52f ? side : -side;
var satelliteCenter = contactPoint
+ sampleNormal * satelliteSide * tip.Z * (2.34f + laneEdge * 0.96f + satelliteSeed * 0.46f)
+ sampleTangent * (satelliteSeed - 0.5f) * tip.W * 0.64f;
+ sampleNormal * satelliteSide * tip.Z * (2.02f + laneEdge * 0.78f + satelliteSeed * 0.34f)
+ sampleTangent * (satelliteSeed - 0.5f) * tip.W * 0.50f;
var satelliteRadius = MathF.Max(tip.Z * (0.075f + laneEdge * 0.035f), 0.020f);
var satelliteDistance = MathF.Sqrt(Vector2.DistanceSquared(world, satelliteCenter));
var satelliteContact = SmoothStep(1.0f, 0.0f, satelliteDistance / satelliteRadius);

View file

@ -451,13 +451,16 @@ float bokushoStrokePageHeight(float2 world, BokushoBrushStroke stroke, uint stro
float2 fleckSeedPoint = contactPoint * 61.0 + float2((float)sampleIndex * 0.17, (float)tuftIndex * 0.23);
float fleckSeed = bokushoHashNoiseCell(fleckSeedPoint, paperKey, 0xF1E57A2Du);
float fleckGate = islandGate * smoothstep(0.44 - releasePigment * 0.18, 0.88, fleckSeed) * (1.0 + releasePigment * 1.35);
float fleckGate = islandGate
* smoothstep(0.44 - releasePigment * 0.18, 0.88, fleckSeed)
* smoothstep(0.56, 1.0, laneEdge)
* (1.0 + releasePigment * 1.15);
if (fleckGate > 0.0)
{
float fleckSide = fleckSeed < 0.86 ? side : -side;
float2 fleckCenter = contactPoint
+ sampleNormal * fleckSide * tip.z * (2.30 + laneEdge * 1.05 + fleckSeed * 0.55)
+ sampleTangent * (fleckSeed - 0.5) * tip.w * 0.50;
+ sampleNormal * fleckSide * tip.z * (1.92 + laneEdge * 0.82 + fleckSeed * 0.36)
+ sampleTangent * (fleckSeed - 0.5) * tip.w * 0.42;
float fleckRadius = max(tip.z * (0.12 + laneEdge * 0.05), 0.030);
float fleckDistance = length(world - fleckCenter);
float fleckContact = smoothstep(1.0, 0.0, fleckDistance / fleckRadius);
@ -485,13 +488,14 @@ float bokushoStrokePageHeight(float2 world, BokushoBrushStroke stroke, uint stro
float satelliteSeed = bokushoHashNoiseCell(satelliteSeedPoint, paperKey, 0x5A771EAFu);
float satelliteGate = islandGate
* releasePigment
* smoothstep(0.66, 1.0, laneEdge)
* smoothstep(0.36, 0.86, satelliteSeed);
if (satelliteGate > 0.0)
{
float satelliteSide = satelliteSeed < 0.52 ? side : -side;
float2 satelliteCenter = contactPoint
+ sampleNormal * satelliteSide * tip.z * (2.34 + laneEdge * 0.96 + satelliteSeed * 0.46)
+ sampleTangent * (satelliteSeed - 0.5) * tip.w * 0.64;
+ sampleNormal * satelliteSide * tip.z * (2.02 + laneEdge * 0.78 + satelliteSeed * 0.34)
+ sampleTangent * (satelliteSeed - 0.5) * tip.w * 0.50;
float satelliteRadius = max(tip.z * (0.075 + laneEdge * 0.035), 0.020);
float satelliteDistance = length(world - satelliteCenter);
float satelliteContact = smoothstep(1.0, 0.0, satelliteDistance / satelliteRadius);