For Your Info   
   For Fun   
   Real Time   


Now that we've learned some of the core software rendering concepts, it's time to move onto some more advanced topics. We're moving on to PHP because in order to teach blending, shading, lighting, etc it's necessary to be able to use color. Games like Wolfenstein 3D, DooM and Quake had to deal with palettes since consumer level graphics cards tended to be limited to 256 colors. We're not going to bother with palettes and instead will skip directly to true-color. Palettes are a problem seperate of what I'm trying to teach with these tutorials.

The goal of the PHP tutorials is to teach a number of ray tracing concepts starting with coloring vertices and then moving into lighting and texture generation. The end goal before moving to C++ is to be able to ray trace a scene.

Since PHP is a server side script these tutorials are going to contain only static images of the output. The source code will be in a text file and linked for you to download to run on your own system. In order to run the code you will need to download and install PHP from and Apache from Use the latest version of PHP 4. PHP 5 is available but this code is not tested with it. If you don't already have Apache installed I recommend using version 2.x since it's a bit easier to setup. Once you have PHP properly installed (don't forget to enable the GD graphics libary in the PHP.ini) simply download the tutorial code to anywhere Apache is serving up pages from and give it a .php extension. Then load it fire up your browser and point it at the tutorial on your local machine.

For Windows users you will need to download both the PHP installed and the ZIP package. Run the installer and then dump the contents of the zip file into the directory you installed PHP. Besides enabling the gd graphics library you will also need to set Register Globals to true. The PHP.ini file will be in your root Windows directory.

To enable the GD graphics library you will need to search for "php_gd2.dll" and then remove the semicolon from the beginning of the line. To enable globals (example: lesson17.php?debug=1) you will need to find "register_globals" and set it to "on."

To enable PHP in Apache you will need to add the following two lines to your http.conf file.

   LoadModule php4_module "c:/php/sapi/php4apache.dll"
   AddType application/x-httpd-php .php

Make sure the path matches where the DLL is located on your system. Restart Apache and you should be good to go.

All Tutorials Copyright 2004-2007 Icarus Independent
View the License Agreement