Improve brush rendering

This commit is contained in:
Andras Schmelczer 2023-05-20 13:47:50 +01:00
parent 2f765a74a2
commit 99b6af57d1
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 4 additions and 4 deletions

View file

@ -20,11 +20,11 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
let speciesBStrength = clamp(pow(traces.g, settings.clarity), 0, 1);
let brushStrength = traces.a;
let agentColor = settings.speciesColorA * speciesAStrength + settings.speciesColorB * speciesBStrength;
let agentStrength = speciesAStrength + speciesBStrength;
let rgbColor = sqrt(
settings.speciesColorA * speciesAStrength +
settings.speciesColorB * speciesBStrength +
settings.brushColor * brushStrength
mix(agentColor, settings.brushColor * brushStrength, clamp(brushStrength - agentStrength, 0, 1))
);
return vec4(backgroundColor - rgbColor, 1);
}

View file

@ -36,7 +36,7 @@ export const settings: GameLoopSettings &
diffusionRateTrails: 0.4, // inverse
decayRateTrails: 0.9, // inverse
diffusionRateBrush: 4, // inverse
decayRateBrush: 0.99, // inverse
decayRateBrush: 0.995, // inverse
brushColor: palette.blue,
speciesColorA: palette.yellow,