Payton! Kickstart any 3D OpenGL + GTK Ideas in a few seconds!
BSD-3-CLAUSE License
Payton is a 3D Software Development Kit that serves as a general-purpose playground for programming. With Payton, users can quickly and easily kickstart their ideas and create tools for the next step, such as map editors, small animations, small algorithms, or artificial intelligence for games. Unlike game engines and other libraries that can be too complex and time-consuming to start, Payton comes with pre-set defaults, making it unique and simple to use.
Payton is not intended to be a game engine or a full-featured 3D environment as there are already plenty of tools available for those purposes. However, it excels at tools programming and allows users to easily visualize their goals and achieve them. Users can also move forward from Payton to any other place if they desire.
While 2D graphs and charts are useful in reports, some cases require visualizing data in 3 or 4 dimensions. Payton enables users to extend their graphics into 4 dimensions and read real-time data from sensors, cameras, or any other data source. These sources can be anything that generates time-based 3D data, including thermometers, random number generators, toy cars connected to speed sensors, maps, or vehicle ports. Payton can even handle time-based formulas. Although it can get complex, Payton is designed to be easy to use, even for beginners who can follow the tutorials to kick-start their programming skills.
sudo apt install libsdl2-dev
for debian/ubuntu based linux distros. For other platforms, you can see your favourite package manager.sudo apt install imagemagick
for debian/ubuntu based linux distros. For other platforms, you can see your favourite package manager.From a bash terminal:
pip install payton
This should install all dependencies. If you get any permission errors, you are probably installing the library to system-global so missing some permissions. If you do not want to use pipenv or virtualenv, then you might want to run above command as sudo pip3 install payton
Payton supports Bullet Physics at a basic level for solid geometries.
pip install pybullet
Once Bullet Physics is successfully installed in the same environment as Payton, it will be automatically activated and you will be able to use its basic properties. Check out the relevant examples.
Instead of SDL2, you can use GTK3 (along with all nice GTK3 widgets) with Payton.
You need to install Python GTK3 Bindings.
AWP3D is simply a ZIP file containing every frame as a Wavefront object. To export your animated Blender objects as AWP3D files, you can use the exporter add-on available here:
https://github.com/sinanislekdemir/payton/tree/master/plugins
As of version 0.0.10
, Payton is installable on Anaconda. From Anaconda Prompt:
pip install payton
Is sufficient to install Payton and it's dependencies on Anaconda.
Payton will be available to use with Spyder or JupyterLab on local.
Payton is under active maintenance. This means I am spending some time to fix the bugs or make it better. So you might want to upgrade it occasionally.
pip3 install payton --upgrade
should do the trick!
from payton.scene import Scene
scene = Scene()
scene.run()
This will create your first empty scene and show it inside an SDL window.
Key / Action | Description |
---|---|
Mouse Wheel | Zoom In - Zoom Out |
Right Mouse Button Drag | Rotate Scene |
Middle Mouse Button Drag | Pan Scene |
Escape | Quit Simulation |
C | Change Camera Mode (Perspective / Orthographic) |
Space | UnPause / Pause Scene Clocks |
G | Show / Hide Grid |
W | Change Display Mode (Solid / Wireframe / Points) |
F2 | Previous Camera |
F3 | Next Camera |
H | Open / Close Help Window |
Some options can be configured from the environment variables.
SDL_WINDOW_WIDTH
: Set window width.SDL_WINDOW_HEIGHT
: Set window height.GL_MULTISAMPLEBUFFERES
: Set OpenGL multisample buffer count for antialiasing. (usually 1 or 2)GL_MULTISAMPLESAMPLES
: Set OpenGL multisample sampling count for antialiasing. (usually 1-16)Without GL_MULTISAMPLEBUFFERS
AND GL_MULTISAMPLESAMPLES
, you may notice pixelated graphics. There is no default set for those values because they can vary between graphic cards.
In some older systems or where a decent graphics driver is not installed, you can try running Payton code with MESA. It runs fine. There will be some performance decrease. But it will not be noticeable for basic applications.
To enforce MESA 3.3, you can run payton with:
MESA_GL_VERSION_OVERRIDE=3.3 python <path-to-your-payton-code>
Personally, I dont really read the long descriptive documentation unless necessary. I like things simple and self-explaining. Therefore, instead of writing long documentations, I write simple examples to use each feature of Payton without digging much into the internals.
Examples can be downloaded from Payton Github Page.
You can either download the whole repository as a zip file or you can just git clone
it.
Tested in Windows 10 Paperspace, seems to be working as expected
Supports pyBullet solid geometry physics
make check
is clear before pushing your code.isort .
is not mandatory but highly encouraged.I've choosen to use List[float]
type for Vectors because:
Tuple
and NamedTuple
.dataclass
has an overhead to convert to C-type floats and arrays in memory.So, to gain some performance, I have created the main library with a risk of non-strict vector lengths.