Minor fixes

This commit is contained in:
Andras Schmelczer 2023-06-01 08:21:39 +01:00
commit c26fd93087
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 26 additions and 18 deletions

View file

@ -112,10 +112,10 @@ fn main(
// trailBelow.g = settings.isNextGenerationOdd * (trailBelow.r + trailBelow.g);
} else {
let relativeWeight = mix(trailBelow.g - trailBelow.r, trailBelow.r - trailBelow.g, isFromOddGeneration);
if relativeWeight > 0 && (
if (relativeWeight > 0 && (
(isFromCurrentGeneration == 1.0 && trailBelow.a == 0 && random.b < settings.infectionProbability)
|| (isFromCurrentGeneration == 0.0 && trailBelow.a > 0)
) {
)) || (trailBelow.a > 0 && isFromCurrentGeneration == 0.0){
// trailBelow.r = isFromOddGeneration * (trailBelow.r + trailBelow.g);
// trailBelow.g = (1 - isFromOddGeneration) * (trailBelow.r + trailBelow.g);
agent.generation = (agent.generation + 1) % 2;

View file

@ -28,7 +28,7 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
) / 8;
let decayed = clamp(vec4(
clamp(current.rgb + (current.rgb - 1.001) * settings.decayRateTrails, vec3(0), vec3(1)),
current.rgb * settings.decayRateTrails,
max(0, current.a + (current.a - 1.001) * settings.decayRateBrush)
), vec4(0), vec4(1));

View file

@ -26,7 +26,8 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
oddGenerationStrength * settings.oddGenerationColor,
oddGenerationStrength / (evenGenerationStrength + oddGenerationStrength + 0.000001)
),
brushStrength * settings.brushColor);
brushStrength * settings.brushColor
);
let strength = max(evenGenerationStrength, max(oddGenerationStrength, brushStrength));
@ -34,5 +35,5 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
}
fn clarity(strength: f32) -> f32 {
return sign(strength);
return pow(strength, settings.clarity);
}