Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
loganzartman committed Oct 28, 2024
1 parent f5f84c9 commit d678a1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ReadWritePrevTex } from "./ReadWritePrevTex";
import { projectModuleCode } from "./projectModule";
import { splatModuleCode } from "./splatModule";

const N = 1024;
const N = 512;
const workgroupDim = 8;

export function Renderer({
Expand Down Expand Up @@ -770,8 +770,8 @@ export function Renderer({
dt,
x: pointer.x,
y: pointer.y,
vx: (pointer.x - pointer.px) * 0.1,
vy: (pointer.y - pointer.py) * 0.1,
vx: (pointer.x - pointer.px) * 0.2,
vy: (pointer.y - pointer.py) * 0.2,
radius: N / 50,
amount: 1,
});
Expand All @@ -794,7 +794,7 @@ export function Renderer({
project({
encoder,
dt,
iters: 50,
iters: 30,
pressureTarget: pressure1Rwp,
});

Expand All @@ -811,7 +811,7 @@ export function Renderer({
project({
encoder,
dt,
iters: 50,
iters: 30,
pressureTarget: pressure2Rwp,
});
}
Expand Down Expand Up @@ -869,11 +869,11 @@ export function Renderer({
linearSampler,
splat,
velocityRwp,
diffuse,
project,
pressure1Rwp,
advect,
pressure2Rwp,
diffuse,
])
);

Expand Down
4 changes: 2 additions & 2 deletions src/projectModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function projectModuleCode({
let pressure = textureLoad(presReadTex, id.xy, 0).r;
textureStore(divWriteTex, id.xy, vec4f(divergence, 0, 0, 0));
textureStore(presWriteTex, id.xy, vec4f(pressure * 0.98, 0, 0, 0));
textureStore(presWriteTex, id.xy, vec4f(pressure * 0.99, 0, 0, 0));
// textureStore(presWriteTex, id.xy, vec4f(0));
// TODO: boundary
Expand Down Expand Up @@ -71,7 +71,7 @@ export function projectModuleCode({
textureLoad(presReadTex, vec2i(x, y + 1), 0)
) / 4.0;
textureStore(presWriteTex, id.xy, pressure);
textureStore(presWriteTex, id.xy, pressure * 0.99);
// TODO: boundary
}
Expand Down
4 changes: 3 additions & 1 deletion src/splatModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function splatModuleCode({
// let f = 1.0;
density += f * uniforms.amount;
velocity += f * uniforms.velocity;
if (length(f * uniforms.velocity) > length(velocity)) {
velocity = f * uniforms.velocity;
}
}
density *= 0.99;
Expand Down

0 comments on commit d678a1c

Please sign in to comment.