Giter VIP home page Giter VIP logo

pytracer's Introduction

PyTracer

license Build Status Chat on Gitter

Triangle Mesh Loop Sudividing Surface

Proudly rendered with pytracer, head model courtesy of C348b.

Introduction

PyTracer is a photo-realistic rendering interface backended by ray tracing. It may sound counter-intuitive that one may ever wish to implement a ray tracer with Python, nevertheles, PyTracer makes it feasible to do fast prototyping using current state-of-the-art learning libraries which are mostly implemented in Python.

Indeed, albeit to being a little bit slow, PyTracer can do it pretty well. Its object-oriented nature and modular design enables easy experiementing of new algorithms. The development and implementation of PyTracer largely take references from Physically Based Rendering, both second and third edition.

Installation

Currently, the integration with C++ has not completed, hence no compile is needed. PyTracer has the following dependencies:

  • scipy: for KDTree structure for fast measured texture retreival
  • numpy, PILLOW: for image I/O
  • quaternion: for interpolation of motion transformations

To install the dependencies using pip, one may issue the following command:

pip install -r requirements.txt
pip install numpy-quaternion

After preparation, clone PyTracer via:

git clone https://github.com/zjiayao/pyTracer
cd pyTracer

One may also wish to unit test several low-level modules before use (assume pytest is installed, otherwise, one may do a pip install pytest):

PYTHONPATH=$PWD:$PYTHONPATH py.test

It might be convenient to move the pyTracer directory to your favourite location and add it to your PYTHONPATH (for example, under a virtualenv), assuming current directory is the root of pyTracer, one may add it via:

export PYTHONPATH=$PWD:$PYTHONPATH

Quick Start

The main work flow of PyTracer is analogous to pbrt. To start, one may render the sample head model image via:

python -c "import examples/head_mesh_render.py"

This gives a quick rendering of 128 * 128 pixels, with straitified sampling of 1 * 1 sampling rate. By default the rendered image is written to tmp.png.

To play around with other componenets, please visit the quick tutorial with examples at Quick Start Guide.

Features

Currently, PyTracer supports the following features:

  • Triangle Mesh with Loop Subdividing Surface Modeling;
  • Full Spectrum Rendering (Sampling Spectrums Supported);
  • Bounding Volume Hierarchy Accelerator;
  • Projective, Perspective and Orthographic Cameras;
  • Multiple Types of Textures;
  • Multiple Types of Materials including Irregular Sampled Isotropic BRDF;
  • Spot and Area Diffuse Lights;
  • Monte Carlo Integration with MCMC Samplers;
  • (Single) Path Integrator and Direct Lighting Integrator.

Users familiar with pbrt may find it intuitive to work with other components.

Development

PyTracer is still under development for supporting more features, which are, tentatively:

  • MERL BRDF Support;
  • Volume Scattering Modeling;
  • Bidirectional Path Tracing and More Light Transport Algorithm;
  • Direct support to pbrt Flavour Input Files and Other UI/UX Improvements;
  • Optimization with C++17;

The general goals for this stage are:

  • Speed. PyTracer is currently amazingly slow.
  • Robustness. Some components are implemented but have not been thoroughly tested yet.

Gallery

Head Model

Cite This Project

PyTracer is maintained by Jiayao Zhang advising by Li-Yi Wei. The bib entry for this repo may be as follows:

@misc{pytracer:2017,
	title = {pyTracer},
	year = {2017},
	author = {Jiayao, Zhang and Li-Yi, Wei},
	publisher = {GitHub},
	journal = {GitHub Repository},
	howpublished= {\url{https://github.com/zjiayao/pyTracer}
}

pytracer's People

Contributors

dependabot[bot] avatar zjiayao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pytracer's Issues

Weird Reflection Materials

Some materials (e.g., Glass, ImageMap) may not properly rendered the reflection effect with SpecularReflect(). This issue should be revisited on completion of implementation for volume scattering.

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.