Skip to content

codeChaosConductor/Simple-3D-Object-Projection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple 3D Object Projection

Description

This project demonstrates a simple 3D perspective projection of an object using Python and the Pygame library. The user can control the position of the object along different axes, change the Object itself and control different values.

Instructions

  1. Use W and S keys to move the object up and down along the y-axis.
  2. Use A and D keys to move the object left and right along the x-axis.
  3. Use Y and X keys to move the object forward and backward along the z-axis.

Dependencies

  • Python standard library
  • Pygame library
  • Numpy library

Setup

  1. Install Python: https://www.python.org/downloads/
  2. Install Pygame: pip install pygame
  3. Install Numpy: pip install numpy

Usage

  1. Clone the repository: git clone https://github.com/codeChaosConductor/Simple-3D-Object-Projection/
  2. Navigate to the project directory: cd <project-directory>
  3. Run the script: python simple_object_projection.py

Configuration

You can customize the following parameters in the script:

  • fov: Field of view for the perspective projection.
  • far: Far clipping plane distance.
  • near: Near clipping plane distance.
  • speed: Movement speed of the object.
  • draw_vertices: Set to True to draw vertices.
  • draw_edges: Set to True to draw edges.

Object Configuration

You can create new objects by using the following lists in create_object_mesh.py

  • points: List of 3D coordinates representing object vertices.
  • edge_connections: List of connections between vertices to create edges.
  • face_connections: List of connections between vertices to create faces. Enter the filename of the object and run the script to create the object. Now change filename in simple_object_projection to the desired object and run the script.

Credits

  • Developed by Fynn Mannack
  • If you use this code in your project, please provide attribution by linking to this repository in your project documentation or source code.

This code was written as a part of my research paper (Facharbeit) about 3D-animations.

Feel free to modify the code, experiment with different objects, and integrate it into your own projects! If you find any issues or have suggestions, please create an issue or pull request.

About

A simple 3d object viewer using perspective projection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages