Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A toy ray tracer written in PHP. Comes with sample scenes.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
images
raytracer
LICENSE
README.md
sample_01.php
sample_02.php
sample_03.php
sample_04.php
sample_05.php
sample_06.php
sample_07.php
sample_08.php

README.md

What is php-raytracer?

This is a ray tracing software written in PHP. It's pretty much pointless, I just wrote it "for the lolz".

What is a ray tracer?

A ray tracer is a piece of software which generate 3D images by simulating the physics of light. The result is a very realistic 3D image.

sample image.

If you want to read more about ray tracing, you should checkout www.povray.org (a real raytracer).

Why write pointless code?

I decided to share various pieces of functional code (dubbed "for the lolz"). These pieces of code are meant to illustrate fundamental computer science concepts, so someone looking at this code might learn something useful.

If you are teaching programming and you find a use in these projects, feel free to use my code however you like.

Coordinate System

The coordinate system is the following:

  • x points right
  • y points up
  • z points away from you

This system is also known as the "left-hand".

Running the sample code

For Linux or Mac OS:

git clone git://github.com/alokmenghrajani/php-raytracer.git cd php-raytracer php sample_01.php

and then open images/sample_01.bmp in your favourite image viewer.

Something went wrong with that request. Please try again.