Skip to content

HTTPS clone URL

Subversion checkout URL

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

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
images Fixed bug in phong rendering + reorganized some of the code.
raytracer fix renderers
LICENSE Quickly hacked together ray tracer...
README.md playing with markdown
sample_01.php Reorganized the lights
sample_02.php poor man's anti aliasing. This looks more like noise, so I still need…
sample_03.php poor man's anti aliasing. This looks more like noise, so I still need…
sample_04.php
sample_05.php poor man's anti aliasing. This looks more like noise, so I still need…
sample_06.php poor man's anti aliasing. This looks more like noise, so I still need…
sample_07.php poor man's anti aliasing. This looks more like noise, so I still need…
sample_08.php poor man's anti aliasing. This looks more like noise, so I still need…

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.