Using the Chapter s Source Code

[ LiB ]

Using the Chapter's Source Code

You can use the sample files to render images using the photon mapping application. These are scene files that simulate specific lighting effects for photon mapping. The files are located in the path /BookCode/Chapter14/Scenes on the CD. The files are as follows :

  • Diffuse_Interaction1.txt

  • Diffuse_Interaction2.txt

  • Diffuse_Reflection1.txt

  • Diffuse_Reflection2.txt

To run the final program in the book, execute the following file:

/Book Code/Chapter 14/Photon Mapping.exe

The program begins running and will soon prompt you to enter the path for the scene definition file. When it asks "Enter Information:", you enter one of the following:

 /scenes/diffuse_interaction1.txt /scenes/diffuse_interaction2.txt /scenes/diffuse_reflection1.txt /scenes/diffuse_reflection2.txt 

The program will also ask for how many photons you would like to scatter per object. A good number for spheres is 10000, whereas a good number for triangles is 1000. It will also ask what the photon contribution is. A good range is 50-100.

The photon mapping algorithm will then begin scattering photons. The program starts the ray tracing process and then again will prompt you to enter the output path for the rendered file stored on the image plane. You'll enter one of the following:

 /scenes/myoutput1.ppm /scenes/myoutput2.ppm /scenes/myoutput3.ppm /scenes/myoutput4.ppm 

You can then browse to that path and open up the files in IrfanView. However, I've already created the exported files for you and placed them in the following folder:

 /Book Code/Chapter 14/Output 

The files in this folder are:

 12/16/2002  03:11p           3,236,471 diffuse_interaction1.ppm 12/16/2002  05:04p           2,964,059 diffuse_interaction2.ppm 12/16/2002  03:09p           3,092,857 diffuse_reflection1.ppm 12/16/2002  05:26p           3,018,282 diffuse_reflection2.ppm 

If you don't want to compile or run any programs, you can see an example of some renders I have completed for you (at /Book Code/Chapter 14/Renders) . These 17 renders show different examples of lighting effects using ray tracing and photon mapping. Remember you need to have IrfanView installed in order to view them.

[ LiB ]


Focus On Photon Mapping
Focus On Photon Mapping (Premier Press Game Development)
ISBN: 1592000088
EAN: 2147483647
Year: 2005
Pages: 128
Authors: Marlon John

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net