A library for 3D rendering in PyGame
Project description
Pygame 3D
Pygame3D is a cross-platform open-source python library for basic 3D rendering in PyGame. It has many features, from 3D rendering to camera control. It is extremely simple, with a streamlined creation process, and just like what its name suggests, it integrates perfectly into PyGame.
Results
Scene rendering:
Installation
To install Pygame3D, use the Python Package Manager and type:
pip install pygame3d
Once it is installed, you can start using it just like any other module!
Documentation
To learn more about this module, you can read its documentation here
Quickstart
Here is a sample code to render a 3D model in Pygame3D, as shown in the image above.
# Basic model loading and rendering
import pygame
import pygame3d
import sys
# Initialize the pygame library
pygame.init()
screen = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
# Create a 3D surface
surface = pygame3d.Surface3D((800, 600))
# Configure background color
surface.background_color = (145, 216, 255) # Sky blue
# Loading a model
model = surface.load_mesh('assets/model.glb')
model.position = (0, 20, -2)
# Add a light
light = surface.add_light('point')
light.position = (20, 20, 20)
light2 = surface.add_light('ambient')
light2.color = (50, 50, 50)
# Main game loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
model.rotation += (1, 0, 0) # Rotate the model
surface.render() # Render the surface to display the newest updates
screen.blit(surface, (0, 0))
pygame.display.update()
clock.tick(60) # 60 FPS
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygame3d-0.1.1.tar.gz.
File metadata
- Download URL: pygame3d-0.1.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fa504b03d093be296f85361d74d8d008f2e10ab95095fbcfa9149f83bb4b9b6
|
|
| MD5 |
c2f7de238f27a805610d56ac468a7625
|
|
| BLAKE2b-256 |
e6c5184b248181c0051c72d6c40084202320106c7a765bd08b0fd509657bba47
|
Provenance
The following attestation bundles were made for pygame3d-0.1.1.tar.gz:
Publisher:
publish.yml on Fr5ctal-Dev/pygame3d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygame3d-0.1.1.tar.gz -
Subject digest:
9fa504b03d093be296f85361d74d8d008f2e10ab95095fbcfa9149f83bb4b9b6 - Sigstore transparency entry: 362183650
- Sigstore integration time:
-
Permalink:
Fr5ctal-Dev/pygame3d@f8c8876c63ea2c99d150d79945b1cc10b24b9e2f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Fr5ctal-Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f8c8876c63ea2c99d150d79945b1cc10b24b9e2f -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygame3d-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pygame3d-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5130875060e106ac5014efd6c0e43e21a120f313e2d65fa04d92830aa2d7577e
|
|
| MD5 |
56655d8b6facc65ab83d9bec12dd0411
|
|
| BLAKE2b-256 |
2a54e4ac1d51ad98bb78a079dae6695e48a57b667244e6fdb8d368e653025617
|
Provenance
The following attestation bundles were made for pygame3d-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Fr5ctal-Dev/pygame3d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygame3d-0.1.1-py3-none-any.whl -
Subject digest:
5130875060e106ac5014efd6c0e43e21a120f313e2d65fa04d92830aa2d7577e - Sigstore transparency entry: 362183675
- Sigstore integration time:
-
Permalink:
Fr5ctal-Dev/pygame3d@f8c8876c63ea2c99d150d79945b1cc10b24b9e2f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Fr5ctal-Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f8c8876c63ea2c99d150d79945b1cc10b24b9e2f -
Trigger Event:
release
-
Statement type: