dilevin / computer-graphics-mass-spring-systems

Computer Graphics Assignment – Mass Spring Systems
1 stars 3 forks source link

sparse mode still slow #8

Open triangleCZH opened 4 years ago

triangleCZH commented 4 years ago

My flag and skirt under sparse-mode are still slow. The FPS is approximately 0.3~1 . I think my laptop is doing its best since it makes such a large noise. Thus I wonder if there is an expected speed to prove that the implementation of sparse mode really works?

triangleCZH commented 4 years ago

Additionally, My skirt doesn't look identical to the one on GIF, so may I know if this seems correct?

image
abhimadan commented 4 years ago

1) Are you running your code in release mode? It should be very fast to run these examples using sparse matrices.

2) I think the skirt in the readme gif has wind enabled, so press "w" and compare the results afterwards.

triangleCZH commented 4 years ago

@abhimadan Thank you for your response.

  1. Yes, I am running it in release mode. I change the three matrices that has a lot of zeros in it. Should I also change other matrices (even those dense ones)?
  2. I think mine might be incorrect because the lower part of the skirt doesn't look very smooth. (In other words, some vertices and edges go through the skirt surface to the other side, and I wonder if this bug is within the scope of this assignment )
image
abhimadan commented 4 years ago

Using a sparse matrix data structure to represent a dense matrix can make performance worse, so be careful with where you use it. In the notation of the assignment Q is sparse and b is dense. This issue has come up in the past, so check the following things:

There's no collision detection so self-intersections like that can happen, but you're right that at least in the skirt example it should look smooth. There are lots of unpredictable bugs that can happen when some of the math is even slightly wrong, so make sure that your dense code is correct, and that you ported it over to sparse matrices accurately.

triangleCZH commented 4 years ago

Thank you for your reply! I will go back to my code and check the things you mentioned.

gabriellemadden commented 4 years ago

When I toggle wind after animation, mine looks the same as yours. If you enable wind while the skirt is in the rest position, then toggle animation, it should look closer to what's in the gif.