Coder Social home page Coder Social logo

shinythings's Introduction

ShinyThings Ray Tracing Renderer

render of the provided example scene

About

ShinyThings is a simple ray tracing renderer build using Python 3 and C extensions. The bulk of the rendering is written in C for maximum performance, but is written as a Python C Extension to access some of Python's higher-level facilities for ease of use. Once ShinyThings is installed, a Python script which procedurally builds a scene may be run, which in turn invokes the rendering engine. When rendering is complete, the engine returns an image which can be saved or displayed all within Python using Pillow Image objects.

The image above was rendered with ShinyThings to showcase as many features as possible. It displays simple Phong reflection models (see Stanford bunny), as well as more complex features such as colored translucency and refraction (see Lucy, tinted glass angel statue). It was rendered at a 960x540 resolution using the provided run.py example script on a 3.7 GHz Intel i3-4170 processor in 3 minutes and 14 seconds. ฯ€

Features

  • spheres & planes
  • complex triangle models
  • Phong reflection model
    • ambient, diffuse, and specular lighting
  • multiple point light sources with inverse square falloff
  • hard shadows
  • background color setting
  • camera positioning and arbitrary resolution rendering
  • Phong interpolation of normals
  • Wavefront .obj file loading
  • k-d tree spatial partitioning to optimize complex triangle model intersection
  • transparency and Beer's law translucency
  • reflection and refraction
  • complex triangle model transforms
    • translate, scale, and rotate
  • Monte Carlo pixel sampling

Installation and Running

  1. Clone the repository, and cd into the project root directory.
  2. Install a Python 3 virtual environment (optional).
  3. Install all requirements with pip install -r requirements.txt (you may need to install some other dependencies).
  • NumPy and Pillow (Python Imaging Library drop-in replacement) are required.
  1. Install ShinyThings with pip install ..
  2. Create a new scene script, or execute the example script with python3 run.py.
  • The render may take some time to complete (the example may take upwards of 3 minutes, and both saves an image file to the project root and attempts to display the image in a window).

API

Currently, there is no set-in-stone API to use, and most scene data is painstakingly passed to the renderer in a specific order. The example scene in run.py contains some documentation of features, but is not guaranteed to be user-friendly yet. Eventually, a real API will be built and documented. Additionally, some features (such as Monte Carlo sampling) are currently hard-coded, and will be made available for modification in the future.

Planned Features

  • clean, documented API
  • UV texture mapping
  • Catmull-Clark subdivision surfaces
  • multithreaded / distributed rendering
  • area light sources with soft shadows
  • depth of field
  • motion blur
  • photon mapping (to support things like caustics)

shinythings's People

Contributors

abau171 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.