hugohadfield / raytrace

A toy conformal geometric algebra ray tracer in python

Home Page:https://www.researchgate.net/publication/333704855_Ray-Tracing_Objects_and_Novel_Surface_Representations_in_CGA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clifftrace

Overview:

This project uses Conformal Geometric Algebra (CGA) to build a ray tracing engine with the clifford library with the following functionality:

  • Recursive tracing of reflected rays up to a specified max depth
  • A Blinn-Phong lighting model
  • Shadows
  • Various CGA primitives and surfaces
  • Multiple point light source

This project was originally built by Sushant Achawal as part of his masters project and is now used for benchmarking clifford and experimenting with CGA surfaces.

Here are a couple of the latest rendering from the code in the repo:

drawing

drawing

Splines

The code can also generate splines of various types through different objects. Here are some N'th order Bezier curves:

Order 1 Order 2 Order 3

It can also generate meshed and textured .obj files with correct vertex normals. Here is a KB spline through control circles with a checkerboard texture map applied:

horn shape

Usage:

Run the script with python3 clifftrace.py

Package requirements:

The script requires the following non-standard python packages:

Read about Geometric Algebra!

Geometric Algebra is a super exciting field for exploring 3D geometry and beyond. For further reading into GA see:

  • Many of the concepts used in the ray tracer can be found in A Covariant Approach to Geometry using Geometric Algebra which can be found online here. The report really summarises the power of working in the conformal model.

  • For a more complete introduction to GA check out Geometric Algebra for Physicists and for a deeper look into GA theory: Geometric Algebra for Computer Science: An Object-Oriented Approach to Geometry (companion site here) which includes documentation of another ray tracer implemented in GA!

About

A toy conformal geometric algebra ray tracer in python

https://www.researchgate.net/publication/333704855_Ray-Tracing_Objects_and_Novel_Surface_Representations_in_CGA


Languages

Language:Jupyter Notebook 75.6%Language:Python 24.4%Language:Shell 0.0%