diff --git a/src/game-loop/game-loop.ts b/src/game-loop/game-loop.ts index 91aadb8..d951e71 100644 --- a/src/game-loop/game-loop.ts +++ b/src/game-loop/game-loop.ts @@ -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'; diff --git a/src/pipelines/agents/agent-generation/agent-generation.wgsl b/src/pipelines/agents/agent-generation/agent-generation.wgsl index 69ceac9..8c28fc6 100644 --- a/src/pipelines/agents/agent-generation/agent-generation.wgsl +++ b/src/pipelines/agents/agent-generation/agent-generation.wgsl @@ -21,6 +21,5 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { angle, 0, 1000000, - 0 ); } diff --git a/src/pipelines/agents/agent-generation/agent-schema.wgsl b/src/pipelines/agents/agent-generation/agent-schema.wgsl index 2663ea6..44c0843 100644 --- a/src/pipelines/agents/agent-generation/agent-schema.wgsl +++ b/src/pipelines/agents/agent-generation/agent-schema.wgsl @@ -3,7 +3,6 @@ struct Agent { angle: f32, species: f32, timeToLive: f32, - timeToLive2: f32, } @group(1) @binding(1) var agents: array; diff --git a/src/pipelines/agents/agent.wgsl b/src/pipelines/agents/agent.wgsl index eaab47e..3b568fb 100644 --- a/src/pipelines/agents/agent.wgsl +++ b/src/pipelines/agents/agent.wgsl @@ -83,13 +83,13 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { nextAngle = agent.angle + rotation; } - var trail = vec4(0, 1, 0, 0); + var trail = vec4(0, 0.1, 0, 0); if (agent.species == 0) { trail = vec4(0.1, 0, 0, 0); } let current = textureLoad(trailMapIn, vec2(nextPosition), 0); - textureStore(trailMapOut, vec2(nextPosition), vec4(trail.rgb + current.rgb, 0)); + textureStore(trailMapOut, vec2(nextPosition), vec4(trail.rgb + current.rgb, current.a)); agent.position = nextPosition; agent.angle = nextAngle; diff --git a/src/pipelines/render/render.wgsl b/src/pipelines/render/render.wgsl index 1506fdc..8cde5bf 100644 --- a/src/pipelines/render/render.wgsl +++ b/src/pipelines/render/render.wgsl @@ -16,15 +16,15 @@ fn fragment(@location(0) uv: vec2) -> @location(0) vec4 { 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); } diff --git a/src/settings.ts b/src/settings.ts index 761575c..c14b5ba 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -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,