This code uses the Panda3D game engine in order to create synthetic optical flow from moving 3D objects
pip install panda3d scikit-image
python panda.py
# You can visualise the saved optical flow maps with ffmpeg's ffplay
ffplay -framerate 24 -i "out/%05d_flow_vis.png"
Showing original frame, visualised vertex coordinates, and visualised optical flow:
panda.mp4
Or for a bouncing cube:
python cubeortho.py .5