Skip to content

Commit

Permalink
Remove some unused data and parameters. Rename some parameters for cl…
Browse files Browse the repository at this point in the history
…arity.
  • Loading branch information
Chris Lewin committed Jul 25, 2024
1 parent 5e8ffd6 commit 264649b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 46 deletions.
2 changes: 1 addition & 1 deletion shaders/particleIntegrate.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn csMain( @builtin(global_invocation_id) id: vec3<u32> )
// https://doi.org/10.1145/2897824.2925906
let sinPhi = sin(g_simConstants.frictionAngle/180.0 * 3.14159);
let alpha = sqrt(2.0/3.0)*2.0*sinPhi/(3.0 - sinPhi);
let beta = g_simConstants.beta;
let beta = 0.5;

let eDiag = log(max(abs(svdResult.Sigma), vec2f(1e-6)));

Expand Down
2 changes: 0 additions & 2 deletions shaders/particleUpdatePBMPM.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ fn csMain( @builtin(global_invocation_id) id: vec3<u32> )
}
else if(particle.material == MaterialSand)
{


let F = (Identity + particle.deformationDisplacement) * particle.deformationGradient;

var svdResult = svd(F);
Expand Down
39 changes: 2 additions & 37 deletions src/gpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import * as shader from "./shader.js"

let context = {
pipelines: {},
maxParticleCount: 500000,
maxConstraintData: 100000,
// Note - not necessary to have these set dynamically
hashGridBucketCount: 100*1024,
hashGridBucketSize: 128,
maxNeighbourCount: 64,
maxParticleCount: 1000000,

maxTimeStampCount: 2048,

encoder: null,
Expand Down Expand Up @@ -90,36 +86,6 @@ export function resetBuffers()
size: context.maxParticleCount * 4,
usage: GPUBufferUsage.STORAGE
});

// Data needed for Position Based Fluids impl
{
// Extra particle buffer required for ping-pong access
context.tempParticleBuffer = context.device.createBuffer({
label: 'tempParticles',
size: context.maxParticleCount * 4 * particleFloatCount,
usage: GPUBufferUsage.STORAGE
});

// Each bucket has one count
context.hashGridBucketCounts = context.device.createBuffer({
label: "hashGridBucketCounts",
size: context.hashGridBucketCount * 4,
usage: GPUBufferUsage.STORAGE
});

// Each bucket has hashGridBucketSize elements of 2 4-byte words
context.hashGridData = context.device.createBuffer({
label: "hashGridData",
size: context.hashGridBucketCount * context.hashGridBucketSize * 2 * 4,
usage: GPUBufferUsage.STORAGE
});

context.particleNeighbours = context.device.createBuffer({
label: 'particleNeighbours',
size: context.maxParticleCount * 4 * context.maxNeighbourCount,
usage: GPUBufferUsage.STORAGE
});
}
}

export function beginFrame()
Expand Down Expand Up @@ -194,7 +160,6 @@ export function computeDispatch(shaderName, resources, groupCount)
layout: pipeline.getBindGroupLayout(0),
entries: entries});

//
const computePass = context.encoder.beginComputePass({
label: shaderName,
...(context.canTimeStamp && {
Expand Down
1 change: 0 additions & 1 deletion src/sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export function init(insertHandlers)
simFactory.add('particlesPerCellAxis', buffer_factory.u32);

simFactory.add('frictionAngle', buffer_factory.f32);
simFactory.add('beta', buffer_factory.f32);
simFactory.add('plasticity', buffer_factory.f32);
simFactory.add('mouseRadius', buffer_factory.f32);

Expand Down
7 changes: 2 additions & 5 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const g_uiElements =
{type: Checkbox, name: 'useGridVolumeForLiquid', desc: 'Use Grid Volume for Liquid', default: true},
{type: Range, name: 'fixedPointMultiplierExponent', desc: 'log10(Fixed Point Multiplier)', default: 7, min: 3, max: 10, step: 1},
{type: Range, name: 'gravityStrength', desc: 'Gravity Strength', default: 2.5, min: 0, max: 5, step: 0.01},
{type: Range, name: 'liquidTargetDensity', desc: 'Liquid Target Density', default: 1, min: 0.1, max: 16, step: 0.01},
{type: Range, name: 'liquidViscosity', desc: 'Liquid Viscosity', default: 0.01, min: 0, max: 1, step: 0.01},
{type: Combo, name: 'mouseFunction', desc: 'Mouse Interaction', default:SimEnums.MouseFunctionGrab, values:[
{desc:'Grab', value: SimEnums.MouseFunctionGrab},
Expand All @@ -102,10 +101,8 @@ const g_uiElements =
{type: Range, name: 'elasticityRatio', desc: 'Elasticity Ratio', default: 1, min: 0, max: 1, step: 0.01},
{type: Range, name: 'liquidRelaxation', desc: 'Liquid Relaxation', default: 2, min: 0, max: 10, step: 0.01},
{type: Range, name: 'elasticRelaxation', desc: 'Elastic Relaxation', default: 1.5, min: 0, max: 10, step: 0.01},
{type: Range, name: 'frictionAngle', desc: 'Friction Angle', default: 30, min: 0, max: 45, step: 0.1},
{type: Range, name: 'cohesion', desc: 'Cohesion', default: 0, min: 0, max: 2, step: 0.01},
{type: Range, name: 'beta', desc: 'Beta', default: 1, min: 0, max: 100, step: 0.01},
{type: Range, name: 'plasticity', desc: 'Plasticity', default: 0, min: 0, max: 1, step: 0.01},
{type: Range, name: 'frictionAngle', desc: 'Sand Friction Angle', default: 30, min: 0, max: 45, step: 0.1},
{type: Range, name: 'plasticity', desc: 'Visco Plasticity', default: 0, min: 0, max: 1, step: 0.01},

{type: Combo, name: 'renderMode', desc: 'Render Mode', values:[
{value: RenderEnums.RenderModeStandard, desc: 'Standard'},
Expand Down

0 comments on commit 264649b

Please sign in to comment.