From 03c25d9e3dc34b66e495ebed02a3c3ced7434859 Mon Sep 17 00:00:00 2001 From: Chris Lewin Date: Wed, 14 Aug 2024 14:27:00 +0100 Subject: [PATCH] Delete unused scenes and tweak scenes. Implement border friction. --- scenes/4Materials.json | 77 ---------------------------- scenes/folding.json | 85 ++++++++++++++++++++++++++++++ scenes/manifest.json | 3 +- scenes/pyramid.json | 111 ---------------------------------------- scenes/sandPile.json | 26 ---------- scenes/sillyRubber.json | 31 ++++++----- shaders/g2p2g.wgsl | 5 +- src/ui.js | 2 +- 8 files changed, 108 insertions(+), 232 deletions(-) delete mode 100644 scenes/4Materials.json create mode 100644 scenes/folding.json delete mode 100644 scenes/pyramid.json delete mode 100644 scenes/sandPile.json diff --git a/scenes/4Materials.json b/scenes/4Materials.json deleted file mode 100644 index 2be6ef0..0000000 --- a/scenes/4Materials.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "version": 1, - "resolution": [ - 1920, - 953 - ], - "shapes": [ - { - "id": "shape1", - "position": { - "x": 291.8062500000001, - "y": 239 - }, - "halfSize": { - "x": "195", - "y": "71" - }, - "rotation": 0, - "shape": "0", - "function": "0", - "emitMaterial": "0", - "emissionRate": "0.5", - "radius": 20 - }, - { - "id": "shape0", - "position": { - "x": 1231.80625, - "y": 751 - }, - "halfSize": { - "x": "195", - "y": "186" - }, - "rotation": 0, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "5.3", - "radius": 20 - }, - { - "id": "shape2", - "position": { - "x": 1668.80625, - "y": 702 - }, - "halfSize": { - "x": "195", - "y": "186" - }, - "rotation": 0, - "shape": "0", - "function": "3", - "emitMaterial": "2", - "emissionRate": "5.3", - "radius": 20 - }, - { - "id": "shape3", - "position": { - "x": 785.8062500000001, - "y": 723 - }, - "halfSize": { - "x": "195", - "y": "186" - }, - "rotation": 0, - "shape": "0", - "function": "3", - "emitMaterial": "3", - "emissionRate": "5.3", - "radius": 20 - } - ] -} \ No newline at end of file diff --git a/scenes/folding.json b/scenes/folding.json new file mode 100644 index 0000000..80eaf79 --- /dev/null +++ b/scenes/folding.json @@ -0,0 +1,85 @@ +{ + "version": 2, + "resolution": [ + 2309, + 1184 + ], + "shapes": [ + { + "id": "shape0", + "position": { + "x": 2123.19765625, + "y": 234.004569687738 + }, + "rotation": 0, + "halfSize": { + "x": "56", + "y": "48" + }, + "shape": "0", + "function": "0", + "emitMaterial": "3", + "emissionRate": "10.4", + "radius": 90.18524136937822 + }, + { + "id": "shape1", + "position": { + "x": 98.31289062500001, + "y": 1047.3846153846155 + }, + "rotation": 0, + "halfSize": { + "x": "96", + "y": "655" + }, + "shape": "0", + "function": "2", + "emitMaterial": "0", + "emissionRate": "1", + "radius": 90.18524136937822 + } + ], + "settings": [ + { + "name": "simResDivisor", + "type": "combo", + "value": "16" + }, + { + "name": "particlesPerCellAxis", + "type": "range", + "value": "3" + }, + { + "name": "simRate", + "type": "combo", + "value": "480" + }, + { + "name": "liquidViscosity", + "type": "range", + "value": "0" + }, + { + "name": "elasticityRatio", + "type": "range", + "value": "0.07" + }, + { + "name": "plasticity", + "type": "range", + "value": "0.88" + }, + { + "name": "borderFriction", + "type": "range", + "value": "0.03" + }, + { + "name": "renderMode", + "type": "combo", + "value": "0" + } + ] +} \ No newline at end of file diff --git a/scenes/manifest.json b/scenes/manifest.json index 21adcf4..dce30d9 100644 --- a/scenes/manifest.json +++ b/scenes/manifest.json @@ -3,5 +3,6 @@ { "scene": "./scenes/seedLogo.json", "name": "SEED Logo" }, { "scene": "./scenes/sillyRubber.json", "name": "Rubber"}, { "scene": "./scenes/plasticPress.json", "name": "Plastic Press"}, - { "scene": "./scenes/boxFracture.json", "name": "Box Fracture"} + { "scene": "./scenes/boxFracture.json", "name": "Box Fracture"}, + { "scene": "./scenes/folding.json", "name": "Other Brands Are Available"} ] \ No newline at end of file diff --git a/scenes/pyramid.json b/scenes/pyramid.json deleted file mode 100644 index 1fcb7a4..0000000 --- a/scenes/pyramid.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "version": 1, - "resolution": [ - 809, - 818 - ], - "shapes": [ - { - "id": "shape6", - "position": { - "x": 429.95377929687504, - "y": 181.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - }, - { - "id": "shape0", - "position": { - "x": 428.95377929687504, - "y": 680.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - }, - { - "id": "shape1", - "position": { - "x": 672.953779296875, - "y": 689.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - }, - { - "id": "shape2", - "position": { - "x": 202.95377929687504, - "y": 686.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - }, - { - "id": "shape3", - "position": { - "x": 301.95377929687504, - "y": 431.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - }, - { - "id": "shape4", - "position": { - "x": 576.953779296875, - "y": 435.1437565582371 - }, - "halfSize": { - "x": "97", - "y": "88" - }, - "rotation": -90.03706148292488, - "shape": "0", - "function": "3", - "emitMaterial": "1", - "emissionRate": "4.4", - "radius": 12.02773479659328 - } - ] -} \ No newline at end of file diff --git a/scenes/sandPile.json b/scenes/sandPile.json deleted file mode 100644 index 27e0040..0000000 --- a/scenes/sandPile.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": 1, - "resolution": [ - 1920, - 953 - ], - "shapes": [ - { - "id": "shape1", - "position": { - "x": 955.3963963963963, - "y": 563 - }, - "halfSize": { - "x": "319", - "y": "283" - }, - "rotation": 0, - "shape": "0", - "function": "3", - "emitMaterial": "2", - "emissionRate": "5.3", - "radius": 24.01200900750657 - } - ] -} \ No newline at end of file diff --git a/scenes/sillyRubber.json b/scenes/sillyRubber.json index 2643fa3..df1ea66 100644 --- a/scenes/sillyRubber.json +++ b/scenes/sillyRubber.json @@ -1,34 +1,44 @@ { "version": 2, "resolution": [ - 1102, - 1121 + 1290, + 1313 ], "shapes": [ { "id": "shape0", "position": { - "x": 551, - "y": 560.5 + "x": 645, + "y": 656.5 }, "rotation": 0, "halfSize": { - "x": "230", - "y": "230" + "x": "269", + "y": "269" }, "shape": "0", "function": "3", "emitMaterial": "1", "emissionRate": "1", - "radius": 100 + "radius": 117.09372300179994 } ], "settings": [ + { + "name": "simResDivisor", + "type": "combo", + "value": "16" + }, { "name": "particlesPerCellAxis", "type": "range", "value": "5" }, + { + "name": "simRate", + "type": "combo", + "value": "480" + }, { "name": "fixedPointMultiplierExponent", "type": "range", @@ -39,15 +49,10 @@ "type": "range", "value": "0" }, - { - "name": "iterationCount", - "type": "range", - "value": "8" - }, { "name": "elasticityRatio", "type": "range", - "value": "0.19" + "value": "0.08" }, { "name": "borderFriction", diff --git a/shaders/g2p2g.wgsl b/shaders/g2p2g.wgsl index 2b78fcf..81fb974 100644 --- a/shaders/g2p2g.wgsl +++ b/shaders/g2p2g.wgsl @@ -112,14 +112,13 @@ fn csMain( @builtin(local_invocation_index) indexInGroup: u32, @builtin(workgrou if(projectedDifference.x != 0) { gridDisplacement.x = 0; - gridDisplacement.y = 0; - + gridDisplacement.y = mix(gridDisplacement.y, 0, g_simConstants.borderFriction); } if(projectedDifference.y != 0) { - gridDisplacement.x = 0; gridDisplacement.y = 0; + gridDisplacement.x = mix(gridDisplacement.x, 0, g_simConstants.borderFriction); } dx = gridDisplacement.x; diff --git a/src/ui.js b/src/ui.js index d3fe90c..5812ad7 100644 --- a/src/ui.js +++ b/src/ui.js @@ -143,7 +143,7 @@ const g_uiElements = {type: Range, name: 'elasticRelaxation', desc: 'Elastic Relaxation', default: 1.5, min: 0, max: 10, 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.9, min: 0, max: 1, step: 0.01}, - {type: Range, name: 'borderFriction', desc: 'Border Friction', default: 0.5, min: 0, max: 1, step: 0.1}, + {type: Range, name: 'borderFriction', desc: 'Border Friction', default: 0.5, min: 0, max: 1, step: 0.01}, {type: Combo, name: 'renderMode', desc: 'Render Mode', values:[ {value: RenderEnums.RenderModeStandard, desc: 'Standard'}, {value: RenderEnums.RenderModeCompression, desc:'Compression'},