Code Monkey home page Code Monkey logo

simple-3d-object-projection's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.