What are good libraries for creating a python program for (visually appealing) 3D physics simulations/visualizations?

前端 未结 4 583
广开言路
广开言路 2021-02-10 04:02

What are good libraries for creating a python program for (visually appealing) 3D physics simulations/visualizations?

I\'ve looked at Vpython but the simulation

相关标签:
4条回答
  • 2021-02-10 04:47

    3D support for python is fairly weak compared to other languages, but with the way that most of them are built, the appearance of the program is far more mutable than you might think. For instance, you talked about Vpython, while many of their examples are not visually appealing, most of them are also from previous releases, the most recent release includes both extrusions, materials, and skins, which allow you to customize your appearance much moreso than before.

    It is probably worth noting also, that it is simply not possible to make render-quality images in real time (cycles is a huge step in that direction, but it's still not quite there). I believe that most of your issue here is you are looking for something that technology is simply not capable of now, however if you are willing to take on the burden for making your simulation look visually appealing, Vpython (which is a gussied up version of PyOpenGL) is probably your best bet. Below is a run down of different technologies though, in case you are looking for anything more general:

    Blender: The most powerful python graphics program available, however it is made for graphic design and special effects, though it has very complex physics running underneath it, Blender is not made for physics simulations. Self contained.

    Panda3D: A program very often compared to Blender, however mostly useful for games. The game engine is nicer to work with than Blender's, but the render quality is far lower, as is the feature-richness. Self contained

    Ogre: A library that was very popular for game development back in the day, with a lot of powerful functionality, especially for creating game environments. Event handling is also very well implemented. Can be made to integrate with other libraries, but with difficulty.

    VPython: A library intended for physics simulations that removes a lot of the texture mapping and rendering power compared to the other methods, however this capability is still there, as VPython is largely built from OpenGL, which is one of the most versatile graphics libraries around. As such, VPython also is very easy to integrate with other libraries.

    PyOpenGL: OpenGL for Python. OpenGL is one of the most widely use graphics libraries, and is without a doubt capable of producing some of the nicest visuals on this list (Except for Blender, which is a class of its own), however it will not be easy to do so. PyOpenGL is very bare bones, and while the functionality is there, it will be harder to implement than anything else. Plays very will with other libraries, but only if you know what you're doing.

    0 讨论(0)
  • 2021-02-10 04:54

    From your question, it is not clear what you want to achieve. Do you want to create a standalone application that can be used to control the simulation at runtime, or, create a simulation using Python that can then be viewed offline?

    For the latter, you could look at Blender, an open source 3D content creation suite which includes a python scripting interface giving access to most (if not all) of the internals of the application. Blender comes with some physics and particle libraries which might be of use and as an application is indicative of the type of software used to make visual effects for films etc.

    If you want to make a standalone application to control the simulation at runtime, this is most likely not a suitable option. However if you want to produce a series of viewable images it might be worth a look.

    0 讨论(0)
  • 2021-02-10 04:55

    Try PyOpenGL. It is a library that provides Python bindings to OpenGL through the Python ctypes library.

    Heres a demo of this:

    PyOpenGL baseball demo

    0 讨论(0)
  • 2021-02-10 04:59

    If I needed a visualization package for python, I would start with Processing.py: https://github.com/jdf/processing.py

    This is a python binding for the java-based Processing.org codes. A quick comparison can be found here: http://wiki.processing.org/w/Python_Comparison

    Of course, if you are not constrained to python, then Processing itself would also be a good starting point: http://processing.org

    There are also python bindings out there for Visualization Toolkit (VTK), but most of their examples are either C++ or Tk.

    If all you're looking for is scene graph to move geometries around, not native vis, then I have seen some python binding for Open Scene Graph out there, eg: http://code.google.com/p/osgswig/

    Good Luck!

    0 讨论(0)
提交回复
热议问题