This project came from a question on Reddit. Here is the original question.
The poster asked why their physics sim with many similar objects resulted in some of the objects moving at different speeds. Their video is here: https://youtu.be/bsmgvC4Nafo
The attempts at a solution
After many hours I conclude that this task is not possible using the Blender physics engine. I tried many things, including:
- Making thin objects with only 1 face
- Making thick objects with multiple faces
- Turning the simulation substeps up to 1000 and down to 1
- Increasing the framerate of the scene
- Scaling things up and down
- Applying and not applying scale
- Locking various parts of the rotation and translation using the lock in the properties panel
- Locking the rotation and translation using a rigidbody constraint
- Changing the height of the objects by cutting with a boolean modifier
- Changing the height of the objects using scale instead of cutting them
- Using the calculate mass option to give each object a mass based on its size
- Using the mesh collision shape as opposed to the convex hull (much worse results)
The only time I got things to stay somewhat in sync was when I turned the damping up to ridiculous amounts. This of course means that the objects do not flip like they are supposed to so it was useless. I am open to someone proving me wrong about all of this.
My guess that the approximations used for the physics here are just not fine enough to produce an exact result. Also, I’m pretty sure it would be essentially impossible to do this experiment in real life and have perfectly synchronized parabolas, so I guess this is a case of the simulation being accurate to reality.
For my original render I created a material to make the parabolas a different color depending on their distance from the center. I took the Y value of the each object and divided it by the Y value of the last object. I fed this into a color ramp that went from red to blue.
Rendering was done using Cycles with 32 samples and denoising turned on. I used Cycles because I don’t know how to make Eevee render shadows beyond a certain distance. I guess there is a way, but this was not too horrible. It took about 10 seconds per frame.
For the second render seen at the top of this post, I decided to reduce the camera motion. I also added a checker pattern to help show the different parabolas. Things were still hard to distinguish, so I used Freestyle to add the white lines on the edges. It adds quite a bit to the render time though. The geometry of the shapes is simple enough that I doubt it would be hard to get the same effect using shaders.
Some advice on render formats
I rendered the original video straight to a H.264. I realized after it was all done how bad the video compression made things look. The default setting for compression in Blender results in small files but poor quality. At the very least, turn it up to “Perceptually Lossless”. I did some small scale tests with EEVEE and noted that the WEBM format was much better at keeping the black areas black.
If hard drive space is not a concern, rendering to PNGs allows more freedom to adjust the compression without having to spend hours rendering the animation again.
There is also the side benefit of the process being much safer if the computer shuts down or Blender crashes. For some video formats, if the process is cut off before it can finalize the file, the entire file becomes unreadable. When rendering to images however, the most you will lose is one frame.