diff --git a/shaders/particleIntegrate.wgsl b/shaders/particleIntegrate.wgsl index 774edba..a663f4f 100644 --- a/shaders/particleIntegrate.wgsl +++ b/shaders/particleIntegrate.wgsl @@ -69,7 +69,7 @@ fn csMain( @builtin(global_invocation_id) id: vec3 ) // 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))); diff --git a/shaders/particleUpdatePBMPM.wgsl b/shaders/particleUpdatePBMPM.wgsl index e43e778..974cdc1 100644 --- a/shaders/particleUpdatePBMPM.wgsl +++ b/shaders/particleUpdatePBMPM.wgsl @@ -60,8 +60,6 @@ fn csMain( @builtin(global_invocation_id) id: vec3 ) } else if(particle.material == MaterialSand) { - - let F = (Identity + particle.deformationDisplacement) * particle.deformationGradient; var svdResult = svd(F); diff --git a/src/gpu.js b/src/gpu.js index 80fef41..f74b735 100644 --- a/src/gpu.js +++ b/src/gpu.js @@ -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, @@ -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() @@ -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 && { diff --git a/src/sim.js b/src/sim.js index 19a92b8..9aeb283 100644 --- a/src/sim.js +++ b/src/sim.js @@ -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); diff --git a/src/ui.js b/src/ui.js index e1c231e..4567cca 100644 --- a/src/ui.js +++ b/src/ui.js @@ -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}, @@ -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'},