GithubHelp home page GithubHelp logo

jacoblau0513 / pyrt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martinchristen/pyrt

0.0 1.0 0.0 32.38 MB

pyRT - The Python Raytracer

License: Other

Jupyter Notebook 86.11% Python 13.88% Batchfile 0.02%

pyrt's Introduction

PyRT - The Python Raytracer

CI Gitter contributions welcome Code Climate Code Health image5

Logo

PyRT (pronounced pirate) is a raytracer/image generator for Python 3.5 and higher. This project is mainly done with the following in mind:

  • Ray Tracing in the Jupyter Notebook
  • Teaching ray tracing
  • Exploring ray tracing concepts for geo data using Python.
  • Rendering geo data, including large point clouds.
  • Implementing new algorithms for rendering large 3D city models.
  • Creating 3D-Maps from OpenStreetMap data
  • Server-side rendering / cloud based rendering
  • ...

PyRT is work in progress.

Installation

Installation can be done with pip. Please note that pyrt is still under heavy development and not yet meant for production. (API breaks are frequent!)

pip install pyrt

Currently it is recommended to pip directly from the repository:

pip install https://github.com/martinchristen/pyRT/archive/master.zip --upgrade

Dependencies

PyRT doesn't have any dependencies. Generated images are just RGB or RGBA Arrays. To create jpg or png or other images, many demos use Pillow (PIL). So it is highly recommended to install it.

Getting Started: Try the examples

There are a lot of examples available how to use this module. This is the recommended way to get started with pyRT.

Example 01 Example 12b Example 13 Example 08

View all examples

Creating Scenes

PyRT is not a 3D-modelling package. It is all about rendering from code.

In PyRT you create a scene first. Scenes consist of atleast one camera and geometry. Creation of scenes is done in an object oriented way:

from pyrt.math import *
from pyrt.geometry import Triangle, Vertex
from pyrt.material import PhongMaterial
from pyrt.camera import PerspectiveCamera
from pyrt.renderer import SimpleRT
from pyrt.scene import Scene

camera = PerspectiveCamera(640,480)
scene = Scene()
scene.add(Triangle(Vertex(position=(0, 0, 0)),
                   Vertex(position=(0, 5, 0)),
                   Vertex(position=(1, 5, 0)), material=PhongMaterial()))

scene.setCamera(camera)

engine = SimpleRT()

imgdata = engine.render(scene)

PyRT has an open rendering concept, you can create your own renderer. In the example above "SimpleRT" was used, which is a minimalistic reference implementation.

Python & RayTracing, isn't that too slow ?

No. Custom renderers can be written in C with Python bindings. This is planned in future, later versions will even support the GPU using OpenCL and/or other libraries, but at the moment the primary focus is to create a "pythonic" ray tracer.

License

PyRT is released under MIT. More information about this license can be found under: https://opensource.org/licenses/MIT

About the Author

PyRT is created and maintained by Martin Christen. You can contact me by e-mail: [email protected]

Please note: This project is mostly developed in my spare time, there is no official support or anything.

pyrt's People

Contributors

martinchristen avatar gjacquenot avatar

Watchers

James Cloos avatar

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.