Minor adjustments

This commit is contained in:
Andras Schmelczer 2023-05-20 13:42:24 +01:00
parent 6b17a8e023
commit 7dbeb2127c
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 11 additions and 14 deletions

View file

@ -1,6 +1,5 @@
import { AgentGenerationPipeline } from '../pipelines/agents/agent-generation/agent-generation-pipeline';
import { AgentPipeline } from '../pipelines/agents/agent-pipeline';
import { spawnAgents } from '../pipelines/agents/spawn-agents';
import { BrushPipeline } from '../pipelines/brush/brush-pipeline';
import { CommonState } from '../pipelines/common-state/common-state';
import { CopyPipeline } from '../pipelines/copy/copy-pipeline';

View file

@ -21,6 +21,5 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
angle,
0,
1000000,
0
);
}

View file

@ -3,7 +3,6 @@ struct Agent {
angle: f32,
species: f32,
timeToLive: f32,
timeToLive2: f32,
}
@group(1) @binding(1) var<storage, read_write> agents: array<Agent>;

View file

@ -83,13 +83,13 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
nextAngle = agent.angle + rotation;
}
var trail = vec4<f32>(0, 1, 0, 0);
var trail = vec4<f32>(0, 0.1, 0, 0);
if (agent.species == 0) {
trail = vec4(0.1, 0, 0, 0);
}
let current = textureLoad(trailMapIn, vec2<i32>(nextPosition), 0);
textureStore(trailMapOut, vec2<i32>(nextPosition), vec4(trail.rgb + current.rgb, 0));
textureStore(trailMapOut, vec2<i32>(nextPosition), vec4(trail.rgb + current.rgb, current.a));
agent.position = nextPosition;
agent.angle = nextAngle;

View file

@ -16,15 +16,15 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
let backgroundColor = vec3(0.9) + 0.075 * random.r;
let speciesAStrength = traces.r;
let speciesBStrength = traces.g;
let speciesAStrength = clamp(pow(traces.r, settings.clarity), 0, 1);
let speciesBStrength = clamp(pow(traces.g, settings.clarity), 0, 1);
let brushStrength = traces.a;
let rgbColor = sqrt(vec3(
settings.speciesColorA * clamp(pow(speciesAStrength, settings.clarity), 0, 1) +
settings.speciesColorB * clamp(pow(speciesBStrength, settings.clarity), 0, 1) +
settings.brushColor * brushStrength
));
let rgbColor = sqrt(
settings.speciesColorA * speciesAStrength +
settings.speciesColorB * speciesBStrength +
settings.brushColor * brushStrength
);
return vec4(backgroundColor - rgbColor, 1);
}

View file

@ -34,9 +34,9 @@ export const settings: GameLoopSettings &
sensorOffsetDistance: 60,
diffusionRateTrails: 0.4, // inverse
decayRateTrails: 0.9,
decayRateTrails: 0.9, // inverse
diffusionRateBrush: 4, // inverse
decayRateBrush: 0.98,
decayRateBrush: 0.99, // inverse
brushColor: palette.blue,
speciesColorA: palette.yellow,