diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-damping-0.gif b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-0.gif new file mode 100644 index 0000000..60fad2e Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-0.gif differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-damping-25.gif b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-25.gif new file mode 100644 index 0000000..a54249f Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-25.gif differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-damping-50.gif b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-50.gif new file mode 100644 index 0000000..1ef1f32 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-50.gif differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-damping-99.gif b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-99.gif new file mode 100644 index 0000000..ce834c1 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-damping-99.gif differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-density-100.png b/hw4/Images/Task2/sp24-clothsim-pinned2-density-100.png new file mode 100644 index 0000000..5c92e54 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-density-100.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-density-1000.png b/hw4/Images/Task2/sp24-clothsim-pinned2-density-1000.png new file mode 100644 index 0000000..bc3093d Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-density-1000.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-density-10000.png b/hw4/Images/Task2/sp24-clothsim-pinned2-density-10000.png new file mode 100644 index 0000000..59580e1 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-density-10000.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-density-15.png b/hw4/Images/Task2/sp24-clothsim-pinned2-density-15.png new file mode 100644 index 0000000..0effb2e Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-density-15.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10.png b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10.png new file mode 100644 index 0000000..6a73a58 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-ks-100.png b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-100.png new file mode 100644 index 0000000..c81723e Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-100.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10000.png b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10000.png new file mode 100644 index 0000000..be7b246 Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-10000.png differ diff --git a/hw4/Images/Task2/sp24-clothsim-pinned2-ks-5000.png b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-5000.png new file mode 100644 index 0000000..dc647bd Binary files /dev/null and b/hw4/Images/Task2/sp24-clothsim-pinned2-ks-5000.png differ diff --git a/hw4/index.html b/hw4/index.html index 75bd01d..6170ee8 100644 --- a/hw4/index.html +++ b/hw4/index.html @@ -127,9 +127,7 @@

Overview

Section I: Masses and Springs

- Explain how you implemented the mass-spring system to represent the cloth. -

Because the cloth's springs needed to be in row major order, I first looped through the number of height @@ -202,6 +200,26 @@



Section II: Simulation via Numerical Integration

+
+

+ Explain how you implemented the numerical integration to simulate the cloth's movement. +

+

+ To simulate the cloth's movement, I first calculated the total force exerted on each of the PointMass with the given external_accelerations vector. Afterwards, I applied the spring + correction forces to each of the PointMass objects using the + following equation: + $$f_{\vec{a} \rightarrow \vec{b}} = k_s \frac{\vec{b} - \vec{a}}{\|\vec{b} - \vec{a} \|}(\|\vec{b} - \vec{a} + \| - l)$$ + I made sure to check if a particular spring was enabled and disregarded it if it was not. With the total + force calculated, I implemented Verlet integration to compute the new location for each of the PointMass objects using the following equation: + $$x_{t + dt} = x_t + (1 - d) \cdot (x_t x_{t - dt}) + a_t \cdot (dt)^2$$ + where $a_t$ is the total force from before divided by the mass of the PointMass. $d$ represented the damping factor and was used to slow down the velocity of the cloth because in real life friction and air resistance are forces that oppose the velocity of the cloth. Finally, to ensure that the springs did not stretch more than 10% of their original rest length, I looped through each pair of springs and shifted them towards each other and checked for corner cases when they would be pinned and could not be adjusted. +

+
+

Experiment with some the parameters in the simulation. To do so, pause the simulation at the start with @@ -211,7 +229,7 @@

time from the cloth's starting position by pressing R. Describe the effects of changing the spring constant ks; how does the cloth behave from start to rest with a very low ks? A high ks + class="highlighter-rouge">ks?

Here are the screenshots of the cloth from scene/pinned2.json with different ks values: @@ -219,16 +237,24 @@

+ + +
+ +
pinned2.json with ks = 10 +
+
pinned2.json with ks = 100
- +
pinned2.json with ks = 1000 + class="highlighter-rouge">ks = 5000
@@ -240,11 +266,115 @@

+
+ At a low ks, the cloth is much more elastic and less rigid and thus + throughout the simulation the fabric would stretch easier. As I increased the ks, the cloth became stiffer and stiffer and less likely to stretch as + much. The cloth would also be more likely to rest in a more rigid position as the spring forces would oppose + gravity more. There were also fewer wrinkles as the cloth would be less likely to fold. +

+
+
+

+ What about for density? +

+ Here are the screenshots of the cloth from scene/pinned2.json with + different density values: + +
+ + + + + + + + + +
+ +
pinned2.json with density = 15 +
+
+ +
pinned2.json with density = 100 +
+
+ +
pinned2.json with density = 1000 +
+
+ +
pinned2.json with density = 10000 +
+
+
+
+ At a low density, the cloth acted very similarly to a high ks value as the cloth was less likely to stretch. The + top of the cloth had fewer deformations and wrinkles. Because the volume of the cloth never changed, a lower + density meant that the mass was smaller and so the force of gravity was + less likely to deform the cloth. As I increased the density, the cloth + was more likely to stretch and deform as the mass was larger and the force of gravity was higher and could + oppose the spring forces more.

- Show us a screenshot of your shaded cloth from scene/pinned4.json in its final resting state! If you choose + What about for damping? +

+ Here are some gifs that illustrate the effects of the damping parameter on the cloth from scene/pinned2.json. To view them, please + visit https://cal-cs184-student.github.io/hw-webpages-sp24-ianhdong/hw4/. + +
+ + + + + + + + + +
+ +
pinned2.json with damping = 0 +
+
+ +
pinned2.json with damping = 25 +
+
+ +
pinned2.json with damping = 50 +
+
+ +
pinned2.json with damping = 99 +
+
+
+
+ Damping is a force that opposes the velocity of the cloth and slows it down. When there was no damping, the + cloth would oscillate wildly and did not come to rest. As I increased the damping, the cloth would come to rest + and the oscillations would dramatically decrease. +
+
+
+

+ Show us a screenshot of your shaded cloth from scene/pinned4.json in + its final resting state! If you choose to use different parameters than the default ones, please list them.

Here are the screenshots of the shaded cloth from scene/pinned4.json in @@ -859,7 +989,7 @@

class="highlighter-rouge">PointMass at every time step. Here are a few screenshots of wind acting upon the cloth where the wind acts more strongly towards the bottom. To view the gif, please - visit this page linked at https://cal-cs184-student.github.io/hw-webpages-sp24-ianhdong/hw4/.

@@ -901,6 +1031,36 @@

+
+
+

Credits

+
+

Here were the resources that I used to help me complete this homework. Special thanks for giving me the + starting points and allowing me to build off of them.

+ + +
\ No newline at end of file